From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Uros Perisic Newsgroups: gmane.emacs.bugs Subject: bug#40096: 26.3; set-transient-map does not work with remapped bindings Date: Tue, 17 Mar 2020 10:32:21 +0800 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000a82d7005a103bb8c" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="16820"; mail-complaints-to="usenet@ciao.gmane.io" To: 40096@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Mar 17 04:14:12 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jE2gG-0004Ix-2L for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 17 Mar 2020 04:14:12 +0100 Original-Received: from localhost ([::1]:51870 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jE2gE-0005Nn-Qf for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 16 Mar 2020 23:14:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41660) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jE2g7-0005Nh-Ft for bug-gnu-emacs@gnu.org; Mon, 16 Mar 2020 23:14:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jE2g6-0003GO-3d for bug-gnu-emacs@gnu.org; Mon, 16 Mar 2020 23:14:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:60272) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jE2g6-0003ET-0L for bug-gnu-emacs@gnu.org; Mon, 16 Mar 2020 23:14:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jE2g5-00052g-PU for bug-gnu-emacs@gnu.org; Mon, 16 Mar 2020 23:14:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Uros Perisic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 17 Mar 2020 03:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 40096 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.158441481619330 (code B ref -1); Tue, 17 Mar 2020 03:14:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 17 Mar 2020 03:13:36 +0000 Original-Received: from localhost ([127.0.0.1]:38012 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jE2ff-00051i-Ta for submit@debbugs.gnu.org; Mon, 16 Mar 2020 23:13:36 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:53808) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jE210-0003wa-0N for submit@debbugs.gnu.org; Mon, 16 Mar 2020 22:31:34 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55459) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jE20y-00062w-ES for bug-gnu-emacs@gnu.org; Mon, 16 Mar 2020 22:31:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jE20x-000606-34 for bug-gnu-emacs@gnu.org; Mon, 16 Mar 2020 22:31:32 -0400 Original-Received: from mail-vk1-xa42.google.com ([2607:f8b0:4864:20::a42]:46842) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jE20w-0005mL-SZ for bug-gnu-emacs@gnu.org; Mon, 16 Mar 2020 22:31:31 -0400 Original-Received: by mail-vk1-xa42.google.com with SMTP id s139so5523347vka.13 for ; Mon, 16 Mar 2020 19:31:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=BsexcBi6vEKHrvjzkkGiZdZ3FTlPUok681QUxZ+Bp5o=; b=N3iHy+j/aJVZGrhj04ZNeMuiympUoOkS4fBNAjqMgspGLTmeXF0TVxoRmwp7pVINlS SB+HikM4rB3MSCJrt2iI4HUatgNZ4BrGxuZ9itYFf/BQa9bw52Aebtg6miGi0TIwZhsa FTPYLP7cU3XTr2dns2Nw0TrVhrkVHmzhIbdXrofVSIKUMH6dThndY998tLZgyr6SCh0v u0ig5SRzR37YhFwui+v/3vhD4B5MEDePEEzYsekPLMIZZ3H8aCRnAaTP969zTvYwnUy8 JoQstSXlZc+/DDjvK7d0uiGSs2yi+5YpvGSwxacpa/ZT9PtwGLaojth7yKINtBPcyAvS Lnpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=BsexcBi6vEKHrvjzkkGiZdZ3FTlPUok681QUxZ+Bp5o=; b=X/azShlZq9iqpT0/eM0nwHGETv7mAGYGBcUsiCeIa5VBQUJnblalXQWJReKR8a4ezn savN+JFXDbWZsdqVqIhLrXQzGfFX1xDsQ+7rxZqmxIbs9dDjB29vEgki7F2UNstzcd8u L0MYuOFF6v+NlvsL3Dk3CW2HFjZDe4/O65BoE5rZffa9GKzJ0Q5iQ/xaoObRkBZFZJc7 1U7SnOmqNmVK2C+M6Is9Mau6qzKAcQxubOnqxgRPxB07Dp+EPmau+KX2Qps+G4QnKT5A 7qY9IpnpafzeU/hNounqF2vVVLM9i3WJynzhRu6+N2uHuCW8CmzAnSCof/UX9BvZpp+e LxyA== X-Gm-Message-State: ANhLgQ0FfOTOp/z77PCdwY7kELv9pfn5FcBY0wCm94Tm7CVxMsLMGWTP nFjZ0YevN+p5INgqfsD0WF+wqcYKJB41HLl0snOjZi7i0kA= X-Google-Smtp-Source: ADFU+vuS//FhLJXExG8OxkvwsKDguJSYmiQi7Fi9o+u/higE+9XO0N2CO16COvashKWFAr5geB4HjcJ6uhvOjRYhziw= X-Received: by 2002:a1f:c188:: with SMTP id r130mr2203945vkf.94.1584412288887; Mon, 16 Mar 2020 19:31:28 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Mailman-Approved-At: Mon, 16 Mar 2020 23:13:34 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:177431 Archived-At: --000000000000a82d7005a103bb8c Content-Type: text/plain; charset="UTF-8" `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 ] 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 --000000000000a82d7005a103bb8c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

`set-transient-keymap' states that "if the op= tional argument KEEP-PRED
is t, MAP stays active if a key from MAP is us= ed". This is not the
case. If one of the keys on the keymap is boun= d using the special
[remap <function>] vector, the map is deactiva= ted.

I think the reason is that this test fails:
#+BEGIN_SRC elis= p
(let ((mc (lookup-key map (this-command-keys-vector))))
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 ;; If the key is unbound `this-command` is
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; ni= l and so is `mc`.
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (and mc (eq this-command mc)))
#+= END_SRC

Here's a recipe to reproduce it starting form emacs -Q:<= br>#+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 onc= e
#+END_SRC

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

Configured using:
=C2=A0'co= nfigure --with-x-toolkit=3Dgtk3 --with-xwidgets --prefix=3D/usr
=C2=A0--= sysconfdir=3D/etc --sbindir=3D/usr/bin --bindir=3D/usr/bin
=C2=A0--mandi= r=3D/usr/share/man --infodir=3D/usr/share/info --localstatedir=3D/var
= =C2=A0--with-file-notification=3Dinotify --with-modules --with-jpeg --with-= tiff
=C2=A0--with-gif --with-png --with-xpm --with-rsvg --without-imagem= agick
=C2=A0--with-xml2 --with-gnutls --with-sound --with-m17n-flt
= =C2=A0--host=3Dx86_64-unknown-linux-gnu --build=3Dx86_64-unknown-linux-gnu<= br>=C2=A0'CFLAGS=3D-fno-PIE -mtune=3Dgeneric -O2 -pipe -g' 'CPP= FLAGS=3D '
=C2=A0'LDFLAGS=3D-no-pie -Wl,--as-needed ''
Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND DBUS GSETTIN= GS GLIB NOTIFY ACL GNUTLS
LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOL= KIT_SCROLL_BARS GTK3 X11
XDBE XIM MODULES THREADS XWIDGETS LCMS2

= Important settings:
=C2=A0 value of $LC_COLLATE: C
=C2=A0 value of $L= C_MESSAGES:
=C2=A0 value of $LANG: en_US.UTF-8
=C2=A0 locale-coding-s= ystem: utf-8-unix
--000000000000a82d7005a103bb8c--