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

  1. Path: sparky!uunet!ogicse!news.u.washington.edu!news.u.washington.edu!ethanb
  2. From: ethanb@ptolemy.astro.washington.edu (Ethan Bradford)
  3. Newsgroups: comp.emacs
  4. Subject: Setting file-hooks (was Re: ELISP help needed)
  5. Message-ID: <ETHANB.92Nov11213926@ptolemy.astro.washington.edu>
  6. Date: 12 Nov 92 05:39:26 GMT
  7. Article-I.D.: ptolemy.ETHANB.92Nov11213926
  8. References: <1992Nov10.213638.11986@ims.com>
  9. Sender: news@u.washington.edu (USENET News System)
  10. Organization: U. of Washington
  11. Lines: 48
  12. In-Reply-To: gerdh@ims.com's message of 10 Nov 92 21:36:38 GMT
  13. To: gerdh@ims.com (Gerd Hoeren)
  14.  
  15. The variables find-file-hooks and write-file-hooks expect their values
  16. to be *lists* of functions.  Thus, 
  17.  
  18.       (defun xyzzy ()
  19.         (message "hello"))
  20.  
  21.       (setq find-file-hooks '(xyzzy))
  22.  
  23. Will do what you were attempting, except that it will eliminate any
  24. other functions you already had in that variable.  It is better to do
  25.  
  26.   (setq find-file-hooks (cons 'xyzzy find-file-hooks))
  27.  
  28. to add your new function.
  29.  
  30. In article <1992Nov10.213638.11986@ims.com> gerdh@ims.com (Gerd Hoeren) wrote:
  31.  
  32.    I'd like to connect an elisp function to the find-file-hooks and
  33.    write-file-hooks.  I seem to be missing something in my elisp syntax
  34.    though.
  35.  
  36.    Suppose my function is just:
  37.  
  38.      (defun xyzzy ()
  39.        (message "hello"))
  40.  
  41.    And I do an:
  42.  
  43.      (setq find-file-hooks 'xyzzy)
  44.  
  45.    Then, the next find-file will complain about:
  46.  
  47.      Wrong type argument: sequencep, xyzzy
  48.  
  49.    If I do the same with the write-file-hooks, I get:
  50.  
  51.      Wrong type argument: listp, xyzzy
  52.  
  53.    I've tried a number of variations on this syntax, but I'm not winning.
  54.    Thanks in advance for the help!
  55.  
  56.    --------------------------------------
  57.    Gerd Hoeren
  58.      Integrated Measurement Systems, Inc.
  59.      Voice: (503) 626-7117
  60.      Fax:   (503) 644-6969
  61.      Email: gerdh@ims.com
  62.    --------------------------------------
  63.