kim@watsup.waterloo.edu (T. Kim Nguyen) (10/27/89)
I was trying to make emacs load up a file of TeX functions only the
first time tex-mode or latex-mode came up, using the latex-mode-hook
and the tex-mode-hook variables. The code below (in my .emacs) didn't
work (tex-stuff was never loaded, and the local-set-key didn't work):
(defvar latex-nifties-loaded nil)
(defun kim-latex-mode-hook ()
(if (not latex-nifties-loaded)
(progn (load "tex-stuff")
(setq latex-nifties-loaded t)))
(local-set-key "\C-c\C-i" 'LaTeX-insert-begin-end))
(setq latex-mode-hook 'kim-latex-mode-hook)
(setq tex-mode-hook 'kim-latex-mode-hook)
Only when I replaced the defun'd function with a straight lambda
function did the hooks run:
(setq latex-mode-hook '(lambda ()
(if (not latex-nifties-loaded)
(progn (load "tex-stuff")
(setq latex-nifties-loaded t)))
(local-set-key "\C-c\C-i" 'LaTeX-insert-begin-end)))
Any ideas? Thanks!
--
T. Kim Nguyen kim@watsup.waterloo.{edu|cdn}
kim@watsup.uwaterloo.ca
{uunet|utzoo|utai|decvax}watmath!watsup!kim
Systems Design Engineering -- University of Waterloo, Ontario, Canada