Commit 640c8776 authored by Stefan Monnier's avatar Stefan Monnier

* 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.
parent 8a10d76c
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)
......
......@@ -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)
......
......@@ -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
......
This diff is collapsed.
......@@ -150,17 +150,6 @@ in case you use it as a menu with `x-popup-menu'. */)
return Fcons (Qkeymap, Qnil);
}
DEFUN ("make-composed-keymap", Fmake_composed_keymap, Smake_composed_keymap,
0, MANY, 0,
doc: /* Construct and return a new keymap composed of KEYMAPS.
When looking up a key in the returned map, the key is looked in each
keymap in turn until a binding is found.
usage: (make-composed-keymap &rest KEYMAPS) */)
(ptrdiff_t nargs, Lisp_Object *args)
{
return Fcons (Qkeymap, Flist (nargs, args));
}
/* This function is used for installing the standard key bindings
at initialization time.
......@@ -3761,7 +3750,6 @@ be preferred. */);
defsubr (&Sset_keymap_parent);
defsubr (&Smake_keymap);
defsubr (&Smake_sparse_keymap);
defsubr (&Smake_composed_keymap);
defsubr (&Smap_keymap_internal);
defsubr (&Smap_keymap);
defsubr (&Scopy_keymap);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment