From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.devel,gmane.emacs.orgmode Subject: Re: [DISCUSSION] "quick-help" popup for org-columns (column view) Date: Sat, 06 Apr 2024 22:40:20 +0000 Message-ID: <87zfu6p12j.fsf@posteo.net> References: <87a5oayblv.fsf@gmail.com> <87jzlxro68.fsf@localhost> <87zfu6b4w3.fsf@gmail.com> 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="23988"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Ihor Radchenko , emacs-orgmode@gnu.org, emacs-devel@gnu.org, stefankangas@gmail.com, larsi@gnus.org, hmelman@gmail.com, eliz@gnu.org, info@protesilaos.com To: =?utf-8?Q?S=C5=82awomir?= Grochowski Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Apr 07 00:41:26 2024 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 1rtEiy-00065z-Gd for ged-emacs-devel@m.gmane-mx.org; Sun, 07 Apr 2024 00:41:24 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rtEi9-0001HE-RW; Sat, 06 Apr 2024 18:40:33 -0400 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 1rtEi6-0001Gl-OW for emacs-devel@gnu.org; Sat, 06 Apr 2024 18:40:30 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rtEi4-0007yo-7Z for emacs-devel@gnu.org; Sat, 06 Apr 2024 18:40:30 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 16517240105 for ; Sun, 7 Apr 2024 00:40:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1712443224; bh=35vtQvmEP2TJ24h7O/h5XL87str3PKw0cp2xHmb97ms=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: Content-Transfer-Encoding:From; b=fS0K/zrg2lbiCoQdwhusWILdrNC0m4RbQ5nH4DIRKHzbiNC1hU2pR5FaHsxqh8c+z 6hwpB1akNTN0IGi9Z6tkPZ0TLnMl6oZXS7NwOopV4HLiBRUNCN2URjVoHnLghj2/5t JBjKNPDBmlpgbzvhJjJhtXHc8ahOSbuKWe96AcpQ0E/YgFRyk7YQxAmHHp7hKNp53b 8bJ2nUT9y2ohLp8fdPRBviWGU5I0DL1VnH65unj1ksQ2VbeLerIoM1Xhgm7lBRbzxw qAIQsY/6lGFX2wZSGl6h434yZNCHvu+FQklZqzNxJJvMIeZIpuX/HOjy2GvaLkMzBY Ymw6Gtco1nOxw== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4VBr0P5wsBz9rxB; Sun, 7 Apr 2024 00:40:21 +0200 (CEST) In-Reply-To: <87zfu6b4w3.fsf@gmail.com> (=?utf-8?Q?=22S=C5=82awomir?= Grochowski"'s message of "Sat, 06 Apr 2024 22:41:32 +0200") X-Hashcash: 1:20:240406:yantar92@posteo.net::gpXnyzqO/pGmig53:AIX X-Hashcash: 1:20:240406:info@protesilaos.com::04vNJT5mc2444Jc5:1bUz X-Hashcash: 1:20:240406:larsi@gnus.org::w61J9jJTiFxKgaQg:1a8m X-Hashcash: 1:20:240406:slawomir.grochowski@gmail.com::HeAjo6QNf2QwmXJC:0IhW X-Hashcash: 1:20:240406:stefankangas@gmail.com::blLhD0Y5Qd9KzEif:0dRI X-Hashcash: 1:20:240406:emacs-devel@gnu.org::yxZ9RQ4RBg0FOEW+:2lQl X-Hashcash: 1:20:240406:eliz@gnu.org::nCrVyW6q1m4Xly+4:1pEN X-Hashcash: 1:20:240406:hmelman@gmail.com::amRX3W9YD9yQt64s:4G/Y X-Hashcash: 1:20:240406:emacs-orgmode@gnu.org::aMis5pAODQh8UKi/:8ZqP Received-SPF: pass client-ip=185.67.36.66; envelope-from=philipk@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:317579 gmane.emacs.orgmode:160900 Archived-At: S=C5=82awomir Grochowski writes: > Ihor Radchenko writes: > >> I see no downside supporting `help-quick' command in Org mode's column >> view. Generally, better integration with Emacs built-in functionality is >> welcome. > > Great. I'll be happy to take care of it. > > But first, we need to modify `help-quick' to be more reusable. > I tried to do it, but I'm not experienced in elisp. > I wanted to remove references to global variables, so I did a wrapper > function to pass arguments to `help-quick'. I understand it's not a lispy= way. > I would be grateful for your comment.=20 > > Patch in attachment. I have to admit that I am not entirely certain what the plan is, but I have a few concrete comments/questions on this patch > From 5f343fd15c53f5bc5e7515ef0cd3049b4e0ec388 Mon Sep 17 00:00:00 2001 > From: Slawomir Grochowski > Date: Sat, 6 Apr 2024 22:11:01 +0200 > Subject: [PATCH] lisp/help: make `help-quick-toggle' reusable for other > keymaps > > --- > lisp/help.el | 22 +++++++++++++--------- > 1 file changed, 13 insertions(+), 9 deletions(-) > > diff --git a/lisp/help.el b/lisp/help.el > index 1ef46e394f3..c32d1a2e943 100644 > --- a/lisp/help.el > +++ b/lisp/help.el > @@ -76,7 +76,7 @@ help-map > "C-n" #'view-emacs-news > "C-o" #'describe-distribution > "C-p" #'view-emacs-problems > - "C-q" #'help-quick-toggle > + "C-q" #'help-quick-toggle-wrapper > "C-s" #'search-forward-help-for-help > "C-t" #'view-emacs-todo > "C-w" #'describe-no-warranty > @@ -178,22 +178,22 @@ help-quick-sections > (declare-function prop-match-value "text-property-search" (match)) >=20=20 > ;; Inspired by a mg fork (https://github.com/troglobit/mg) > -(defun help-quick () > +(defun help-quick (name-for-buffer sections &optional keymap) > "Display a quick-help buffer showing popular commands and their bindin= gs. > The window showing quick-help can be toggled using \\[help-quick-toggle]. > You can click on a key binding shown in the quick-help buffer to display > the documentation of the command bound to that key sequence." > (interactive) > - (with-current-buffer (get-buffer-create "*Quick Help*") > + (with-current-buffer (get-buffer-create name-for-buffer) Is there a reason not to re-use the same buffer? I am not sure if we need multiple quick-help buffer to co-exist at the same time. > (let ((inhibit-read-only t) (padding 2) blocks) >=20=20 > ;; Go through every section and prepare a text-rectangle to be > ;; inserted later. > - (dolist (section help-quick-sections) > + (dolist (section sections) The idea here was that some other function could rebind `help-quick-sections' dynamically. That way you avoid the redundant arguments (which would all have to be documented). > (let ((max-key-len 0) (max-cmd-len 0) keys) > (dolist (ent (reverse (cdr section))) > (catch 'skip > - (let* ((bind (where-is-internal (car ent) nil t)) > + (let* ((bind (where-is-internal (car ent) keymap t)) > (key (if bind > (propertize > (key-description bind) > @@ -259,21 +259,25 @@ help-quick > (message > (substitute-command-keys "Toggle display of quick-help buffer using= \\[help-quick-toggle].")))) >=20=20 > -(defun help-quick-toggle () > +(defun help-quick-toggle-wrapper () The naming here is weird IMO, usually the other function should be called something like `help-quick-toggle-internal' and this would be `help-quick-toggle'. > + (interactive) > + (help-quick-toggle "*Quick Help*" help-quick-sections)) > + > +(defun help-quick-toggle (name-for-buffer sections &optional keymap) > "Toggle display of a window showing popular commands and their binding= s. > This toggles on and off the display of the quick-help buffer, which shows > popular commands and their bindings as produced by `help-quick'. > You can click on a key binding shown in the quick-help buffer to display > the documentation of the command bound to that key sequence." > (interactive) > - (if (and-let* ((window (get-buffer-window "*Quick Help*"))) > + (if (and-let* ((window (get-buffer-window name-for-buffer))) > (quit-window t window)) > ;; Clear the message we may have gotten from `C-h' and then > ;; waiting before hitting `q'. > (message "") > - (help-quick))) > + (help-quick name-for-buffer sections keymap))) >=20=20 > -(defalias 'cheat-sheet #'help-quick) > +(defalias 'cheat-sheet #'help-quick-wrapper) >=20=20 > (defun help-quit () > "Just exit from the Help command's command loop." > --=20 > 2.30.2 > > > > JD Smith writes:=20 > >> Also recall we had a discussion in bug#68236 >> >> about expanding quick-help to include mode-local >> personalized binding shortcuts (with org as a particular target of inter= est). > > Thank you for the link I haven't seen that topic. >=20=20 > Regards, --=20 Philip Kaludercic on icterid