I've been using nvim for a while and recently thought about checking emacs out after learning about evil mode. I made init.el in .config/emacs, installed evil mode and figured i would try to enable it whenever i start up emacs.
So i wrote this bit of code in init.el:
(defun evil-mode-on ()
(require evil)
(evil-mode 1))
(add-hook 'after-init-hook 'evil-mode-on)
But unfortunately it doesn't seem to work and i'm not sure what i'm doing wrong. Any help would be very much appreciated and thanks in advance.
You seems to be missing apostrophe(') in require. It should be (require 'evil)
Enabling evil mode at startup could be as simple as specifying
(require 'evil)
(evil-mode 1)
in your init.el file as long as package is already installed and/loaded.
Github page has in detailed instruction to install it automatically with the help of use-package.
Related
I've tried to find an answer to this specific question but had no luck. Or maybe I'm simply asking the wrong question.
To keep it simple: I follow the emacs' EDE Quick Start guide. Everything flows just fine and I get the expected results.
The problem arises when i close emacs and try to open the project again.
At that point I get the infamous "Corrupt object on disk" error.
I see it can be used another kind of project (ede-cpp-root-project) but it lacks all basic functionalities that should be hand-made, but that's not what I'm interested in. I would like to use ede-proj-project.
I'm interested in understanding why this happens. Why I can't open a project that worked just fine before closing emacs? What's changed just by closing emacs?
Am I missing something?
FYI: If it is useful information, I'm using emacs version 25.3.1 but I've tried few other earlier versions with the same result.
PS: As you can probably tell, I'm not really skilled so, please, forgive me if it is an annoying question.
I had the same problem.
Copy this into your .emacs startup configuration file
(require 'cedet)
(require 'eieio)
(require 'eieio-speedbar)
(require 'eieio-opt)
(require 'eieio-base)
(require 'ede/source)
(require 'ede/base)
(require 'ede/auto)
(require 'ede/proj)
(require 'ede/proj-archive)
(require 'ede/proj-aux)
(require 'ede/proj-comp)
(require 'ede/proj-elisp)
(require 'ede/proj-info)
(require 'ede/proj-misc)
(require 'ede/proj-obj)
(require 'ede/proj-prog)
(require 'ede/proj-scheme)
(require 'ede/proj-shared)
I found the solution here:
https://emacs.stackexchange.com/questions/17950/ede-load-project
which lead to CEDE project:
https://www.emacswiki.org/emacs/CEDET_Quickstart
It worked for me. - GNU Emacs 25.2.2
I've read in a lot of places such as the WikEmacs (http://wikemacs.org/wiki/Evil) that Emacs24 already came with support for Evil mode, no need to install it via el-get. But I can't seem to understand how do I activate it.
I tried just adding the
(require 'evil)
(evil-mode 1)
lines to my .emacs but it can't seem to work, how do you guys use the built-in evil mode on emacs24? without cloning git repositories, etc.
The statement on WikEmacs is false; evil-mode is not included in Emacs 24. (As it's a wiki, I just edited the page and removed that text.)
There are many ways to install evil-mode. I'd suggest activating the MELPA package repository by adding the following to your .emacs file:
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.org/packages/") t)
(package-initialize)
Then type M-x list-packages, find evil in the list, and install it.
I just followed this site to install auto-complete on Emacs. I installed it with "M-x load-file RETURN ~/path/to/etc/install.el".
The output of my installation was: http://paste.ubuntu.com/6184523/
After that, I added the recommended code to my ~/.emacs file and restarted Emacs. Typing "M-x auto-complete-mode" says "No match". I also tried to fix it by replacing flet with c-flet etc. but it hasn't changed anything too.
Version: GNU Emacs 24.3.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.8.2)
Emacs has a package manager now. So just install the package from the list and you're done.
Here's the configuration that adds the two most popular repositories:
(package-initialize)
(add-to-list
'package-archives
'("marmalade" . "http://marmalade-repo.org/packages/"))
(add-to-list
'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/"))
After this, M-x package-list-packages. The rest is pretty intuitive.
UPD: A simple auto-complete setup for C++
(add-hook 'c++-mode-hook
(lambda()
(semantic-mode 1)
(define-key c++-mode-map (kbd "C-z") 'c++-auto-complete)))
(defun c++-auto-complete ()
(interactive)
(let ((ac-sources
`(ac-source-semantic
,#ac-sources)))
(auto-complete)))
I tried some solutions that worked for other people, but it didn't quite work out.
Try setting the environment variable(s) to ~/emacs.d/ in both .profile and .bashrc
If that doesn't work out, try exporting the environment variable(s) with su root (won't work with sudo).
At least that worked for me while trying to install auto-complete-mode with golangs auto-complete-mode
According to the guide on the Internet, we can search in the HyperSpec for the symbol like "format" in emacs by typing C-c C-d h , However, I just cannot have it work, emacs just prompts that there's no completion for the symbol. Can somebody cope with it? thanks in advance!
Are you actually using the Slime REPL mode? Sometimes, when starting Slime without any configuration, you're not getting the REPL mode, and instead you'll be sitting in the *inferior-lisp* buffer.
First of all, check what the title of the buffer is. If it's *inferior-lisp*, it's not the correct one. It should read *slime-repl sbcl* (where sbcl refers to the CL implementation you're using).
If this is the case, then you need to make sure you enable slime-fancy in your Emacs init file. This is what I have:
(defun init-slime-configuration ()
(slime-setup '(slime-fancy slime-fuzzy))
(setq slime-load-failed-fasl 'never)
(define-key slime-repl-mode-map (kbd "C-<tab>") 'slime-fuzzy-complete-symbol)
(define-key slime-mode-map (kbd "C-<tab>") 'slime-fuzzy-complete-symbol))
(add-hook 'slime-load-hook 'init-slime-configuration)
This also allows me to use C-TAB for fuzzy expand.
I ran into this very problem after switching from the version of SLIME installed using Quicklisp (version 2.9) to that installed from MELPA (version 20141010.1357, as a dependency of ac-slime).
Using SLIME from Quicklisp worked fine with my local copy of the HyperSpec, using the settings:
(require 'slime-autoloads)
(add-to-list 'slime-contribs 'slime-fancy)
(setq slime-lisp-implementations
'((ccl ("ccl"))
(clisp ("clisp"))
(cmucl ("cmucl"))
(ecl ("ecl"))
(sbcl ("sbcl"))))
(setq slime-default-lisp 'sbcl)
(setq common-lisp-hyperspec-root "file:/usr/share/doc/HyperSpec/")
(setq common-lisp-hyperspec-symbol-table "file:/usr/share/doc/HyperSpec/Data/Map_Sym.txt")
I then completely removed and reinstalled Quicklisp (without reinstalling SLIME!), then installed ac-slime from MELPA using the Emacs package manager.
By chance I happened to notice that when I tried to lookup documentation in the HyperSpec, Emacs opened a hidden buffer with an empty file named "Map_Sym.txt" in it.
Looking at the full pathname of this file using C-h v buffer-file-name [RET] revealed that it was set to "/home/miki/file:/usr/share/doc/HyperSpec/Data/Map_Sym.txt".
As an experiment, I tried removing the "file:/" from the last two lines of my settings, to make them read:
(setq common-lisp-hyperspec-root "/usr/share/doc/HyperSpec/")
(setq common-lisp-hyperspec-symbol-table "/usr/share/doc/HyperSpec/Data/Map_Sym.txt")
It appears to have resolved the issue. Why this works, I don't know (it differs from the documentation). A bug or undocumented change, maybe?
I installed auto-complete using the marmalade repo. Everything installed correctly and after moving stuff around I managed to start up and run auto-correct without any errors with the following code in my init.el:
;; auto-complete
(add-to-list 'load-path "~/.emacs.d/elpa/auto-complete")
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/elpa/auto-complete/dict")
(ac-config-default)
Now I can use auto-complete with no hick-ups with Emacs Lisp but whenever I use any other mode, like, Java, C, or C++ it doesn't work at all.
I have yasnippet installed too (it works perfectly), not sure if that might have anything to do with it. Here's the relevant code in my init.el:
;;yasnippet
(add-to-list 'load-path
"~/.emacs.d/plugins/yasnippet")
(require 'yasnippet)
(yas-global-mode 1)
I am in the process of learning Emacs and currently I'm still a noob. I've been looking all over the documentation and SO but haven't found anything. I'd really appreciate any help whatsoever on this.
You may need to add completion sources. Here's what's in my config:
(set-default 'ac-sources
'(ac-source-abbrev
ac-source-dictionary
ac-source-yasnippet
ac-source-words-in-buffer
ac-source-words-in-same-mode-buffers
ac-source-semantic))
Update: ac-config-default should cover this, but if autocomplete isn't activating for those modes, try putting the following in your init.el:
(dolist (m '(c-mode c++-mode java-mode))
(add-to-list 'ac-modes m))
(global-auto-complete-mode t)
Update2: I've posted a gist that adapts your init.el to pull autocomplete using package-install.
I can't tell what version of auto-complete you were referencing, but the latest is working fine for me.
I have exact same issue as you. Emacs-Lisp works perfect with auto-complete but C, C++ doesn't work. After trying with various combination, I find out that commenting out yasnippet from .emacs solve my issue. Hope this could help you. My auto-complete version is 1.3.1.