I have installed YASnippet and configured it with this:
(add-to-list 'load-path "~/.emacs.d/plugins/yasnippet-0.6.1c")
(require 'yasnippet) ;; not yasnippet-bundle
(yas--initialize)
(yas/load-directory "~/.emacs.d/packages/yasnippet-0.6.1c/snippets")
However, when I launch Emacs it gives me an error:
Warning (initialization): An error occurred while loading `/home/alexander/.emacs':
Symbol's function definition is void: yas--initialize
To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file. Start Emacs with
the `--debug-init' option to view a complete error backtrace.
(add-to-list 'load-path "~/.emacs.d/plugins/yasnippet-0.6.1c")
(require 'yasnippet) ;; not yasnippet-bundle
(yas--initialize)
(yas/load-directory "~/.emacs.d/packages/yasnippet-0.6.1c/snippets")
What am I doing wrong? I have tried to find the answer but with no success. (I have also tried with another version of yasnippet yasnippet-0.6.1b but it was the same.)
Just at a glance, that
(yas--initialise)
should be
(yas/initialize)
I'm running 0.6.1 and there's no such function as yas--initialize in the package.
My init code looks like
(require 'yasnippet)
(yas/initialize)
(yas/load-directory
(dot-emacs "elpa/yasnippet-0.6.1/snippets"))
I think you just got some garbled init code somewhere.
EDIT
I should have omitted the load-directory call in my sample since it's beside the point. But for what it's worth, dot-emacs is just a config-agnostic function I use to reference files relative to my init:
(defun dot-emacs (relative-path)
"Return the full path of a file in the user's emacs directory."
(expand-file-name (concat user-emacs-directory relative-path)))
FYI in case you ever upgrade: the information you got is correct for version 0.8, but for 0.7 and below yas/initialize is correct.
See this commit
Related
I have Emacs24, i want to use some modes like auto-complete.
Here is the thing, I installed 'linum' before and it's just working very well but others not working.
My .emacs file
(add-to-list 'load-path "/root/.scripts")
(require 'linum)
(global-linum-mode 1)
(require 'package)
(add-to-list 'package-archives '("melppa" . "http://melpa.milkbox.net/packages/"))
(package-initalize)
(add-to-list 'load-path "~/.emacs.d/")
(require 'auto-complete)
(require 'auto-complete-config)
(ac-config-default)
(require 'yasnippet)
auto-complete and yasnippet just doesn't working , i tried command 'auto-complete-mode' but its still same.
Any ideas ?
EDIT : I installed it from source not from ELPA and it worked.
I had a similar issue when I upgraded to Emacs 24. Have you tried running M-x auto-complete? When I did, I got an error message like the following:
gv-get: (popup-cursor ac-menu) is not a valid place expression
It turned out this was an already reported bug that can be fixed by recompiling your byte-code:
https://github.com/auto-complete/auto-complete/issues/222
https://github.com/auto-complete/auto-complete/issues/118
This solution worked for me:
$ find ~/.emacs.d/elpa -name '*.elc' | xargs rm
(to remove all compiled elisp in your elpa subdirectories)
... then, in an elisp interaction buffer, like scratch eval:
(byte-recompile-directory (expand-file-name "~/.emacs.d/elpa") 0)
... then re-start emacs.
I an new to emacs...so i was trying to install ya-snippets
for this first i downloaded the ya-snippet tar file and then uzipped it and then kept it .emacs.d/packages/
and then added the following code to my .emacs file
;; yasnippet
(add-to-list 'load-path
"~/.emacs.d/packages/yasnippet")
(require 'yasnippet)
(yas-global-mode 1)
but my obtaining the following error ...
Warning (initialization): An error occurred while loading `/home/nitesh/.emacs':
Symbol's function definition is void: yas-global-mode
To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file. Start Emacs with
the `--debug-init' option to view a complete error backtrace.
please tell me the error and as i am new to emacs and please tell what each line is doing my .emacs file written to configure yasnippet ?
and please tell me what to add to .emacs file for ya -snippet to use all c/c++ snippets that comes default with it?
Step One: Place the following two lines near the top of your .emacs file and restart Emacs:
(require 'package)
(package-initialize)
Step Two: M-x list-packages
Step Three: Select Yasnippet with the left mouse click and then click Install, and click Yes.
Step Four: Open up your .emacs file and place this underneath package-initialize
(require 'yasnippet)
(yas-global-mode 1)
Step Five: Restart Emacs and have fun coding. The mode-line will display yas when that minor mode is active.
I want to byte-compile some el files in my .emacs.d directory.I wrote a file like this:
cl.el:
(add-to-list 'load-path "~/.emacs.d/slime/")
(require 'slime)
and someother code.when i byte-compile it,the error is:
Error: Cannot open load file: slime
however,i really put the slime package in the directory.
and i use the batch-byte-compile also find that all el files contain
(require '***)
will result out the similar error
~ does not get expanded; use an absolute path, or (add-to-list 'load-path (expand-file-name "~/.emacs.d/slime/")).
This is unrelated to byte compilation, per se.
This question already has an answer here:
Emacs: Symbol's value as variable is void
(1 answer)
Closed 5 years ago.
I'm trying to install the emacs latex auto-complete package (http://code.google.com/p/ac-math/). I put ac-math.el into my ~/elisp load-path directory then put the following into my .emacs file:
;; Adds elisp to load-path
(add-to-list 'load-path "~/elisp")
;; Loads latex auto-complete
(require 'ac-math)
(add-to-list 'ac-modes 'latex-mode)
(defun ac-latex-mode-setup ()
(setq ac-sources
(append '(ac-source-math-latex ac-source-latex-commands ac-source-math-unicode)
ac-sources))
)
(add-hook 'LaTeX-mode-hook 'ac-latex-mode-setup)
But when I load emacs I get this error:
Warning (initialization): An error occurred while loading
`/home/eddy/.emacs':
Symbol's value as variable is void: ac-modes
To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file. Start Emacs with the
`--debug-init' option to view a complete error backtrace.
Thanks in advance
Add (require 'auto-complete) at the top. Or, better yet, convince the ac-math package maintainer to add it there.
I had to install the auto-complete package first. I had mixed up the math auto-complete package with the actual auto-complete package.
So first you go here to install the auto-complete package: http://cx4a.org/software/auto-complete/
Then you go here for the math auto-complete add-on: http://code.google.com/p/ac-math/
The problem was that I was trying to install the math add-on without first installing the auto-complete package
When I boot I launch emacs --daemon
and it evaluates my .emacs with one exception:
(add-to-list 'load-path "~/.elisp/zenburn-emacs") ;fix loading issue
(require 'zenburn)
;;; color theme - zenburn?
(add-to-list 'load-path "~/.elisp/color-theme")
(require 'color-theme)
(eval-after-load "color-theme"
'(progn
(color-theme-initialize)))
I know that the load-path stuff works because M-x zenburn loads the color scheme just fine once I launch emacsclient with emacsclient -nw.
Does anybody know what is up with (eval-after-load [snip - see above])?
Is this a bug?
System Info:
GNU Emacs 23.2.1
Installed in debian sid on2.6.32-5-amd64 Version: 23.2+1-7
Filename: pool/main/e/emacs23/emacs23_23.2+1-7_amd64.deb
And a tip from the current maintainer of Zenburn for Emacs(yours truly):
(add-to-list 'load-path "~/.elisp/color-theme")
(add-to-list 'load-path "~/.elisp/zenburn-emacs")
(require 'zenburn)
(zenburn)
You don't need to require color-theme since zenburn requires it internally. You do need, however, to call the zenburn function after you've required zenburn.
You're actually invoking the (zenburn) function when you type M-x zenburn and this is why the theme is getting applied just then instead of on startup.
You don't really say what isn't working?
(require 'zenburn) isn't enough to start the theme.
You need to call (color-theme-zenburn) as well (or its alias (zenburn), as you are doing interactively).
FWIW, here's how I load zenburn in my .emacs:
(require 'zenburn)
(zenburn)
Loads fine via emacsclient.
This is too long for a comment:
I have in my .emacs file the following line:
(setq default-frame-alist '((font . "Inconsolata-20") (tool-bar-lines . 0) (menu-bar-lines . 0)))
If I put for example
(color-theme-taylor)
after this line it works, if I put it before this line, it doesn't.
I.e.
(require 'color-theme)
(color-theme-initialize)
(setq default-frame-alist '((font . "Inconsolata-20") (tool-bar-lines . 0) (menu-bar-lines . 0)))
(color-theme-taylor)
works... perhaps your problem may have a similar cause...
Something like (progn (require 'color-theme) (color-theme-initialize)) should work. To see (eval-after-load "color-theme" '(progn (color-theme-initialize))) does what it should do, check if color-theme-initialize is appended to after-load-alist (describe-variable C-h v). If not, it could be a bug.