From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: "Basil L. Contovounesios" Newsgroups: gmane.emacs.bugs Subject: bug#40725: 27.0.91; Tutorial reports false positive key rebindings Date: Mon, 20 Apr 2020 23:19:46 +0100 Message-ID: <87d0817qbh.fsf@tcd.ie> References: <87eesj59yq.fsf@tcd.ie> <83wo6agrju.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="124136"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 40725@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Apr 21 00:20:13 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 1jQelx-000W78-JW for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 21 Apr 2020 00:20:13 +0200 Original-Received: from localhost ([::1]:43308 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jQelu-0003Tj-W2 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 20 Apr 2020 18:20:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50232) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jQelm-0003TZ-PK for bug-gnu-emacs@gnu.org; Mon, 20 Apr 2020 18:20:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jQelm-0002EP-7v for bug-gnu-emacs@gnu.org; Mon, 20 Apr 2020 18:20:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:37078) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jQell-0002Dy-R8 for bug-gnu-emacs@gnu.org; Mon, 20 Apr 2020 18:20:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jQell-0008Sk-K3 for bug-gnu-emacs@gnu.org; Mon, 20 Apr 2020 18:20:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Basil L. Contovounesios" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 20 Apr 2020 22:20:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40725 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 40725-submit@debbugs.gnu.org id=B40725.158742119532512 (code B ref 40725); Mon, 20 Apr 2020 22:20:01 +0000 Original-Received: (at 40725) by debbugs.gnu.org; 20 Apr 2020 22:19:55 +0000 Original-Received: from localhost ([127.0.0.1]:48624 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jQelf-0008SJ-0k for submit@debbugs.gnu.org; Mon, 20 Apr 2020 18:19:55 -0400 Original-Received: from mail-wm1-f47.google.com ([209.85.128.47]:35643) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jQele-0008S8-2b for 40725@debbugs.gnu.org; Mon, 20 Apr 2020 18:19:54 -0400 Original-Received: by mail-wm1-f47.google.com with SMTP id r26so1407695wmh.0 for <40725@debbugs.gnu.org>; Mon, 20 Apr 2020 15:19:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=Ey/H2yEcbjf9Sl2FbuSnLTA/PssumYN3sbtTkIa6wrM=; b=fPAW3JXxcyEmRkmgSoOr/XtqTib+qqWFNuYXsiiBp6xwclsGiLmF0gjyck03SBEysj Q6VxfkhGKBlU8SIuCuKbDHc/AviK4M4uT/XdAb6WPN7oreNBxGzqeAiKQujI5l1qvKn5 FjJgrP1PZdSupTlX4heUkx9BjGxU17M5MQG9yGlYeSG4y+F+4HoQs0RzB9C4iLZZ9bdN hRehC/X5lFUtGT3XI47n+W2Uk6H1OODrK7SrXqaHR1IeUjt8n4I3Z4Mavt4BDPTz30j3 1LoAJXYYqhfPguGKpQwgN4HzbvtkBPJAZDuW9618W674x9NA+QHMF9uYHwq9oIoB6AyH TU6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=Ey/H2yEcbjf9Sl2FbuSnLTA/PssumYN3sbtTkIa6wrM=; b=tXZozCeal87tQOTM0xJe/bvF1qHfA38JYGGTWJo9dJc8sjTdOKv3hbE2GE/BrwY2qZ 5maO86PWWAjQ+2lt9yGHQDMSHaPFTOz38XWsURKvkZykxYZxkj9SCUnW0OU1xswf5N6q xQWEMzsDD+pLHj0swB5xip8roJCi1OxBfQFuTLHwq4jf4yW/lD0Or7K5pu8zRjxB9n5/ J/F8poynPNloZn5igHdBf8v7D/otpqfP6Pz1pELTx00PmMj7HajJLN5rXGlv5iVDAKp4 36noHz3crvWQmlBKG5prh7Zr5rfm/wCWbYDsI3wgY1SZsm+aTEztK3GhjwAh1va8U1xR iGPA== X-Gm-Message-State: AGi0PuZxSSErTQirf74RGX9I14YEv5TOFpV5j8L6fk0BUH7kF0aAaWse 3QfRwnhjUZ2qpLHlhNJ5/GWCtw== X-Google-Smtp-Source: APiQypLuaWiKe2rCr63ZZ0Fywm2jIeuXNGJJisgB6OmY3Ivyas3KmFADDaC9qALGKfVF18Q6UG8kVg== X-Received: by 2002:a7b:c213:: with SMTP id x19mr1510671wmi.53.1587421188456; Mon, 20 Apr 2020 15:19:48 -0700 (PDT) Original-Received: from localhost ([2a02:8084:20e2:c380:1f68:7ff5:120d:64e]) by smtp.gmail.com with ESMTPSA id k17sm970653wmi.10.2020.04.20.15.19.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Apr 2020 15:19:47 -0700 (PDT) In-Reply-To: <83wo6agrju.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 20 Apr 2020 17:28:21 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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:178732 Archived-At: Eli Zaretskii writes: > Isn't the patch too general? I don't think so - apart from avoiding the false warning in the OP, it should be equivalent to the current logic. The function in question, tutorial--find-changed-keys, is only ever passed the defconst tutorial--default-keys as argument. The only elements of tutorial--default-keys whose car satisfies keymapp are: ((ESC-prefix [27]) (Control-X-prefix [24]) (mode-specific-command-prefix [3])) Currently, tutorial--find-changed-keys hard-codes the check for the first two: (if (eq def-fun 'ESC-prefix) (lookup-key global-map [27]) (if (eq def-fun 'Control-X-prefix) (lookup-key global-map [24]) (key-binding key))) Therefore changing this to: (if (keymapp def-fun) (lookup-key global-map key) (key-binding key)) Has the same effect as: (if (eq def-fun 'ESC-prefix) (lookup-key global-map [27]) (if (eq def-fun 'Control-X-prefix) (lookup-key global-map [24]) (if (eq def-fun 'mode-specific-command-prefix) (lookup-key global-map [3]) (key-binding key)))) which I think is correct, since I don't see how C-c is any different to C-x or ESC in the context of this function. In fact, the tutorial doesn't mention C-c at all, but apparently it's included in tutorial--default-keys just because it's an otherwise common prefix. > How do we distinguish the case where _all_ of the subcommands were > rebound, for example? I don't think the current logic tries to handle that either, does it? Besides, mode-specific-command-prefix is an empty keymap by default, the tutorial makes no mention of it, and tutorial--default-keys already tries (and fails, see below) to list all the pertinent keys under the ESC and C-x prefixes. FWIW, tutorial--find-changed-keys rightly detects and warns about the following situation both with and without my patch: (define-key global-map "\C-c" #'ignore) > Also, don't we have some prefixes that for the purposes of the > tutorial must not have _any_ of its subcommands rebound? Hm, I don't know. Did you have any examples in mind? The only prefixes I see used in the tutorial are C-x, C-h, and Meta/ESC. AFAICT if a command-binding pair isn't listed in tutorial--default-keys, then C-h t won't complain about it being rebound. For example, you can rebind C-x k (which IS mentioned in the tutorial) and C-h t won't notice at all. I can open another bug report for extending tutorial--default-keys to detect changes to all default key bindings used in the tutorial, but for now I think the proposed patch fixes the issue at hand without making things worse. -- Basil