home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / emacs / 3516 < prev    next >
Encoding:
Text File  |  1992-11-11  |  1.8 KB  |  51 lines

  1. 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
  2. From: kgallagh@digi.lonestar.org (Kevin Gallagher)
  3. Newsgroups: comp.emacs
  4. Subject: Re: ELISP help needed
  5. Keywords: find-file-hooks write-file-hooks
  6. Message-ID: <1992Nov11.153503.6861@digi.lonestar.org>
  7. Date: 11 Nov 92 15:35:03 GMT
  8. References: <1992Nov10.213638.11986@ims.com>
  9. Organization: DSC Communications Corp, Plano, TX
  10. Lines: 39
  11.  
  12. In article <1992Nov10.213638.11986@ims.com> gerdh@ims.com (Gerd Hoeren) writes:
  13. >I'd like to connect an elisp function to the find-file-hooks and
  14. >write-file-hooks.  I seem to be missing something in my elisp syntax
  15. >though.
  16. >
  17. >Suppose my function is just:
  18. >
  19. >      (defun xyzzy ()
  20. >        (message "hello"))
  21. >
  22. >And I do an:
  23. >
  24. >      (setq find-file-hooks 'xyzzy)
  25.  
  26. Some hooks are simple variables and some are lists.  The variable
  27. find-file-hooks is plural, implying it is a list.  The built-in documentation
  28. for find-file-hooks confirms this:
  29.  
  30.     List of functions to be called after a buffer is loaded from a file.
  31.     The buffer's local variables (if any) will have been processed before the
  32.     functions are called.
  33.  
  34. This means that you can have find-file execute one or more functions with the
  35. single hook.  However, even if you specify only ONE function, it must be
  36. assigned to the hook variable in list syntax.
  37.  
  38. The correct syntax is:
  39.  
  40.     (setq find-file-hooks '(xyzzy))
  41.  
  42. To specify two functions to execute:
  43.  
  44.     (setq find-file-hooks '(xyzzy xyzbq))
  45.  
  46. -- 
  47. ----------------------------------------------------------------------------
  48. Kevin Gallagher        kgallagh@digi.lonestar.org OR ...!uunet!digi!kgallagh
  49. DSC Communications Corporation   Addr: MS 152, 1000 Coit Rd, Plano, TX 75075
  50. ----------------------------------------------------------------------------
  51.