unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#40096: 26.3; set-transient-map does not work with remapped bindings
@ 2020-03-17  2:32 Uros Perisic
  2022-05-23 11:08 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 2+ messages in thread
From: Uros Perisic @ 2020-03-17  2:32 UTC (permalink / raw)
  To: 40096

[-- Attachment #1: Type: text/plain, Size: 2210 bytes --]

`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

[-- Attachment #2: Type: text/html, Size: 2551 bytes --]

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

* bug#40096: 26.3; set-transient-map does not work with remapped bindings
  2020-03-17  2:32 bug#40096: 26.3; set-transient-map does not work with remapped bindings Uros Perisic
@ 2022-05-23 11:08 ` Lars Ingebrigtsen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2022-05-23 11:08 UTC (permalink / raw)
  To: Uros Perisic; +Cc: 40096

Uros Perisic <uros.m.perisic@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





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

end of thread, other threads:[~2022-05-23 11:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-17  2:32 bug#40096: 26.3; set-transient-map does not work with remapped bindings Uros Perisic
2022-05-23 11:08 ` Lars Ingebrigtsen

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).