[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Newbie: Help with elisp, please

On April 29, 2004 02:53 am, Florent Rougon scribed:
FR> Also, you should use those define-key calls in the appropriate
 hook to be sure that the map is already defined. For instance:
FR>   (add-hook 'LaTeX-mode-hook
FR>             #'(lambda ()
FR>                 (define-key LaTeX-mode-map [C-f5] 'do-LaTeX)))
FR> or, better:
FR>   (defun brad-setup-LaTeX-keybindings ()
FR>     (interactive)
FR>     (define-key LaTeX-mode-map [C-f5] 'do-LaTeX)
FR>     ...
FR>     (define-key LaTeX-mode-map ...))
FR>   (add-hook 'LaTeX-mode-hook 'brad-setup-LaTeX-keybindings)

Okay... what you've given me should help a lot.  One thing I don't 
really understand, though, is hooks.  How do I know that, when I use 
(add-hook ....) that it will run once I enter LaTeX-mode?  The GNU 
Emacs Manual and the Emacs Lisp Reference Guide don't really explain 
this in any detail.  Oh yeah... and in the above code snippet, you 
have the function (?) do-LaTeX.  Do I define these functions before I 
define the function brad-setup-LaTeX-keybindings?  I'm thinking yes.

Finally, do I have to put all this in my .emacs file, or can I put it 
in a .el file in some other directory as long as that dir is in my 

Thanks :O)

|Brad Camroux              | === http://www.debian.org === |
|Student                   | ============================= |
|Geophysics & Applied Math | Proud admin and user of Debian|
|University of Calgary     | since 2003... because Red Hat |
|Calgary, AB, Canada       | just didn't cut it            |

Reply to: