installing ya-snippet in emacs 23 manualy

945 Views Asked by At

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?

1

There are 1 best solutions below

5
lawlist On

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.