diff options
| author | Stefan Monnier | 2011-08-03 17:40:06 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2011-08-03 17:40:06 -0400 |
| commit | 640c8776f65beda19e4d4221b1cc2fe7a4b503d0 (patch) | |
| tree | 63db8386b0bb79328e9f4dce9a7efab2373847e4 /lisp | |
| parent | 8a10d76c8770781641cc742beb6a2ba653c99e00 (diff) | |
| download | emacs-640c8776f65beda19e4d4221b1cc2fe7a4b503d0.tar.gz emacs-640c8776f65beda19e4d4221b1cc2fe7a4b503d0.zip | |
* 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 @@ | |||
| 1 | 2011-08-03 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * subr.el (make-composed-keymap): Move from C. Change calling | ||
| 4 | convention, and improve docstring to bring attention to a subtle point. | ||
| 5 | * minibuffer.el (completing-read-default): Adjust accordingly. | ||
| 6 | |||
| 1 | 2011-08-03 Michael Albinus <michael.albinus@gmx.de> | 7 | 2011-08-03 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 8 | ||
| 3 | * net/tramp-sh.el (tramp-open-connection-setup-interactive-shell) | 9 | * 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." | |||
| 2754 | base-keymap | 2754 | base-keymap |
| 2755 | ;; Layer minibuffer-local-filename-completion-map | 2755 | ;; Layer minibuffer-local-filename-completion-map |
| 2756 | ;; on top of the base map. | 2756 | ;; on top of the base map. |
| 2757 | ;; Use make-composed-keymap so that set-keymap-parent | 2757 | (make-composed-keymap |
| 2758 | ;; doesn't modify minibuffer-local-filename-completion-map. | 2758 | minibuffer-local-filename-completion-map |
| 2759 | (let ((map (make-composed-keymap | 2759 | ;; Set base-keymap as the parent, so that nil bindings |
| 2760 | minibuffer-local-filename-completion-map))) | 2760 | ;; in minibuffer-local-filename-completion-map can |
| 2761 | ;; Set base-keymap as the parent, so that nil bindings | 2761 | ;; override bindings in base-keymap. |
| 2762 | ;; in minibuffer-local-filename-completion-map can | 2762 | base-keymap))) |
| 2763 | ;; override bindings in base-keymap. | ||
| 2764 | (set-keymap-parent map base-keymap) | ||
| 2765 | map))) | ||
| 2766 | (result (read-from-minibuffer prompt initial-input keymap | 2763 | (result (read-from-minibuffer prompt initial-input keymap |
| 2767 | nil hist def inherit-input-method))) | 2764 | nil hist def inherit-input-method))) |
| 2768 | (when (and (equal result "") def) | 2765 | (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." | |||
| 526 | (define-key map (char-to-string loop) 'digit-argument) | 526 | (define-key map (char-to-string loop) 'digit-argument) |
| 527 | (setq loop (1+ loop)))))) | 527 | (setq loop (1+ loop)))))) |
| 528 | 528 | ||
| 529 | (defun make-composed-keymap (maps &optional parent) | ||
| 530 | "Construct a new keymap composed of MAPS and inheriting from PARENT. | ||
| 531 | When looking up a key in the returned map, the key is looked in each | ||
| 532 | keymap of MAPS in turn until a binding is found. | ||
| 533 | If no binding is found in MAPS, the lookup continues in PARENT, if non-nil. | ||
| 534 | As always with keymap inheritance, a nil binding in MAPS overrides | ||
| 535 | any corresponding binding in PARENT, but it does not override corresponding | ||
| 536 | bindings in other keymaps of MAPS. | ||
| 537 | MAPS can be a list of keymaps or a single keymap. | ||
| 538 | PARENT if non-nil should be a keymap." | ||
| 539 | `(keymap | ||
| 540 | ,@(if (keymapp maps) (list maps) maps) | ||
| 541 | ,@parent)) | ||
| 542 | |||
| 529 | (defun define-key-after (keymap key definition &optional after) | 543 | (defun define-key-after (keymap key definition &optional after) |
| 530 | "Add binding in KEYMAP for KEY => DEFINITION, right after AFTER's binding. | 544 | "Add binding in KEYMAP for KEY => DEFINITION, right after AFTER's binding. |
| 531 | This is like `define-key' except that the binding for KEY is placed | 545 | This is like `define-key' except that the binding for KEY is placed |