GNU bug report logs - #24149
25.1; set-transient-map bug

Previous Next

Package: emacs;

Reported by: Leo Liu <sdl.web <at> gmail.com>

Date: Thu, 4 Aug 2016 12:18:02 UTC

Severity: normal

Found in version 25.1

Done: Leo Liu <sdl.web <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 24149 in the body.
You can then email your comments to 24149 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to monnier <at> iro.umontreal.ca, bug-gnu-emacs <at> gnu.org:
bug#24149; Package emacs. (Thu, 04 Aug 2016 12:18:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Leo Liu <sdl.web <at> gmail.com>:
New bug report received and forwarded. Copy sent to monnier <at> iro.umontreal.ca, bug-gnu-emacs <at> gnu.org. (Thu, 04 Aug 2016 12:18:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Leo Liu <sdl.web <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.1; set-transient-map bug
Date: Thu, 04 Aug 2016 20:17:04 +0800
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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24149; Package emacs. (Thu, 04 Aug 2016 12:24:01 GMT) Full text and rfc822 format available.

Message #8 received at 24149 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Leo Liu <sdl.web <at> gmail.com>
Cc: 24149 <at> debbugs.gnu.org
Subject: Re: bug#24149: 25.1; set-transient-map bug
Date: Thu, 04 Aug 2016 08:26:08 -0400
> Stefan, is the following the right fix?

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


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24149; Package emacs. (Thu, 04 Aug 2016 13:19:01 GMT) Full text and rfc822 format available.

Message #11 received at 24149 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Leo Liu <sdl.web <at> gmail.com>
Cc: 24149 <at> debbugs.gnu.org
Subject: Re: bug#24149: 25.1; set-transient-map bug
Date: Thu, 04 Aug 2016 09:20:35 -0400
> 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.




Reply sent to Leo Liu <sdl.web <at> gmail.com>:
You have taken responsibility. (Thu, 04 Aug 2016 15:48:02 GMT) Full text and rfc822 format available.

Notification sent to Leo Liu <sdl.web <at> gmail.com>:
bug acknowledged by developer. (Thu, 04 Aug 2016 15:48:02 GMT) Full text and rfc822 format available.

Message #16 received at 24149-done <at> debbugs.gnu.org (full text, mbox):

From: Leo Liu <sdl.web <at> gmail.com>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: 24149-done <at> debbugs.gnu.org
Subject: Re: bug#24149: 25.1; set-transient-map bug
Date: Thu, 04 Aug 2016 23:47:48 +0800
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




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 02 Sep 2016 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 8 years and 249 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.