From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Arthur Miller Newsgroups: gmane.emacs.devel Subject: Re: bug#36767: 26.1; request: add more quick keys to the *Help* buffer Date: Sat, 25 Sep 2021 22:15:23 +0200 Message-ID: References: <83bl83zp5h.fsf@gnu.org> <83y27nvnb4.fsf@gnu.org> <83ilyrvgda.fsf@gnu.org> <83h7ebv39d.fsf@gnu.org> <838rznusle.fsf@gnu.org> <87a6k2nlr6.fsf@mail.linkov.net> <83mto2rlyz.fsf@gnu.org> <83bl4hrxtu.fsf@gnu.org> <837df4r99m.fsf@gnu.org> <83wnn4pqo5.fsf@gnu.org> <83r1dcpo5w.fsf@gnu.org> 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="34202"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: larsi@gnus.org, emacs-devel@gnu.org, juri@linkov.net To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Sep 25 22:16:37 2021 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 1mUE68-0008fA-Ji for ged-emacs-devel@m.gmane-mx.org; Sat, 25 Sep 2021 22:16:37 +0200 Original-Received: from localhost ([::1]:60888 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mUE67-0004yw-Ip for ged-emacs-devel@m.gmane-mx.org; Sat, 25 Sep 2021 16:16:35 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58126) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mUE57-0004BU-AQ for emacs-devel@gnu.org; Sat, 25 Sep 2021 16:15:34 -0400 Original-Received: from mail-vi1eur05olkn2096.outbound.protection.outlook.com ([40.92.90.96]:40320 helo=EUR05-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mUE53-00022u-LL; Sat, 25 Sep 2021 16:15:32 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YCHOR5MNfNLeOesCHkebljFO3hF25HgFt+gG/sRw9NRpNwwSDskaspWx9hSHmVCp8s4TI+ABnttEIoHW0/hblNnIid4g6t3IuepoETtW/NwW9AfuKhPeypxXOSVGdcStYvlCvBqUT6LFuDFvbVpJMCdsnNwdZgtYnUJ3rDQ30Hg8CovMUyJJ7QDfh/FiUAv9meS9dBnK1BYrVkDbY5y7NGmlfj3132a7whCPONE8fEucpJ9ebSfVuTB478LuRJpp7gbkw+H8ulqOuaIBshSVT1m87tro+4ZpHtgkdyc4GOhwd6g+TJBj4SYw43LxXrteRMmTx9Sf86scweHiZiE9gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=EaX5HnxpRa/olEY2wYw0WTH4usGmbkLNSXEjeLAcG9c=; b=Z+DTBrBKNhjedOUxVDu6VveOI2C5M9JBdi39veBzX/hMeppstmoojGatU/OfVJDe2GcRr0OX15mA2ZVBaDk14UHEH3RvU3AaML6B1mNIaCLzFuuPW3gaK7+eS05333EsrrtAJLpMp+tl0oDFiaTn68rcTAUs5P299lFVsygxpzgDc3I43+eSqDmqn7vGHkZTDnLgUw9QvU4QX7c2+YpHXoyGzttqm/pFevt59IfSPKxRW8dBwvUxDD4emrkyBghQgWhnG14tnrEoqdWSMqDui7772hXWs03EAsf+If8L0Vp3La3vqsmbpJv5HcAPI5cGkqhKHlgc+c6Oz4YatMSHaw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EaX5HnxpRa/olEY2wYw0WTH4usGmbkLNSXEjeLAcG9c=; b=bK87k2tMJFz6Cw7AOzNyNDx8c1YeLWkOxH+rHTt6ChkGFFSD733QbeGLy7uN27L/de4gPNiTmr3lXDSphcKpqBFrVCkCoEr+2fGle9Y28IPQO6bN37DcDWV4aCU18ISJXKQ1B11+uFpYyb8Ol0hGyZ7kUcpQf2oeNXSBT+qUtMGv4d4RZPQ7cQNPO1CV6QEFu47FC26W933jbJt0m4nSGZpC05KcE1gYew3x/1AhRFMYevUy+tXuYAB4Id35ILaP5be3WLrFfSILSkiQ30B/cmhGueRCLxlON91HJ8hhkFZi5A94HHz7hm3j+g5ISFdRTnp1moarGsCuxMTKXZ3g2A== Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com (13.101.236.148) by AM0PR09MB4387.eurprd09.prod.outlook.com (10.186.189.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13; Sat, 25 Sep 2021 20:15:25 +0000 Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::c55c:ece5:bed2:a9dc]) by AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::c55c:ece5:bed2:a9dc%9]) with mapi id 15.20.4544.021; Sat, 25 Sep 2021 20:15:25 +0000 In-Reply-To: <83r1dcpo5w.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 25 Sep 2021 20:20:43 +0300") X-TMN: [Mc8XBqLPFfyRGCesxknu0GNUwzArFpRW] X-ClientProxiedBy: OL1P279CA0025.NORP279.PROD.OUTLOOK.COM (2603:10a6:e10:13::12) To AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) X-Microsoft-Original-Message-ID: <87k0j42yzo.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from pascal.homepc (81.232.177.30) by OL1P279CA0025.NORP279.PROD.OUTLOOK.COM (2603:10a6:e10:13::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13 via Frontend Transport; Sat, 25 Sep 2021 20:15:24 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 28d5643b-6150-485b-47e3-08d98061358e X-MS-TrafficTypeDiagnostic: AM0PR09MB4387: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9AwGowoHfm+P5sRPNXXXo3WE+gx+P66e+n+yCVfZMAcEShpPyG8iqV8h94fo733q5T4679DsBgtqcyr2yRBM1+E4eY3/WbkcM20u9whXnFrM9gagHHYqsDytLFvnZKPtAmqPL0VmdP6ke7SeL+oPtNTutfNn1PKDSuNQSjjNz+NCZb/n2zxlJucdeQcGfGGak1frkTiWlnIAHraPlDcR/UNdFOfVCP9prEr9lBJJ3QgJtzBVGko36lg65P74kKgfaY90GApmifo8rlBQKDFOTJvV/a/kTD4sSqAOgYUVG5g4TRD/57kiecuYF0OE0aIDjHF5qaKuh0fGZ0H2eoW2Kgvp5tEJyARd1U+lUZuAKbZPbxVMMB9FwY4kaeeM0ZrksL8ZpmBqJLNUETjKUeWlsCT2BqIaYwxLKuxeS1VV1FBw/uwhfQic8NdJuy/VekFK X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: udo6a3qEOYx4WCaNYArLL7ysrn4Qe/JpN6T8xTvl33RxVwEmW56LYKXDCUxv7LHKTUddgT7P76m/hghP0hXD+riF9reK9FCGA6Ln0OkDxsnWMtIk7dOIUeAEKWhI4FHBNntBrc93+0H1WUsCE4mUCg== X-OriginatorOrg: sct-15-20-3174-20-msonline-outlook-72e6e.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 28d5643b-6150-485b-47e3-08d98061358e X-MS-Exchange-CrossTenant-AuthSource: AM9PR09MB4977.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Sep 2021 20:15:25.2806 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR09MB4387 Received-SPF: pass client-ip=40.92.90.96; envelope-from=arthur.miller@live.com; helo=EUR05-VI1-obe.outbound.protection.outlook.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, FREEMAIL_FROM=0.001, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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.23 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:275483 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: Arthur Miller >> Cc: larsi@gnus.org, emacs-devel@gnu.org, juri@linkov.net >> Date: Sat, 25 Sep 2021 19:08:05 +0200 >> >> >> > No, I'd prefer not to be shown a prompt for another key. >> >> >> >> Try the attached patch. >> > >> > ENOPATCH >> >> Oh, I am sorry :-) > > Thanks, but this still prompts for a key, just silently so. Yes, exactly, you said you were bothered by the prompt :-). Without seing the prompt it feels like you are just ordinary shortcut. At least for me. Anyway, I have tested with the prefix key, it does make for one difference: it shows me the panel for which-key which shows all completions, which read-key-sequence does not. In this case I had to hack those commands exported by help-mode as described before. Lars didn't like that, so you will have to agree on how to solve what is preferred here. For the note: is it acceptable to have this simplified customize? It works for me, but there is no checks for validity etc. I don't know how to write it so it take a valid prefix and so on. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Run-help-mode-commands-form-any-buffer.patch >From c70e38e9ff9678a7105f39a5efff7596d3452e2f Mon Sep 17 00:00:00 2001 From: Arthur Miller Date: Sat, 25 Sep 2021 22:06:53 +0200 Subject: [PATCH] Run help-mode commands form any buffer * help-mode.el (help-go-back): Addapted to call form any buufer. (help-go-forward): Addapted to call form any buufer. (help-view-source): Addapted to call form any buufer. (help-goto-info): Addapted to call form any buufer. (help-command-prefix): New map. (help-command-prefix-key): New customize option. Install help-do-command in global-map on C-h M-h key. --- lisp/help-mode.el | 80 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 57 insertions(+), 23 deletions(-) diff --git a/lisp/help-mode.el b/lisp/help-mode.el index 0b404fe89f..0d5a709d49 100644 --- a/lisp/help-mode.el +++ b/lisp/help-mode.el @@ -48,6 +48,23 @@ help-mode-map map) "Keymap for Help mode.") +(defvar help-command-prefix + (let ((map (define-prefix-command 'help-command-prefix))) + (define-key map "l" #'help-go-back) + (define-key map "r" #'help-go-forward) + (define-key map "\C-c\C-b" #'help-go-back) + (define-key map "\C-c\C-f" #'help-go-forward) + (define-key map [XF86Back] #'help-go-back) + (define-key map [XF86Forward] #'help-go-forward) + (define-key map "\C-c\C-c" #'help-follow-symbol) + (define-key map "s" #'help-view-source) + (define-key map "i" #'help-goto-info) + (define-key map "c" #'help-customize) + (fset 'help-command-prefix help-command-prefix) + (setq help-command-prefix help-command-prefix) + map) + "Keymap for Help command prefix.") + (easy-menu-define help-mode-menu help-mode-map "Menu for Help mode." '("Help-Mode" @@ -149,6 +166,12 @@ help-mode-hook "Hook run by `help-mode'." :type 'hook :group 'help) + +(defcustom help-command-prefix-key "C-h M-h" + "The key HELP-COMMAND-PREFIX is bound to in the global map." + :type 'string + :group 'help + :version "28.1") ;; Button types used by help @@ -402,7 +425,8 @@ help-mode-finish "Finalize Help mode setup in current buffer." (when (derived-mode-p 'help-mode) (setq buffer-read-only t) - (help-make-xrefs (current-buffer)))) + (help-make-xrefs (current-buffer)) + (set-window-dedicated-p (get-buffer-window (help-buffer)) t))) ;; Grokking cross-reference information in doc strings and ;; hyperlinking it. @@ -784,44 +808,54 @@ help-xref-go-forward (defun help-go-back () "Go back to previous topic in this help buffer." (interactive) - (if help-xref-stack - (help-xref-go-back (current-buffer)) - (user-error "No previous help buffer"))) + (when (get-buffer-window (help-buffer)) + (with-current-buffer (help-buffer) + (if help-xref-stack + (help-xref-go-back (current-buffer)) + (user-error "No previous help buffer"))))) (defun help-go-forward () "Go to the next topic in this help buffer." (interactive) - (if help-xref-forward-stack - (help-xref-go-forward (current-buffer)) - (user-error "No next help buffer"))) + (when (get-buffer-window (help-buffer)) + (with-current-buffer (help-buffer) + (if help-xref-forward-stack + (help-xref-go-forward (current-buffer)) + (user-error "No next help buffer"))))) (defun help-view-source () "View the source of the current help item." (interactive nil help-mode) - (unless (plist-get help-mode--current-data :file) - (error "Source file for the current help item is not defined")) - (help-function-def--button-function - (plist-get help-mode--current-data :symbol) - (plist-get help-mode--current-data :file) - (plist-get help-mode--current-data :type))) + (when (get-buffer-window (help-buffer)) + (with-current-buffer (help-buffer) + (unless (plist-get help-mode--current-data :file) + (error "Source file for the current help item is not defined")) + (help-function-def--button-function + (plist-get help-mode--current-data :symbol) + (plist-get help-mode--current-data :file) + (plist-get help-mode--current-data :type))))) (defun help-goto-info () "View the *info* node of the current help item." (interactive nil help-mode) - (unless help-mode--current-data - (error "No symbol to look up in the current buffer")) - (info-lookup-symbol (plist-get help-mode--current-data :symbol) - 'emacs-lisp-mode)) + (when (get-buffer-window (help-buffer)) + (with-current-buffer (help-buffer) + (unless help-mode--current-data + (error "No symbol to look up in the current buffer")) + (info-lookup-symbol (plist-get help-mode--current-data :symbol) + 'emacs-lisp-mode)))) (defun help-customize () "Customize variable or face whose doc string is shown in the current buffer." (interactive nil help-mode) - (let ((sym (plist-get help-mode--current-data :symbol))) - (unless (or (boundp sym) (facep sym)) - (user-error "No variable or face to customize")) - (cond - ((boundp sym) (customize-variable sym)) - ((facep sym) (customize-face sym))))) + (when (get-buffer-window (help-buffer)) + (with-current-buffer (help-buffer) + (let ((sym (plist-get help-mode--current-data :symbol))) + (unless (or (boundp sym) (facep sym)) + (user-error "No variable or face to customize")) + (cond + ((boundp sym) (customize-variable sym)) + ((facep sym) (customize-face sym))))))) (defun help-do-xref (_pos function args) "Call the help cross-reference function FUNCTION with args ARGS. -- 2.33.0 --=-=-=--