comparison lisp/emacs-lisp/easy-mmode.el @ 94317:8f25e59015ea

Tom Tromey <tromey at redhat.com> (easy-mmode-define-keymap): Document keywords. Add :suppress.
author Glenn Morris <rgm@gnu.org>
date Thu, 24 Apr 2008 05:47:18 +0000
parents 107ccd98fa12
children 90a2847062be
comparison
equal deleted inserted replaced
94316:40e0e4cdf486 94317:8f25e59015ea
407 "Return a keymap built from bindings BS. 407 "Return a keymap built from bindings BS.
408 BS must be a list of (KEY . BINDING) where 408 BS must be a list of (KEY . BINDING) where
409 KEY and BINDINGS are suitable for `define-key'. 409 KEY and BINDINGS are suitable for `define-key'.
410 Optional NAME is passed to `make-sparse-keymap'. 410 Optional NAME is passed to `make-sparse-keymap'.
411 Optional map M can be used to modify an existing map. 411 Optional map M can be used to modify an existing map.
412 ARGS is a list of additional keyword arguments." 412 ARGS is a list of additional keyword arguments.
413 (let (inherit dense) 413
414 Valid keywords and arguments are:
415
416 :name Name of the keymap; overrides NAME argument.
417 :dense Non-nil for a dense keymap.
418 :inherit Parent keymap.
419 :group Ignored.
420 :suppress Non-nil to call `suppress-keymap' on keymap,
421 'nodigits to suppress digits as prefix arguments."
422 (let (inherit dense suppress)
414 (while args 423 (while args
415 (let ((key (pop args)) 424 (let ((key (pop args))
416 (val (pop args))) 425 (val (pop args)))
417 (case key 426 (case key
418 (:name (setq name val)) 427 (:name (setq name val))
419 (:dense (setq dense val)) 428 (:dense (setq dense val))
420 (:inherit (setq inherit val)) 429 (:inherit (setq inherit val))
430 (:suppress (setq suppress val))
421 (:group) 431 (:group)
422 (t (message "Unknown argument %s in defmap" key))))) 432 (t (message "Unknown argument %s in defmap" key)))))
423 (unless (keymapp m) 433 (unless (keymapp m)
424 (setq bs (append m bs)) 434 (setq bs (append m bs))
425 (setq m (if dense (make-keymap name) (make-sparse-keymap name)))) 435 (setq m (if dense (make-keymap name) (make-sparse-keymap name))))
436 (when suppress
437 (suppress-keymap m (eq suppress 'nodigits)))
426 (dolist (b bs) 438 (dolist (b bs)
427 (let ((keys (car b)) 439 (let ((keys (car b))
428 (binding (cdr b))) 440 (binding (cdr b)))
429 (dolist (key (if (consp keys) keys (list keys))) 441 (dolist (key (if (consp keys) keys (list keys)))
430 (cond 442 (cond