From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: xenodasein--- via "Emacs development discussions." Newsgroups: gmane.emacs.devel Subject: Functionality of overriding-local-map Date: Thu, 6 Jan 2022 10:49:31 +0100 (CET) Message-ID: Reply-To: xenodasein@tutanota.de Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5925"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jan 06 11:23:47 2022 Return-path: Envelope-to: ged-emacs-devel@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 1n5Pvu-0001LE-Vx for ged-emacs-devel@m.gmane-mx.org; Thu, 06 Jan 2022 11:23:47 +0100 Original-Received: from localhost ([::1]:47170 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5Pvu-0002Zl-30 for ged-emacs-devel@m.gmane-mx.org; Thu, 06 Jan 2022 05:23:46 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:50302) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5POs-0003rf-UY for emacs-devel@gnu.org; Thu, 06 Jan 2022 04:49:40 -0500 Original-Received: from w4.tutanota.de ([81.3.6.165]:53452) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5POo-00076I-PN for emacs-devel@gnu.org; Thu, 06 Jan 2022 04:49:37 -0500 Original-Received: from w3.tutanota.de (unknown [192.168.1.164]) by w4.tutanota.de (Postfix) with ESMTP id 0364010602EF for ; Thu, 6 Jan 2022 09:49:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1641462571; s=s1; d=tutanota.de; h=From:From:To:To:Subject:Subject:Content-Description:Content-ID:Content-Type:Content-Type:Content-Transfer-Encoding:Content-Transfer-Encoding:Cc:Date:Date:In-Reply-To:MIME-Version:MIME-Version:Message-ID:Message-ID:Reply-To:References:Sender; bh=m8gUhDGYeJxhFVRdhWx+ABiRkJ/soJfwvRp5joFfBqY=; b=Fz6NjAK6YG/i07ky0vFA/q7QnxmRA/0p98+I96FbdUjdqMwn/yNPPIPNZwzYoxWU 6FIhIVx+VVHuQKi9A+EQ6+OqQGUnc2tO4kW4pZzLX5OowcBdVX5cGmAteib00n8uC/b O3fMBQ7bZpmC9hLlsbKAccRsq2aMgfSYmiKkCvy+LTgLIQ5Lj+FMcVt2rYVnzczpzG7 cymPdd74niKAPg6l6AQV4tPg9GD++1Tw6LEz0JQFKnIHPQehjkTVwPCXe0QgV6glNI3 hgCHqXYqt9RCy8xHVKPUeC2SmGmgTWNNkgTrNCfoumJPbLdeK431qCzkqrtUX5sPfG/ JBeFRodH1w== Received-SPF: pass client-ip=81.3.6.165; envelope-from=xenodasein@tutanota.de; helo=w4.tutanota.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:284308 Archived-At: At first I thought I made a mistake and asked about this on help list. https://lists.gnu.org/archive/html/help-gnu-emacs/2022-01/msg00014.html https://lists.gnu.org/archive/html/help-gnu-emacs/2022-01/msg00018.html https://lists.gnu.org/archive/html/help-gnu-emacs/2022-01/msg00019.html https://lists.gnu.org/archive/html/help-gnu-emacs/2022-01/msg00022.html What happened was I had the wrong assumption on how keymaps work, caused by dated documentation. According to "(elisp) Searching Keymaps": (or (if overriding-terminal-local-map =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (F= IND-IN overriding-terminal-local-map)) =C2=A0=C2=A0=C2=A0 (if overriding-local-map =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (F= IND-IN overriding-local-map) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (or (FIND-IN (= get-char-property (point) 'keymap)) =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=C2=A0 (FIND-IN-ANY emulation-mode-map-alists) =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=C2=A0 (FIND-IN-ANY minor-mode-overriding-map-alist) =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=C2=A0 (FIND-IN-ANY minor-mode-map-alist) =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=C2=A0 (if (get-text-property (point) 'local-map) =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=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (FIND-IN (get-char-property (point) 'loca= l-map)) =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=C2=A0=C2=A0=C2=A0 (FIND-IN (current-local-map))))) =C2=A0=C2=A0=C2=A0 (FIND-IN (current-global-map))) When both overriding-terminal-local-map and overriding-local-map are active, key lookup should be done in these three maps: o-t-l-m=C2=A0=C2=A0 ->=C2=A0=C2=A0 o-l-m=C2=A0=C2=A0 ->=C2=A0=C2=A0 global-= map But this is wrong, the correct behavior is what "(elisp) Controlling Active Maps" explains, by contradicting the former: -- Variable: overriding-terminal-local-map =C2=A0=C2=A0=C2=A0=C2=A0 If non-=E2=80=98nil=E2=80=99, this variable holds = a keymap to use instead of =C2=A0=C2=A0=C2=A0=C2=A0 =E2=80=98overriding-local-map=E2=80=99, the buffer= =E2=80=99s local keymap, text property or =C2=A0=C2=A0=C2=A0=C2=A0 overlay keymaps, and all the minor mode keymaps. If o-t-l-m is active, o-l-m is out of the equation. Stefan M: > The code says: > >=C2=A0 if (!NILP (olp) >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /* The doc said that overriding-terminal-lo= cal-map should >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 override overriding-local= -map.=C2=A0 The code used them both, >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 but it seems clearer to u= se just one.=C2=A0 rms, jan 2005.=C2=A0 */ >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 && NILP (KVAR (current_kboard, Voverriding_= terminal_local_map)) >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 && !NILP (Voverriding_local_map)) >=C2=A0=C2=A0=C2=A0 keymaps =3D Fcons (Voverriding_local_map, keymaps); > > It seems the doc isn't clear cut and there's not much more info to > accompany this commit d64cdc59724b7caca47913d5beb2b4a54f7b7c91. > I you want to change this behavior (or fix/improve the doc) > I recommend you `M-x report-emacs-bug`. I encountered this while using o-l-m as a buffer local map that overrides other buffer local maps, as it is intended.=C2=A0 o-t-l-m does not do this; the latter (current) behavior results in a loss of functionality. In my case, it prevented the use of universal-argument with commands in overriding-local-map.=C2=A0 As universal-argument uses set-transient-map= , if next command isn't bound in universal-argument-map, it is looked up in next active keymap (current-global-map).=C2=A0 IMO, what should happen i= s that the next active keymap be overriding-local-map, as per "(elisp) Searching Keymaps."