home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ornl!utkcs2!darwin.sura.net!zaphod.mps.ohio-state.edu!cs.utexas.edu!sun-barr!news2me.EBay.Sun.COM!cronkite.Central.Sun.COM!texsun!digi!kgallagh
- From: kgallagh@digi.lonestar.org (Kevin Gallagher)
- Newsgroups: comp.emacs
- Subject: Re: ELISP help needed
- Keywords: find-file-hooks write-file-hooks
- Message-ID: <1992Nov11.153503.6861@digi.lonestar.org>
- Date: 11 Nov 92 15:35:03 GMT
- References: <1992Nov10.213638.11986@ims.com>
- Organization: DSC Communications Corp, Plano, TX
- Lines: 39
-
- In article <1992Nov10.213638.11986@ims.com> gerdh@ims.com (Gerd Hoeren) writes:
- >I'd like to connect an elisp function to the find-file-hooks and
- >write-file-hooks. I seem to be missing something in my elisp syntax
- >though.
- >
- >Suppose my function is just:
- >
- > (defun xyzzy ()
- > (message "hello"))
- >
- >And I do an:
- >
- > (setq find-file-hooks 'xyzzy)
-
- Some hooks are simple variables and some are lists. The variable
- find-file-hooks is plural, implying it is a list. The built-in documentation
- for find-file-hooks confirms this:
-
- List of functions to be called after a buffer is loaded from a file.
- The buffer's local variables (if any) will have been processed before the
- functions are called.
-
- This means that you can have find-file execute one or more functions with the
- single hook. However, even if you specify only ONE function, it must be
- assigned to the hook variable in list syntax.
-
- The correct syntax is:
-
- (setq find-file-hooks '(xyzzy))
-
- To specify two functions to execute:
-
- (setq find-file-hooks '(xyzzy xyzbq))
-
- --
- ----------------------------------------------------------------------------
- Kevin Gallagher kgallagh@digi.lonestar.org OR ...!uunet!digi!kgallagh
- DSC Communications Corporation Addr: MS 152, 1000 Coit Rd, Plano, TX 75075
- ----------------------------------------------------------------------------
-