So how do you install a major mode for emacs? First, you need to find out what your emacs load path is.
C-h v load-path
Then you go and find a major mode file (javascript-mode.el) and put it in one of those directories. Since I don't know better, I put it in '/usr/local/share/site-lisp'. (Anyone else know a better place to put javascript major modes?)
Then put the following in your ".emacs" file. This file exists in your home directory, and if it doesn't exist, create it.
;; for javascript files
(autoload 'javascript-mode "javascript-mode" "JavaScript mode" t)
(setq auto-mode-alist (append '(("\\.js$" . javascript-mode))
auto-mode-alist))
And there you go, emacs major mode for javascript. If there's already a package in your favorite distribution of linux, install that package instead. It's way easier.
Add your mode files to a custom folder, and add that folder to your load_path:
ReplyDelete(add-to-list 'load-path "~/my_emacs_stuff")
Note that the line that Anonymous posted needs to be added to your .emacs file.
ReplyDelete