unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#24149: 25.1; set-transient-map bug
@ 2016-08-04 12:17 Leo Liu
  2016-08-04 12:26 ` Stefan Monnier
  2016-08-04 13:20 ` Stefan Monnier
  0 siblings, 2 replies; 4+ messages in thread
From: Leo Liu @ 2016-08-04 12:17 UTC (permalink / raw)
  To: 24149; +Cc: Stefan Monnier


1. Enable temp-buffer-browse-mode
2. (cl-loop repeat 2 do (with-output-to-temp-buffer "*test*" (princ "ok")))
3. Check pre-command-hook

#:clear-transient-map will be there forever.

The issue is caused by two identical calls of set-transient-map that
share the same keymap. so deactivation of the second call has an
side-effect on the first call.

Stefan, is the following the right fix?

Thanks,
Leo

diff --git a/lisp/subr.el b/lisp/subr.el
index 2c0be204..b6a38778 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -4542,7 +4542,8 @@ to deactivate this transient map, regardless of KEEP-PRED."
             (with-demoted-errors "set-transient-map PCH: %S"
               (unless (cond
                        ((null keep-pred) nil)
-                       ((not (eq map (cadr overriding-terminal-local-map)))
+                       ((and (keymapp (cadr overriding-terminal-local-map))
+                             (not (eq map (cadr overriding-terminal-local-map))))
                         ;; There's presumably some other transient-map in
                         ;; effect.  Wait for that one to terminate before we
                         ;; remove ourselves.





^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#24149: 25.1; set-transient-map bug
  2016-08-04 12:17 bug#24149: 25.1; set-transient-map bug Leo Liu
@ 2016-08-04 12:26 ` Stefan Monnier
  2016-08-04 13:20 ` Stefan Monnier
  1 sibling, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2016-08-04 12:26 UTC (permalink / raw)
  To: Leo Liu; +Cc: 24149

> Stefan, is the following the right fix?

Haven't thought enough about it yet, but it looks safe.


        Stefan





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#24149: 25.1; set-transient-map bug
  2016-08-04 12:17 bug#24149: 25.1; set-transient-map bug Leo Liu
  2016-08-04 12:26 ` Stefan Monnier
@ 2016-08-04 13:20 ` Stefan Monnier
  2016-08-04 15:47   ` Leo Liu
  1 sibling, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2016-08-04 13:20 UTC (permalink / raw)
  To: Leo Liu; +Cc: 24149

> 1. Enable temp-buffer-browse-mode
> 2. (cl-loop repeat 2 do (with-output-to-temp-buffer "*test*" (princ "ok")))
> 3. Check pre-command-hook
[...]
> Stefan, is the following the right fix?

While the fix is safe, I think it doesn't catch all cases.
A better fix might be something like the untested one below, which makes
sure we only wait when there's still a map of ours.
If it works and looks good to you, please install it.


        Stefan


diff --git a/lisp/subr.el b/lisp/subr.el
index 77bcaa7..4b7cc93 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -4889,7 +4889,8 @@ set-transient-map
             (with-demoted-errors "set-transient-map PCH: %S"
               (unless (cond
                        ((null keep-pred) nil)
-                       ((not (eq map (cadr overriding-terminal-local-map)))
+                       ((and (not (eq map (cadr overriding-terminal-local-map)))
+                             (memq map (cddr overriding-terminal-local-map)))
                         ;; There's presumably some other transient-map in
                         ;; effect.  Wait for that one to terminate before we
                         ;; remove ourselves.





^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#24149: 25.1; set-transient-map bug
  2016-08-04 13:20 ` Stefan Monnier
@ 2016-08-04 15:47   ` Leo Liu
  0 siblings, 0 replies; 4+ messages in thread
From: Leo Liu @ 2016-08-04 15:47 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 24149-done

On 2016-08-04 09:20 -0400, Stefan Monnier wrote:
> If it works and looks good to you, please install it.

I agree it is a better fix. Pushed commit 84714016 to master.

Thanks,
Leo





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-08-04 15:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-04 12:17 bug#24149: 25.1; set-transient-map bug Leo Liu
2016-08-04 12:26 ` Stefan Monnier
2016-08-04 13:20 ` Stefan Monnier
2016-08-04 15:47   ` Leo Liu

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).