From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eshel Yaron via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#61505: [PATCH] Handle anonymous commands in C-h K Date: Tue, 14 Feb 2023 09:39:00 +0200 Message-ID: Reply-To: Eshel Yaron Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5987"; mail-complaints-to="usenet@ciao.gmane.io" To: 61505@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 14 08:40:27 2023 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 1pRpvP-0001R3-2d for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 14 Feb 2023 08:40:27 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pRpv3-0008O8-Nb; Tue, 14 Feb 2023 02:40:06 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pRpv0-0008N9-P6 for bug-gnu-emacs@gnu.org; Tue, 14 Feb 2023 02:40:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRpv0-00032k-FW for bug-gnu-emacs@gnu.org; Tue, 14 Feb 2023 02:40:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pRpv0-0005Iq-3p for bug-gnu-emacs@gnu.org; Tue, 14 Feb 2023 02:40:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eshel Yaron Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 14 Feb 2023 07:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 61505 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.167636035020308 (code B ref -1); Tue, 14 Feb 2023 07:40:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 14 Feb 2023 07:39:10 +0000 Original-Received: from localhost ([127.0.0.1]:52388 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pRpuA-0005HT-3m for submit@debbugs.gnu.org; Tue, 14 Feb 2023 02:39:10 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:39880) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pRpu7-0005HL-Ok for submit@debbugs.gnu.org; Tue, 14 Feb 2023 02:39:08 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pRpu7-0007dR-FK for bug-gnu-emacs@gnu.org; Tue, 14 Feb 2023 02:39:07 -0500 Original-Received: from mail.eshelyaron.com ([107.175.124.16] helo=eshelyaron.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pRpu5-0002wh-Lk for bug-gnu-emacs@gnu.org; Tue, 14 Feb 2023 02:39:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com; s=mail; t=1676360344; bh=S5yoO/DWlvSlUky373w5y2Xq0uzxp3hZCKfO3LEEMGc=; h=From:To:Subject:Date:From; b=xI0Huy4CrHENWUfg/lXnmc77wCajx1IvM7yakI19N4A7wVr+ou7CMb/c7R/NDnZYE WDViylydVLtkEmVqy+vTqKXu2tlrYC/uJLPdVTZVUpDwgvGJg9DnJ9MCqrGN0EZzVa T4qyBwIzjNGe69mV3JEF9gHMxNI216fadFuI68eJmHUL8i27LKBtkQYEKT4k2fyRr/ buIywR62VJilBt8EqAePHGrGONz5aQaplGLZgsFd8CNIbOsuBjk31dmqBh16GXzkDx 92Xp4r6SQ39bePmeCIx3vaK13Aeu/rjpJ83+2BbZ5hYpASi6nySG54MApVQFC/UWQD 4CuH9ehiDKd3Q== Received-SPF: pass client-ip=107.175.124.16; envelope-from=me@eshelyaron.com; helo=eshelyaron.com 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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:255551 Archived-At: --=-=-= Content-Type: text/plain Tags: patch Currently C-h K (Info-goto-emacs-key-command-node) throws an error when used on anonymous commands, for example: 1. emacs -Q 2. Evaluate this form: (keymap-global-set "C-c m" (lambda () (interactive) (message "foo"))) 3. Type C-h K C-c m 4. Get this error: Info-goto-emacs-command-node: Wrong type argument: symbolp, (closure (t) nil (interactive) (message "foo")) This patch makes Info-goto-emacs-key-command-node detect and handle such cases by printing an informative message instead of calling Info-goto-emacs-command-node. In GNU Emacs 30.0.50 (build 6, x86_64-apple-darwin22.2.0, NS appkit-2299.30 Version 13.1 (Build 22C65)) of 2023-02-11 built on esmac.lan Repository revision: 838415525bd4e77a79e18af8e4f01ed004196c71 Repository branch: master Windowing system distributor 'Apple', version 10.3.2299 System Description: macOS 13.1 Configured using: 'configure --with-native-compilation --with-json --with-xwidgets --with-mailutils --with-imagemagick --without-dbus' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Handle-anonymous-commands-in-C-h-K.patch >From b835e3ab3803ba0344a068dd00b2fc413c3cc970 Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Tue, 14 Feb 2023 09:18:37 +0200 Subject: [PATCH] Handle anonymous commands in C-h K * lisp/info.el (Info-goto-emacs-key-command-node): Don't call Info-goto-emacs-command-node for anonymous commands. --- lisp/info.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lisp/info.el b/lisp/info.el index 035dff66e75..cf11b782bef 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -4671,8 +4671,11 @@ Info-goto-emacs-key-command-node (eq command 'execute-extended-command)) (Info-goto-emacs-command-node (read-command "Find documentation for command: "))) + ((symbolp command) + (Info-goto-emacs-command-node command)) (t - (Info-goto-emacs-command-node command))))) + (message "%s invokes an anonymous command" + (key-description key)))))) (defvar Info-link-keymap (let ((keymap (make-sparse-keymap))) -- 2.39.0 --=-=-=--