From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#68236: [PATCH] help.el: allow help-quick to use local commands/quick-sections Date: Fri, 05 Jan 2024 10:40:02 +0200 Message-ID: <835y08w4v1.fsf@gnu.org> References: <1B0F351A-C393-4C1B-B883-814F2C33E802@gmail.com> <83a5ply2ca.fsf@gnu.org> <721ABC11-E691-43F9-9034-F375240C2E20@gmail.com> <83sf3dw699.fsf@gnu.org> <4CB34A88-87DE-4347-A886-4BF8D4998E67@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15337"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 68236@debbugs.gnu.org To: JD Smith , Stefan Kangas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jan 05 09:41:09 2024 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 1rLflM-0003nO-Rc for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 05 Jan 2024 09:41:08 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLflE-0005NZ-6A; Fri, 05 Jan 2024 03:41:00 -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 1rLflC-0005Lm-D6 for bug-gnu-emacs@gnu.org; Fri, 05 Jan 2024 03:40:58 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLflC-0007UX-4d for bug-gnu-emacs@gnu.org; Fri, 05 Jan 2024 03:40:58 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rLflF-0000c2-OJ for bug-gnu-emacs@gnu.org; Fri, 05 Jan 2024 03:41:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 05 Jan 2024 08:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68236 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 68236-submit@debbugs.gnu.org id=B68236.17044440372307 (code B ref 68236); Fri, 05 Jan 2024 08:41:01 +0000 Original-Received: (at 68236) by debbugs.gnu.org; 5 Jan 2024 08:40:37 +0000 Original-Received: from localhost ([127.0.0.1]:56341 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLfkr-0000b9-3a for submit@debbugs.gnu.org; Fri, 05 Jan 2024 03:40:37 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43598) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLfkl-0000al-E3 for 68236@debbugs.gnu.org; Fri, 05 Jan 2024 03:40:35 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLfkb-0007QP-QJ; Fri, 05 Jan 2024 03:40:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=zQvp67e1O6SybjSfzeuVAafwpNTbMUqC/jJL/Jmoraw=; b=Zu3tycmQZZvoQhQl31+z j7fKRpZr1bLQwUP/cJmYmpYLVFYoVNNB3cRe+ZbWrRexa3n7zZFyYejRtSbxLK7jnlTSPTv/puqLp OCptOezFx1bIKyGZ4BRDFp3/QhuRhC171Pk/DnpebtRDoC6zFhMdnRM/aHACyMpi6vUdBOu2soFib sFncyKn6ynkzMFcZhjFmLUsvE7/Nt9fDJQl97ubAj0Ri2hIZRakWbnFqNc1jU0VDcu1saXIcLvjxy sflnTGig2lDHEjp+IkB5ChDPnSycui+ctaR0C7Kt4D6MPDX/RkuQao+AowB2/1sA8EVtqYffS0Lvk eNVqeCtVhchZ0g==; In-Reply-To: <4CB34A88-87DE-4347-A886-4BF8D4998E67@gmail.com> (message from JD Smith on Thu, 4 Jan 2024 20:28:27 -0500) 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:277371 Archived-At: > From: JD Smith > Date: Thu, 4 Jan 2024 20:28:27 -0500 > Cc: 68236@debbugs.gnu.org > > > On Jan 4, 2024, at 8:57 AM, Eli Zaretskii wrote: > > > > If we are going to expose help-quick-sections as a defcustom, then I > > don't understand why we need to change the code at all. Is the idea > > that sections will depend on the current buffer? If so, then we just > > need to add an element to the list members which will store the > > major-mode for which the member is relevant. > > > > Or what am I missing? > > Right now the code does > > (with-current-buffer (get-buffer-create "*Quick Help*") > > right away, then checks `where-is-internal' for each listed command in `help-quick-sections'. So only global bindings (and bindings available in help-mode) are accessible for display. My patch simply delays switching to *Quick Help* buffer, so that binding information can be gathered from the local buffer from which quick help was summoned. Note that help-quick omits any bindings that are nil, as well as any empty sections. So adding sections to the defcustom that do not apply (=have no bindings) in some buffer is not a problem. Your proposal has the disadvantage that the user must switch to a buffer under some major mode to see the entries for that mode in the quick-help window. It could be an annoyance; e.g., consider a user who wants to see this while in a *Help* buffer. And I don't think being in the buffer under the major mode is the only way of getting mode-specific bindings; for example, where-is-internal can accept a KEYMAP argument, which will be used to find key bindings. Or maybe we should have a separate command for cheat sheets specific to a major mode. The window we pop up cannot be too large, so if the user only wants a quick help for the current mode, she might consider global bindings an annoying waste of screen estate. Moreover, the current quick help shows "popular commands", which are likely to be already known to some users, whereas when the user works in a major mode that is new to the user, one is likely to be in the need of the cheat sheet for that one mode. (Yes, we do already have "C-h b", but the output of that could be overwhelming: for example in an Org buffer I get almost 1400 lines in the *Help* buffer showing the Org-specific bindings.) IOW, if we want to consider mode-specific quick help, we should perhaps discuss more about the goals before we consider code tricks to implement it. Stefan, WDYT?