diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2011-08-03 17:40:06 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2011-08-03 17:40:06 -0400 |
commit | 640c8776f65beda19e4d4221b1cc2fe7a4b503d0 (patch) | |
tree | 63db8386b0bb79328e9f4dce9a7efab2373847e4 /lisp | |
parent | 8a10d76c8770781641cc742beb6a2ba653c99e00 (diff) | |
download | emacs-640c8776f65beda19e4d4221b1cc2fe7a4b503d0.tar.gz |
* src/keymap.c (Fmake_composed_keymap): Move to subr.el.
* lisp/subr.el (make-composed-keymap): Move from C. Change calling
convention, and improve docstring to bring attention to a subtle point.
* lisp/minibuffer.el (completing-read-default): Adjust accordingly.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/ChangeLog | 6 | ||||
-rw-r--r-- | lisp/minibuffer.el | 15 | ||||
-rw-r--r-- | lisp/subr.el | 14 |
3 files changed, 26 insertions, 9 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 28d78fa7302..6a6abdf7e42 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2011-08-03 Stefan Monnier <monnier@iro.umontreal.ca> + + * subr.el (make-composed-keymap): Move from C. Change calling + convention, and improve docstring to bring attention to a subtle point. + * minibuffer.el (completing-read-default): Adjust accordingly. + 2011-08-03 Michael Albinus <michael.albinus@gmx.de> * net/tramp-sh.el (tramp-open-connection-setup-interactive-shell) diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index d62b377954d..0a2774de572 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -2754,15 +2754,12 @@ See `completing-read' for the meaning of the arguments." base-keymap ;; Layer minibuffer-local-filename-completion-map ;; on top of the base map. - ;; Use make-composed-keymap so that set-keymap-parent - ;; doesn't modify minibuffer-local-filename-completion-map. - (let ((map (make-composed-keymap - minibuffer-local-filename-completion-map))) - ;; Set base-keymap as the parent, so that nil bindings - ;; in minibuffer-local-filename-completion-map can - ;; override bindings in base-keymap. - (set-keymap-parent map base-keymap) - map))) + (make-composed-keymap + minibuffer-local-filename-completion-map + ;; Set base-keymap as the parent, so that nil bindings + ;; in minibuffer-local-filename-completion-map can + ;; override bindings in base-keymap. + base-keymap))) (result (read-from-minibuffer prompt initial-input keymap nil hist def inherit-input-method))) (when (and (equal result "") def) diff --git a/lisp/subr.el b/lisp/subr.el index ef19797012a..d57c507a548 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -526,6 +526,20 @@ but optional second arg NODIGITS non-nil treats them like other chars." (define-key map (char-to-string loop) 'digit-argument) (setq loop (1+ loop)))))) +(defun make-composed-keymap (maps &optional parent) + "Construct a new keymap composed of MAPS and inheriting from PARENT. +When looking up a key in the returned map, the key is looked in each +keymap of MAPS in turn until a binding is found. +If no binding is found in MAPS, the lookup continues in PARENT, if non-nil. +As always with keymap inheritance, a nil binding in MAPS overrides +any corresponding binding in PARENT, but it does not override corresponding +bindings in other keymaps of MAPS. +MAPS can be a list of keymaps or a single keymap. +PARENT if non-nil should be a keymap." + `(keymap + ,@(if (keymapp maps) (list maps) maps) + ,@parent)) + (defun define-key-after (keymap key definition &optional after) "Add binding in KEYMAP for KEY => DEFINITION, right after AFTER's binding. This is like `define-key' except that the binding for KEY is placed |