home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / gnu / emacs / help / 5483 < prev    next >
Encoding:
Text File  |  1993-01-24  |  1.7 KB  |  46 lines

  1. Newsgroups: gnu.emacs.help
  2. Path: sparky!uunet!mcsun!sunic!ugle.unit.no!ugle.unit.no!numme
  3. From: numme@itk.unit.no (Dag Nummedal)
  4. Subject: Re: keymap defs -- using lambda expressions
  5. In-Reply-To: liblit@cs.psu.edu's message of Sun, 24 Jan 1993 21:11:15 GMT
  6. Message-ID: <NUMME.93Jan25001125@mona.itk.unit.no>
  7. Lines: 29
  8. Sender: news@ugle.unit.no (NetNews Administrator)
  9. Organization: Norwegian Institute of Technology / SINTEF, Trondheim, Norway
  10. References: <hyk1H?8o3c@atlantis.psu.edu> <C1DMuy.Hw2@cs.psu.edu>
  11. Date: 24 Jan 93 23:11:25 GMT
  12. Lines: 32
  13.  
  14. In article <C1DMuy.Hw2@cs.psu.edu> liblit@cs.psu.edu (Benjamin R. Liblit) writes:
  15.   
  16. >In article <hyk1H?8o3c@atlantis.psu.edu>, TTN@ECL.PSU.EDU (Thien-Thi Nguyen) writes:
  17. >> (define-key some-mode-map '(lambda () (kill-buffer (current-buffer))))
  18.  
  19. >You're missing an argument to define-key.  The general format is:
  20.  
  21. >    (define-key KEYMAP KEY DEFINITION)
  22.  
  23. >You've got the keymap and the definition, but you're missing the key
  24. >itself.  Try something like the following:
  25.  
  26. >    (define-key some-mode-map "k" '(lambda () .....))
  27.  
  28. >That would find the given lambda function to the "k" key in the given
  29. >keymap.  For more information on how keys can be specified, see
  30. >"String Type" in the elisp reference.
  31.  
  32. The correct way to do this is (the example defines M-K to kill current
  33. buffer):
  34. (define-key esc-map "K" 
  35.  '(lambda () (interactive)(kill-buffer (current-buffer))))
  36.  
  37. You need the KEY field as said over, but the lambda-expression must
  38. also include some version of the "(interactive)" declaration.
  39.  
  40. Use describe-function (C-h f) on define-key and interactive if you
  41. need more information.
  42.  
  43. --
  44. ----------------------------------------------------------------------
  45. Dag Nummedal numme@itk.unit.no  "Don't blame me, I just work here."
  46.