Thread View: gnu.emacs.help
3 messages
3 total messages
Started by Thien-Thi Nguyen
Sun, 24 Jan 1993 20:28
keymap defs -- using lambda expressions
Author: Thien-Thi Nguyen
Date: Sun, 24 Jan 1993 20:28
Date: Sun, 24 Jan 1993 20:28
7 lines
643 bytes
643 bytes
(define-key some-mode-map '(lambda () (kill-buffer (current-buffer)))) doesn't work. could someone explain why not and also suggest the correct way to do this (w/o having to use a defun)? thanks, Thi
Re: keymap defs -- using lambda expressions
Author: Benjamin R. Liblit
Date: Sun, 24 Jan 1993 21:11
Date: Sun, 24 Jan 1993 21:11
19 lines
1221 bytes
1221 bytes
In article <hyk1H?8o3c@atlantis.psu.edu>, TTN@ECL.PSU.EDU (Thien-Thi Nguyen) writes: > (define-key some-mode-map '(lambda () (kill-buffer (current-buffer)))) You're missing an argument to define-key. The general format is: (define-key KEYMAP KEY DEFINITION) You've got the keymap and the definition, but you're missing the key itself. Try something like the following: (define-key some-mode-map "k" '(lambda () .....)) That would find the given lambda function to the "k" key in the given keymap. For more information on how keys can be specified, see "String Type" in the elisp reference. -- Ben Liblit ----- "Fais que tes reves soient plus longs que la nuit." liblit@cs.psu.edu -- brl102@psuvm.psu.edu -- brl102@psuvm.bitnet
Re: keymap defs -- using lambda expressions
Author: Dag Nummedal
Date: Sun, 24 Jan 1993 23:11
Date: Sun, 24 Jan 1993 23:11
32 lines
1819 bytes
1819 bytes
In article <C1DMuy.Hw2@cs.psu.edu> liblit@cs.psu.edu (Benjamin R. Liblit) writes: >In article <hyk1H?8o3c@atlantis.psu.edu>, TTN@ECL.PSU.EDU (Thien-Thi Nguyen) writes: >> (define-key some-mode-map '(lambda () (kill-buffer (current-buffer)))) >You're missing an argument to define-key. The general format is: > (define-key KEYMAP KEY DEFINITION) >You've got the keymap and the definition, but you're missing the key >itself. Try something like the following: > (define-key some-mode-map "k" '(lambda () .....)) >That would find the given lambda function to the "k" key in the given >keymap. For more information on how keys can be specified, see >"String Type" in the elisp reference. The correct way to do this is (the example defines M-K to kill current buffer): (define-key esc-map "K" '(lambda () (interactive)(kill-buffer (current-buffer)))) You need the KEY field as said over, but the lambda-expression must also include some version of the "(interactive)" declaration. Use describe-function (C-h f) on define-key and interactive if you need more information. -- ---------------------------------------------------------------------- Dag Nummedal numme@itk.unit.no "Don't blame me, I just work here."
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads