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.
Related
I decided to give emacs another try, but configuring it can be quite a pain. I wanted something to simple auto complete html tags and php functions, then I find the auto-complete mode.
I installed it through the packages interface in emacs through elpa. I followed the instructions(http://cx4a.org/software/auto-complete/manual.html) for installing the dictionaries, editing the .emacs file with:
(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict")
(require 'auto-complete-config)
(ac-config-default)
but when I start emacs I have the following error:
Warning (initialization): An error occurred while loading `/home/dev/.emacs':
Symbol's value as variable is void: ac-dictionary-directories
Starting emacs with the debug options I have the following:
Loading 00debian-vars...done
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...
Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el (source)...
Error while loading 50dictionaries-common: Symbol's value as variable is void: debian-aspell-only-dictionary-alist
Entering debugger...
find-library-name: Can't find library /usr/share/emacs/24E.3/lisp/subr.el
I tried many things already but to no avail. I checked the value of the 'load-path' variable and the dict folder is in it. What else should I try?
Emacs does not recognize 'ac-dictionary-directories. You should put this line after (require 'auto-complete-config)
I'm having difficulty following the instructions for installing speedbar on Emacs.
step 1. Put Lisp:sr-speedbar.el in your load-path, add
(require 'sr-speedbar)
ok put "sr-speedbar.el" in my load-path. (first of all I am making the assumption my load-path is my .emacs.d directory in my root directory.
I go to this link: http://www.emacswiki.org/emacs/sr-speedbar.el
hit the download button, which I end up having to copy/paste the entire file, save it as sr-speedbar.el inside my .emacs.d directory.
~/.emacs.d now has sr-speedbar.el and my .emacs file has the below code:
1 (add-to-list 'load-path "~/.emacs.d/evil")..
2 (require 'evil)..
3 (evil-mode 1)
4 (require 'sr-speedbar)
~
~
so i close out emacs, open it back up and get this error:
Warning (initialization): An error occurred while loading `/Users/johncurry/.emacs':
File error: Cannot open load file, sr-speedbar
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.
so I $ emacs --debug-init
Debugger entered--Lisp error: (file-error "Cannot open load file" "sr-speedbar"$
require(sr-speedbar)
eval-buffer(#<buffer *load*> nil "/Users/johncurry/.emacs" nil t) ; Reading$
load-with-code-conversion("/Users/johncurry/.emacs" "/Users/johncurry/.emacs"$
load("~/.emacs" t t)
#[0 "^H\205\262^# \306=\203^Q^#\307^H\310Q\202;^# \311=\204^^^#\307^H\312$
command-line()
normal-top-level()
sr-speedbar-open returns no match inside emacs. Any idea how to get this wrong? I'm sure it's just me not understanding the instructions, but I need help with this.
I had the same problem. When I checked the load path of emacs I found that the ~/.emacs.d directory wasn't part of the path.
You can check you load-path use the following command
C-h v load-path RET
To add the path I added the following to my .emacs file.
;; Add the ~/.emacs.d/lisp directory and all subdirectories to the load path of emacs
(let ((default-directory "~/.emacs.d/lisp/"))
(normal-top-level-add-subdirs-to-load-path))
I already had some files in the .emacs.d directory so I add a lisp directory so I wouldn't break anything.
I then reloaded my .emacs file and everything worked.
To reload your .emacs file use the following command
M-x load-file RET .emacs RET
source: https://www.emacswiki.org/emacs/LoadPath
I'm trying to get semantic completions working with emacs 24 and the version of cedet that comes with it. Completions work for classes I defined in my own source file, but completion isn't working for the standard library or STL stuff Here is my emacs config:
(require 'cedet)
(require 'semantic)
(require 'semantic/ia)
(require 'semantic/bovine/gcc)
(semantic-add-system-include "/usr/include/c++/4.6.3" 'c++-mode)
(setq semantic-default-submodes
'(global-semantic-idle-scheduler-mode
global-semanticdb-minor-mode
global-semantic-idle-summary-mode
global-semantic-idle-completions-mode
global-semantic-highlight-func-mode
global-semantic-decoration-mode
global-semantic-mru-bookmark-mode))
(setq semanticdb-default-save-directory "~/.semanticdb/"
semantic-complete-inline-analyzer-idle-displayor-class 'semantic-displayor-ghost)
(semantic-mode t)
In my ~/.semanticdb directory I only see "!usr!include!c++!4.6!x86_64-linux-gnu!bits!semantic.cache", which isn't even using the version I specified in the config.
When I try M-x semantic-analyze-possible-completions on a std::list, for example, I get an error saying: "Cannot find types for std::list"
Any suggestions for how to debug this or how to fix it?
I was installing today a fresh Ubuntu 13.04 on my new SSD,
and here are my steps to configure CEDET ( I checked that it gives completions for std::list).
Basic setup
Get a fresh emacs and build it from source.
It's as easy as
./configure && make && sudo make install
Add to .emacs
(semantic-mode 1)
That's the whole setup.
Testing
Run emacs without loading anything:
emacs -q test.cc
Enter the code
#include <list>
int main() {
std::list lst;
lst.$
return 0;
}
M-x semantic-mode
with point at $, M-x semantic-ia-show-variants
Troubleshooting
If stuff doesn't work, it's likely that the semanticdb is corrupt.
Just find where it is, for me it's semanticdb-default-save-directory="~/.emacs.d/semanticdb",
and remove everything from there.
Then, when visiting a source file, call semantic-force-refresh.
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
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