diff options
| author | Stefan Monnier | 2014-01-06 14:29:39 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2014-01-06 14:29:39 -0500 |
| commit | ec00f20f553cdd37c1261a5a228ec762fc9b5497 (patch) | |
| tree | a40330323e6cfc0ff0408b959137e12383cf387c | |
| parent | 9f4e49e93ec3919d9ed38470f065c8b8b9120cb0 (diff) | |
| download | emacs-ec00f20f553cdd37c1261a5a228ec762fc9b5497.tar.gz emacs-ec00f20f553cdd37c1261a5a228ec762fc9b5497.zip | |
* lisp/subr.el (set-transient-map): Fix nested case and docstring.
| -rw-r--r-- | lisp/ChangeLog | 12 | ||||
| -rw-r--r-- | lisp/subr.el | 38 |
2 files changed, 28 insertions, 22 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index fb551c1dc8b..4bfcac9a232 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2014-01-06 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * subr.el (set-transient-map): Fix nested case and docstring. | ||
| 4 | |||
| 1 | 2014-01-06 Tassilo Horn <tsdh@gnu.org> | 5 | 2014-01-06 Tassilo Horn <tsdh@gnu.org> |
| 2 | 6 | ||
| 3 | * textmodes/reftex-vars.el (reftex-label-alist-builtin): Add a | 7 | * textmodes/reftex-vars.el (reftex-label-alist-builtin): Add a |
| @@ -10,12 +14,10 @@ | |||
| 10 | * vc/log-view.el (log-view-beginning-of-defun): Rewrite to behave | 14 | * vc/log-view.el (log-view-beginning-of-defun): Rewrite to behave |
| 11 | like `beginning-of-defun'. | 15 | like `beginning-of-defun'. |
| 12 | (log-view-end-of-defun,log-view-end-of-defun-1): Rename old | 16 | (log-view-end-of-defun,log-view-end-of-defun-1): Rename old |
| 13 | log-view-end-of-defun to log-view-end-of-defun-1. Replace | 17 | log-view-end-of-defun to log-view-end-of-defun-1. Replace |
| 14 | log-view-end-of-defun with wrapper that behaves like | 18 | log-view-end-of-defun with wrapper that behaves like `end-of-defun'. |
| 15 | `end-of-defun'. | ||
| 16 | (log-view-extract-comment): Call `log-view-current-entry' directly | 19 | (log-view-extract-comment): Call `log-view-current-entry' directly |
| 17 | instead of relying on broken `log-view-beginning-of-defun' | 20 | instead of relying on broken `log-view-beginning-of-defun' behavior. |
| 18 | behavior. | ||
| 19 | 21 | ||
| 20 | 2014-01-06 Paul Eggert <eggert@cs.ucla.edu> | 22 | 2014-01-06 Paul Eggert <eggert@cs.ucla.edu> |
| 21 | 23 | ||
diff --git a/lisp/subr.el b/lisp/subr.el index bd48101b096..5d945047da6 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -4280,29 +4280,33 @@ active. | |||
| 4280 | Optional arg ON-EXIT, if non-nil, specifies a function that is | 4280 | Optional arg ON-EXIT, if non-nil, specifies a function that is |
| 4281 | called, with no arguments, after MAP is deactivated. | 4281 | called, with no arguments, after MAP is deactivated. |
| 4282 | 4282 | ||
| 4283 | Note that MAP will take precedence over the \"overriding\" maps | 4283 | This uses `overriding-terminal-local-map' which takes precedence over all other |
| 4284 | `overriding-terminal-local-map' and `overriding-local-map' (and | 4284 | keymaps. As usual, if no match for a key is found in MAP, the normal key |
| 4285 | over the `keymap' text property). Unlike those maps, if no match | 4285 | lookup sequence then continues." |
| 4286 | for a key is found in MAP, Emacs continues the normal key lookup | ||
| 4287 | sequence." | ||
| 4288 | (let ((clearfun (make-symbol "clear-transient-map"))) | 4286 | (let ((clearfun (make-symbol "clear-transient-map"))) |
| 4289 | ;; Don't use letrec, because equal (in add/remove-hook) would get trapped | 4287 | ;; Don't use letrec, because equal (in add/remove-hook) would get trapped |
| 4290 | ;; in a cycle. | 4288 | ;; in a cycle. |
| 4291 | (fset clearfun | 4289 | (fset clearfun |
| 4292 | (lambda () | 4290 | (lambda () |
| 4293 | ;; FIXME: Handle the case of multiple transient maps. For | ||
| 4294 | ;; example, if isearch and C-u both use transient maps, | ||
| 4295 | ;; then the lifetime of the C-u should be nested within | ||
| 4296 | ;; the isearch overlay, so the pre-command-hook of isearch | ||
| 4297 | ;; should be suspended during the C-u one so we don't exit | ||
| 4298 | ;; isearch just because we hit 1 after C-u and that 1 | ||
| 4299 | ;; exits isearch whereas it doesn't exit C-u. | ||
| 4300 | (with-demoted-errors "set-transient-map PCH: %S" | 4291 | (with-demoted-errors "set-transient-map PCH: %S" |
| 4301 | (unless (cond ((null keep-pred) nil) | 4292 | (unless (cond |
| 4302 | ((eq t keep-pred) | 4293 | ((not (eq map (cadr overriding-terminal-local-map))) |
| 4303 | (eq this-command | 4294 | ;; There's presumably some other transient-map in |
| 4304 | (lookup-key map (this-command-keys-vector)))) | 4295 | ;; effect. Wait for that one to terminate before we |
| 4305 | (t (funcall keep-pred))) | 4296 | ;; remove ourselves. |
| 4297 | ;; For example, if isearch and C-u both use transient | ||
| 4298 | ;; maps, then the lifetime of the C-u should be nested | ||
| 4299 | ;; within isearch's, so the pre-command-hook of | ||
| 4300 | ;; isearch should be suspended during the C-u one so | ||
| 4301 | ;; we don't exit isearch just because we hit 1 after | ||
| 4302 | ;; C-u and that 1 exits isearch whereas it doesn't | ||
| 4303 | ;; exit C-u. | ||
| 4304 | t) | ||
| 4305 | ((null keep-pred) nil) | ||
| 4306 | ((eq t keep-pred) | ||
| 4307 | (eq this-command | ||
| 4308 | (lookup-key map (this-command-keys-vector)))) | ||
| 4309 | (t (funcall keep-pred))) | ||
| 4306 | (internal-pop-keymap map 'overriding-terminal-local-map) | 4310 | (internal-pop-keymap map 'overriding-terminal-local-map) |
| 4307 | (remove-hook 'pre-command-hook clearfun) | 4311 | (remove-hook 'pre-command-hook clearfun) |
| 4308 | (when on-exit (funcall on-exit)))))) | 4312 | (when on-exit (funcall on-exit)))))) |