You are not logged in.
Pages: 1
I use emacs and the auctex package to edit Latex files. I have a (load "auctex.el") in my .emacs which loads it at startup. However I share my emacs config with the lab machines where they don't have auctex (and I don't use Latex there anyways). How can I have auctex be loaded whenever I open a Latex/Tex file ?
Thanks,
Basu
The Bytebaker -- Computer science is not a science and it's not about computers
Check out my open source software at Github
Offline
The simplest way is to only load auctex if it's available:
(load "auctex.el" t) ; The second arg to load is a flag to suppress errors
Emacs runs find-file-hook whenever it visits a file, so you could also write a hook function to look at the filename and load auctex for .tex files.
Offline
To automatically load a file try the 'autoload' function.
(autoload 'typing-of-emacs "typing.el" "The Typing Of Emacs, a game." t nil)
I do this to automatically enter latex mode when I open a .latex file:
(add-to-list 'auto-mode-alist '("\\.latex\\'" . latex-mode))
The 'auto-mode-alist' is a list of file extensions and their associated modes.
So how about something along the lines of:
(autoload 'auctex-mode "auctex.el" "LaTeX editing mode" t nil)
(add-to-list 'auto-mode-alist '("\\.tex\\'" . auctex-mode))))
Hope that helps.
Edit: Whoops - saw 'emacs lisp' and got all keen. Removed a lot of stuff that wasn't relevant to the question.
Last edited by samwise (2008-10-30 01:36:34)
"He was perfect except for the fact that he was an engineer"
Offline
Pages: 1