GNU bug report logs - #40096
26.3; set-transient-map does not work with remapped bindings

Previous Next

Package: emacs;

Reported by: Uros Perisic <uros.m.perisic <at> gmail.com>

Date: Tue, 17 Mar 2020 03:14:01 UTC

Severity: normal

Found in version 26.3

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

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 40096 in the body.
You can then email your comments to 40096 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 bug-gnu-emacs <at> gnu.org:
bug#40096; Package emacs. (Tue, 17 Mar 2020 03:14:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Uros Perisic <uros.m.perisic <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 17 Mar 2020 03:14:01 GMT) Full text and rfc822 format available.

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

From: Uros Perisic <uros.m.perisic <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 26.3; set-transient-map does not work with remapped bindings
Date: Tue, 17 Mar 2020 10:32:21 +0800
[Message part 1 (text/plain, inline)]
`set-transient-keymap' states that "if the optional argument KEEP-PRED
is t, MAP stays active if a key from MAP is used". This is not the
case. If one of the keys on the keymap is bound using the special
[remap <function>] vector, the map is deactivated.

I think the reason is that this test fails:
#+BEGIN_SRC elisp
(let ((mc (lookup-key map (this-command-keys-vector))))
                          ;; If the key is unbound `this-command` is
                          ;; nil and so is `mc`.
                          (and mc (eq this-command mc)))
#+END_SRC

Here's a recipe to reproduce it starting form emacs -Q:
#+BEGIN_SRC elisp
(setq mymap (make-sparse-keymap))
(defun message-foo () (interactive) (message "foo"))
(defun message-bar () (interactive) (message "bar"))
(define-key mymap "f" #'message-foo)
(set-transient-map mymap t)
;; continually press f and note that foo is constantly messaged
;; press any other letter and it will stop
(define-key mymap [remap message-foo] #'message-bar)
(set-transient-map mymap t)
;; note that pressing f only echoes foo once
#+END_SRC

In GNU Emacs 26.3 (build 1, x86_64-unknown-linux-gnu, GTK+ Version 3.24.10)
 of 2019-08-29 built on a-hel-fi
Windowing system distributor 'The X.Org Foundation', version 11.0.12007000
System Description: Void Linux

Configured using:
 'configure --with-x-toolkit=gtk3 --with-xwidgets --prefix=/usr
 --sysconfdir=/etc --sbindir=/usr/bin --bindir=/usr/bin
 --mandir=/usr/share/man --infodir=/usr/share/info --localstatedir=/var
 --with-file-notification=inotify --with-modules --with-jpeg --with-tiff
 --with-gif --with-png --with-xpm --with-rsvg --without-imagemagick
 --with-xml2 --with-gnutls --with-sound --with-m17n-flt
 --host=x86_64-unknown-linux-gnu --build=x86_64-unknown-linux-gnu
 'CFLAGS=-fno-PIE -mtune=generic -O2 -pipe -g' 'CPPFLAGS= '
 'LDFLAGS=-no-pie -Wl,--as-needed ''

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND DBUS GSETTINGS GLIB NOTIFY ACL GNUTLS
LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11
XDBE XIM MODULES THREADS XWIDGETS LCMS2

Important settings:
  value of $LC_COLLATE: C
  value of $LC_MESSAGES:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#40096; Package emacs. (Mon, 23 May 2022 11:09:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Uros Perisic <uros.m.perisic <at> gmail.com>
Cc: 40096 <at> debbugs.gnu.org
Subject: Re: bug#40096: 26.3; set-transient-map does not work with remapped
 bindings
Date: Mon, 23 May 2022 13:08:37 +0200
Uros Perisic <uros.m.perisic <at> gmail.com> writes:

> Here's a recipe to reproduce it starting form emacs -Q:
> #+BEGIN_SRC elisp
> (setq mymap (make-sparse-keymap))
> (defun message-foo () (interactive) (message "foo"))
> (defun message-bar () (interactive) (message "bar"))
> (define-key mymap "f" #'message-foo)
> (set-transient-map mymap t)
> ;; continually press f and note that foo is constantly messaged
> ;; press any other letter and it will stop
> (define-key mymap [remap message-foo] #'message-bar)
> (set-transient-map mymap t)
> ;; note that pressing f only echoes foo once
> #+END_SRC

Thanks for the clear recipe.  I've now fixed this in Emacs 29.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug marked as fixed in version 29.1, send any further explanations to 40096 <at> debbugs.gnu.org and Uros Perisic <uros.m.perisic <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 23 May 2022 11:09:02 GMT) Full text and rfc822 format available.

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

This bug report was last modified 1 year and 304 days ago.

Previous Next


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