Rename set-temporary-overlay-map -> set-transient-map
* lisp/subr.el (set-transient-map): Rename from set-temporary-overlay-map. Doc fix. * lisp/face-remap.el (text-scale-adjust): * lisp/indent.el (indent-rigidly): * lisp/kmacro.el (kmacro-call-macro): * lisp/minibuffer.el (minibuffer-force-complete): * lisp/repeat.el (repeat): * lisp/simple.el (universal-argument--mode): * lisp/calendar/todo-mode.el (todo-insert-item--next-param): * lisp/progmodes/f90.el (f90-abbrev-start): Callers changed. * lisp/org/org.el (orgstruct-make-binding): Call set-transient-map instead of old name set-temporary-overlay-map. * doc/lispref/keymaps.texi (Controlling Active Maps): Renamed set-temporary-overlay-map to set-transient map. Doc fixes. (Searching Keymaps): The transient keymap takes precedence.
This commit is contained in:
parent
aec3bf9f49
commit
8cd22a0818
16 changed files with 95 additions and 57 deletions
|
@ -1,3 +1,9 @@
|
|||
2013-12-23 Chong Yidong <cyd@gnu.org>
|
||||
|
||||
* keymaps.texi (Controlling Active Maps): Renamed
|
||||
set-temporary-overlay-map to set-transient map. Doc fixes.
|
||||
(Searching Keymaps): The transient keymap takes precedence.
|
||||
|
||||
2013-12-23 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* loading.texi (How Programs Do Loading, Load Suffixes):
|
||||
|
|
|
@ -747,13 +747,13 @@ pseudo-Lisp description of the order and conditions for searching
|
|||
them:
|
||||
|
||||
@lisp
|
||||
(or (cond
|
||||
(or (@var{find-in} @var{transient-map})
|
||||
(cond
|
||||
(overriding-terminal-local-map
|
||||
(@var{find-in} overriding-terminal-local-map))
|
||||
(overriding-local-map
|
||||
(@var{find-in} overriding-local-map))
|
||||
((or (@var{find-in} (get-char-property (point) 'keymap))
|
||||
(@var{find-in} @var{temp-map})
|
||||
(@var{find-in-any} emulation-mode-map-alists)
|
||||
(@var{find-in-any} minor-mode-overriding-map-alist)
|
||||
(@var{find-in-any} minor-mode-map-alist)
|
||||
|
@ -764,14 +764,17 @@ them:
|
|||
@end lisp
|
||||
|
||||
@noindent
|
||||
@var{find-in} and @var{find-in-any} are pseudo functions that search
|
||||
in one keymap and in an alist of keymaps, respectively. (Searching a
|
||||
single keymap for a binding is called @dfn{key lookup}; see @ref{Key
|
||||
Lookup}.) If the key sequence starts with a mouse event, that event's position
|
||||
is used instead of point and the current buffer. Mouse events on an
|
||||
embedded string use non-@code{nil} text properties from that string
|
||||
instead of the buffer. @var{temp-map} is a pseudo variable that
|
||||
represents the effect of a @code{set-temporary-overlay-map} call.
|
||||
Here, @var{find-in} and @var{find-in-any} are pseudo functions that
|
||||
search in one keymap and in an alist of keymaps, respectively.
|
||||
(Searching a single keymap for a binding is called @dfn{key lookup};
|
||||
see @ref{Key Lookup}.) @var{transient-map} is a pseudo variable that
|
||||
represents the effect of a @code{set-transient-map} call
|
||||
(@pxref{Controlling Active Maps}).
|
||||
|
||||
In the above pseudo-code, if a key sequence starts with a mouse
|
||||
event, that event's position is used instead of point and the current
|
||||
buffer. Mouse events on an embedded string use non-@code{nil} text
|
||||
properties from that string instead of the buffer.
|
||||
|
||||
When a match is found (@pxref{Key Lookup}), if the binding in the
|
||||
keymap is a function, the search is over. However if the keymap entry
|
||||
|
@ -951,19 +954,27 @@ are used before @code{minor-mode-map-alist} and
|
|||
@code{minor-mode-overriding-map-alist}.
|
||||
@end defvar
|
||||
|
||||
@defun set-temporary-overlay-map keymap &optional keep
|
||||
This function adds @var{keymap} as a temporary keymap that takes
|
||||
precedence over most other keymaps. It does not take precedence over
|
||||
the ``overriding'' maps (see above); and unlike them, if no match for
|
||||
a key is found in @var{keymap}, the search continues.
|
||||
@cindex transient keymap
|
||||
@defun set-transient-map keymap &optional keep
|
||||
This function adds @var{keymap} as a @dfn{transient} keymap, which
|
||||
takes precedence over other keymaps for one (or more) subsequent keys.
|
||||
|
||||
Normally, @var{keymap} is used only once. If the optional argument
|
||||
@var{pred} is @code{t}, the map stays active if a key from @var{keymap}
|
||||
is used. @var{pred} can also be a function of no arguments: if it returns
|
||||
non-@code{nil} then @var{keymap} stays active.
|
||||
Normally, @var{keymap} is used just once, to look up the very next
|
||||
key. If the optional argument @var{pred} is @code{t}, the map stays
|
||||
active as long as the user types keys defined in @var{keymap}; when
|
||||
the user types a key that is not in @var{keymap}, the transient keymap
|
||||
is deactivated and normal key lookup continues for that key.
|
||||
|
||||
For a pseudo-Lisp description of exactly how and when this keymap applies,
|
||||
@pxref{Searching Keymaps}.
|
||||
The @var{pred} argument can also be a function. In that case, the
|
||||
function is called with no arguments, prior to running each command,
|
||||
while @var{keymap} is active; it should return non-@code{nil} if
|
||||
@var{keymap} should stay active.
|
||||
|
||||
The transient keymap takes precedence over the ``overriding'' maps
|
||||
(see above); and unlike them, if no match for a key is found in
|
||||
@var{keymap}, the key lookup process continues. For a pseudo-Lisp
|
||||
description of exactly how and when this keymap applies,
|
||||
@xref{Searching Keymaps}.
|
||||
@end defun
|
||||
|
||||
@node Key Lookup
|
||||
|
|
4
etc/NEWS
4
etc/NEWS
|
@ -2149,8 +2149,8 @@ log, log10, sqrt, and mod.
|
|||
|
||||
** Miscellaneous new functions
|
||||
|
||||
*** `set-temporary-overlay-map' sets up a temporary keymap that
|
||||
takes precedence over most other maps for a short while (normally one key).
|
||||
*** `set-transient-map' sets up a temporary keymap, active for one key
|
||||
(and optionally more). This keymap takes precedence over other maps.
|
||||
|
||||
*** `autoloadp' tests if its argument is an autoloaded object.
|
||||
|
||||
|
|
|
@ -1,3 +1,17 @@
|
|||
2013-12-23 Chong Yidong <cyd@gnu.org>
|
||||
|
||||
* subr.el (set-transient-map): Rename from
|
||||
set-temporary-overlay-map. Doc fix.
|
||||
|
||||
* face-remap.el (text-scale-adjust):
|
||||
* indent.el (indent-rigidly):
|
||||
* kmacro.el (kmacro-call-macro):
|
||||
* minibuffer.el (minibuffer-force-complete):
|
||||
* repeat.el (repeat):
|
||||
* simple.el (universal-argument--mode):
|
||||
* calendar/todo-mode.el (todo-insert-item--next-param):
|
||||
* progmodes/f90.el (f90-abbrev-start): Callers changed.
|
||||
|
||||
2013-12-22 Kenjiro NAKAYAMA <nakayamakenjiro@gmail.com>
|
||||
|
||||
* net/eww.el (eww-tag-select): Add text-property to jump to next
|
||||
|
|
|
@ -5619,7 +5619,7 @@ already entered and those still available."
|
|||
(setq todo-insert-item--argsleft todo-insert-item--newargsleft))
|
||||
(when prompt (message "Enter a key (so far `%s'): %s"
|
||||
todo-insert-item--keys-so-far prompt))
|
||||
(set-temporary-overlay-map map)
|
||||
(set-transient-map map)
|
||||
(setq todo-insert-item--argsleft argsleft)))
|
||||
|
||||
;; -----------------------------------------------------------------------------
|
||||
|
|
|
@ -326,7 +326,7 @@ a top-level keymap, `text-scale-increase' or
|
|||
(text-scale-increase step)
|
||||
;; (unless (zerop step)
|
||||
(message "Use +,-,0 for further adjustment")
|
||||
(set-temporary-overlay-map
|
||||
(set-transient-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(dolist (mods '(() (control)))
|
||||
(dolist (key '(?- ?+ ?= ?0)) ;; = is often unshifted +.
|
||||
|
|
|
@ -196,7 +196,7 @@ indentation by specifying a large negative ARG."
|
|||
(progn
|
||||
(message "Edit region indentation with <left>, <right>, <S-left> \
|
||||
and <S-right>.")
|
||||
(set-temporary-overlay-map indent-rigidly-map t))
|
||||
(set-transient-map indent-rigidly-map t))
|
||||
(save-excursion
|
||||
(goto-char end)
|
||||
(setq end (point-marker))
|
||||
|
|
|
@ -2251,7 +2251,7 @@ before the command is executed globally with terminated Isearch."
|
|||
(main-event (aref key 0)))
|
||||
(cond
|
||||
;; Don't exit Isearch if we're in the middle of some
|
||||
;; set-temporary-overlay-map thingy like universal-argument--mode.
|
||||
;; `set-transient-map' thingy like `universal-argument--mode'.
|
||||
((not (eq overriding-terminal-local-map isearch--saved-overriding-local-map)))
|
||||
;; Don't exit Isearch for isearch key bindings.
|
||||
((commandp (lookup-key isearch-mode-map key nil)))
|
||||
|
|
|
@ -650,10 +650,10 @@ others, use \\[kmacro-name-last-macro]."
|
|||
(if (and kmacro-call-repeat-with-arg
|
||||
arg (> arg 1))
|
||||
(format " %d times" arg) "")))
|
||||
;; Can't use the `keep-pred' arg because this overlay keymap needs to be
|
||||
;; removed during the next run of the kmacro (i.e. we need to add&remove
|
||||
;; this overlay-map at each repetition).
|
||||
(set-temporary-overlay-map
|
||||
;; Can't use the `keep-pred' arg because this overlay keymap
|
||||
;; needs to be removed during the next run of the kmacro
|
||||
;; (i.e. we must add and remove this map at each repetition).
|
||||
(set-transient-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(define-key map (vector repeat-key)
|
||||
`(lambda () (interactive)
|
||||
|
|
|
@ -1222,7 +1222,7 @@ Repeated uses step through the possible completions."
|
|||
(interactive)
|
||||
(let ((completion-extra-properties extra-prop))
|
||||
(completion-in-region start (point) table pred)))))
|
||||
(set-temporary-overlay-map
|
||||
(set-transient-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(define-key map [remap completion-at-point] cmd)
|
||||
(define-key map (vector last-command-event) cmd)
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2013-12-23 Chong Yidong <cyd@gnu.org>
|
||||
|
||||
* org.el (orgstruct-make-binding): Call set-transient-map instead
|
||||
of old name set-temporary-overlay-map.
|
||||
|
||||
2013-12-06 Achim Gratz <Stromeko@Stromeko.DE>
|
||||
|
||||
* org-crypt.el: Declare `epg-context´.
|
||||
|
|
|
@ -9062,7 +9062,7 @@ if `orgstruct-heading-prefix-regexp' is not empty."
|
|||
(key-description key))))))
|
||||
thereis (key-binding key))))
|
||||
(if (keymapp binding)
|
||||
(set-temporary-overlay-map binding)
|
||||
(set-transient-map binding)
|
||||
(let ((func (or binding
|
||||
(unless disable
|
||||
'orgstruct-error))))
|
||||
|
|
|
@ -2259,7 +2259,7 @@ Any other key combination is executed normally."
|
|||
(interactive "*")
|
||||
(self-insert-command 1)
|
||||
(when abbrev-mode
|
||||
(set-temporary-overlay-map
|
||||
(set-transient-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(define-key map [??] 'f90-abbrev-help)
|
||||
(define-key map (vector help-char) 'f90-abbrev-help)
|
||||
|
|
|
@ -278,7 +278,7 @@ recently executed command not bound to an input event\"."
|
|||
(execute-kbd-macro last-repeatable-command))
|
||||
(call-interactively last-repeatable-command))))
|
||||
(when repeat-repeat-char
|
||||
(set-temporary-overlay-map
|
||||
(set-transient-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(define-key map (vector repeat-repeat-char)
|
||||
(if (null repeat-message-function) 'repeat
|
||||
|
|
|
@ -3321,7 +3321,7 @@ see other processes running on the system, use `list-system-processes'."
|
|||
"Keymap used while processing \\[universal-argument].")
|
||||
|
||||
(defun universal-argument--mode ()
|
||||
(set-temporary-overlay-map universal-argument-map))
|
||||
(set-transient-map universal-argument-map))
|
||||
|
||||
(defun universal-argument ()
|
||||
"Begin a numeric argument for the following command.
|
||||
|
|
44
lisp/subr.el
44
lisp/subr.el
|
@ -4266,33 +4266,35 @@ use `called-interactively-p'."
|
|||
(eq 'add-keymap-witness (nth 1 map))
|
||||
(set symbol tail)))))
|
||||
|
||||
(defun set-temporary-overlay-map (map &optional keep-pred on-exit)
|
||||
"Set MAP as a temporary keymap taking precedence over most other keymaps.
|
||||
Note that this does NOT take precedence over the \"overriding\" maps
|
||||
`overriding-terminal-local-map' and `overriding-local-map' (or the
|
||||
`keymap' text property). Unlike those maps, if no match for a key is
|
||||
found in MAP, the normal key lookup sequence then continues.
|
||||
(defun set-transient-map (map &optional keep-pred on-exit)
|
||||
"Set MAP as a temporary keymap taking precedence over other keymaps.
|
||||
Normally, MAP is used only once, to look up the very next key.
|
||||
However, if the optional argument KEEP-PRED is t, MAP stays
|
||||
active if a key from MAP is used. KEEP-PRED can also be a
|
||||
function of no arguments: if it returns non-nil, then MAP stays
|
||||
active.
|
||||
|
||||
Normally, MAP is used only once. If the optional argument
|
||||
KEEP-PRED is t, MAP stays active if a key from MAP is used.
|
||||
KEEP-PRED can also be a function of no arguments: if it returns
|
||||
non-nil then MAP stays active.
|
||||
Optional arg ON-EXIT, if non-nil, specifies a function that is
|
||||
called, with no arguments, after MAP is deactivated.
|
||||
|
||||
Optional ON-EXIT argument is a function that is called after the
|
||||
deactivation of MAP."
|
||||
(let ((clearfun (make-symbol "clear-temporary-overlay-map")))
|
||||
Note that MAP will take precedence over the \"overriding\" maps
|
||||
`overriding-terminal-local-map' and `overriding-local-map' (and
|
||||
over the `keymap' text property). Unlike those maps, if no match
|
||||
for a key is found in MAP, Emacs continues the normal key lookup
|
||||
sequence."
|
||||
(let ((clearfun (make-symbol "clear-transient-map")))
|
||||
;; Don't use letrec, because equal (in add/remove-hook) would get trapped
|
||||
;; in a cycle.
|
||||
(fset clearfun
|
||||
(lambda ()
|
||||
;; FIXME: Handle the case of multiple temporary-overlay-maps
|
||||
;; E.g. if isearch and C-u both use temporary-overlay-maps, Then
|
||||
;; the lifetime of the C-u should be nested within the isearch
|
||||
;; overlay, so the pre-command-hook of isearch should be
|
||||
;; suspended during the C-u one so we don't exit isearch just
|
||||
;; because we hit 1 after C-u and that 1 exits isearch whereas it
|
||||
;; doesn't exit C-u.
|
||||
(with-demoted-errors "set-temporary-overlay-map PCH: %S"
|
||||
;; FIXME: Handle the case of multiple transient maps. For
|
||||
;; example, if isearch and C-u both use transient maps,
|
||||
;; then the lifetime of the C-u should be nested within
|
||||
;; the isearch overlay, so the pre-command-hook of isearch
|
||||
;; should be suspended during the C-u one so we don't exit
|
||||
;; isearch just because we hit 1 after C-u and that 1
|
||||
;; exits isearch whereas it doesn't exit C-u.
|
||||
(with-demoted-errors "set-transient-map PCH: %S"
|
||||
(unless (cond ((null keep-pred) nil)
|
||||
((eq t keep-pred)
|
||||
(eq this-command
|
||||
|
|
Loading…
Add table
Reference in a new issue