Commit 8cd22a08 authored by Chong Yidong's avatar Chong Yidong
Browse files

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