On Wed, 17 Oct 2001, Joel W. Reed yowled:
given this function:
(defun fume-list-index-select (arg)
(interactive)
(goto-line arg)
)
FWIW this is not normally the way one lays out Lisp. Better layout would
be
(defun fume-list-index-select (arg)
(interactive)
(goto-line arg))
(i.e., closing parentheses go on the end of the last line with other
content --- remember that they are not quite akin to { } in C...)
Also, it'd normally have a docstring. :)
is there any easier way to code this...
(defvar fume-list-mode-map nil)
(or fume-list-mode-map
(let ((map (make-sparse-keymap)))
(define-key map "1" (lambda () (interactive)
(fume-list-index-select 1)))
(define-key map "2" (lambda () (interactive)
(fume-list-index-select 2)))
(define-key map "3" (lambda () (interactive)
(fume-list-index-select 3)))
(define-key map "4" (lambda () (interactive)
I'd do it like this:
(defvar fume-list-mode-map nil)
(or fume-list-mode-map
(let ((map (make-sparse-keymap)))
(loop for list-num from 1 to 9 do
(define-key map list-num `(lambda () (interactive)
(fume-list-index-select ,list-num))))))
btw, are you sure you meant to make `map' a local variable? That's
passing strange, for a keymap.
--
`Btw, in Norwegian... Pine means agony, and although I use it every
day, I still agree.' --- Lene Jensen on the pine mailer