From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id 4BlCANGzEWZI2QAAqHPOHw:P1 (envelope-from ) for ; Sat, 06 Apr 2024 22:42:57 +0200 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id 4BlCANGzEWZI2QAAqHPOHw (envelope-from ) for ; Sat, 06 Apr 2024 22:42:57 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="DXQ+/1y8"; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1712436176; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=ty3PXGh5HlW3VR5KVYWd9Q95/zjMrp3rzb8p+CFwDEU=; b=OkgfpL6GPkxGO+wR8fxwb5lG0RsbtcGaGeHqtEbMH752Wyh7e+xr6aO7W6Z2dgU0ASWPMc r7XUHZDQAXpmulpFBV7UA8AEUhhplLH1g+ynY7uOqz5IKLgCzl/1tjkaM2RL6Edtvj424I ciXnkTMIp2GBWXXlSTaUSLYBLEvdIZ6FTIzhXKHrtNXQOCF6ikLD6RHOkNGEIR7AeBFZoG u54gAyl5l+E4sCTiZ5/BUd66FOB8mNDILFTlizoqGSap/PuhRW8FkUX/An7AoNIEX1Bp1+ EvxGS9KIJU/w3d0/zHgi6JibWDqSl95/g2cxLjQ1581wpCiXV4VvEZMC57jrDg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1712436176; a=rsa-sha256; cv=none; b=Y4m5PiNlEKsFchNgNf6g+MYj86kqb/Zl9G7ADPzbLeC/DB/X9yzoqgpzKeBGZOy6lWy8qu TzhR62IaHC4UtqHP5SiNiIBtVe9AK3C1gJz/cSY/Adyq89UX4buHVfFQTeMql9XUNpgHHE L925DNko26P7adAP0rbKPJgMMZVJVNyucpG2Q+xrwyuiwxmhlCv3BVY6GOtGETRmBcc8Nv 4UNZ4jsJq0y+amQJ7Cl0QK0oSjczyMTBF/o8QW32+ORXDqhwK6BTpDvy5zuHmQsygf9Pq5 OAUUYX8Vz0dIQgCBJZ7CgQjqDSgPXBOTpNUzRtyR1FP5gYepHoMVtspn3HTCFw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="DXQ+/1y8"; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gmail.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 7E8701FDCF for ; Sat, 6 Apr 2024 22:42:56 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rtCrA-0001vw-4K; Sat, 06 Apr 2024 16:41:44 -0400 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 1rtCr8-0001vL-EF; Sat, 06 Apr 2024 16:41:42 -0400 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rtCr2-0003yb-Mq; Sat, 06 Apr 2024 16:41:42 -0400 Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-565c6cf4819so7541761a12.1; Sat, 06 Apr 2024 13:41:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712436094; x=1713040894; darn=gnu.org; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=ty3PXGh5HlW3VR5KVYWd9Q95/zjMrp3rzb8p+CFwDEU=; b=DXQ+/1y89h5BmGoiI1DsuFnYGsTIm0GtUiHY2trka9U8DKGPMKaCZfpcP3+c/WE5ei bYllndqy3jwOPTDhpVtn+3HasTeHgXNo5BuFm/LgvFkX+IKolRWhFnT8zyiktX5dHMhC 7tZsvbnLnMC3FRIj6153BCLngU7LfHGZirzKuX1uzBcabSRLRZm0d/C5RdH3JBgDnhDD OW0xFITj0pfc/Rrw8HEY0OWuSI6R0KctEvKsJ5Dn4SRRMxwuw3zJ7SZc43ixI0ssqHZi 1YGix/P17R6M+8KxXCuoCUP6yidDndf7meukwvrjwV2wBL/vfhQ9Te/uBdN3FJ4yENR2 0jjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712436094; x=1713040894; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ty3PXGh5HlW3VR5KVYWd9Q95/zjMrp3rzb8p+CFwDEU=; b=KyzFR5Kg3PFMDJG4wfiwcS0cADKKuRQJk9kJqnUIYTQ0sRh71YA1bGpBvpxfnl6w3j k60wOPIlx/B5CnGZnFLI9k/DyJWxYbA5eAo7oWtErWF+/mL+kqgl/3+0fFL2LOc14tne GTyFfl7O8AoAUNWXwBJLEQ3DqWvK1Vxx1Mm/rG1QCW3Vo+aNoPaBxZ0/8YlvHjY1OffB UWjEYRv15Yx21rV9BTAQfRMfTWPvyralkfBNfFNWqqdUAerjow9teGdr9DiLqjsqMXTe VFxSzTijAubp53T3BJY8/SJBUF0cslwg4YjO5vBGk5hEbmrtIa4wIEhRU3GOPjUqmAOY gYvQ== X-Forwarded-Encrypted: i=1; AJvYcCXsY8TvOAK7m0ORTAwxkuaoW4FBnFEjOOHbQCMLPlyv3fwNwpDAHerYd/L0GeDwpOyA/w9VNcATrzB08d9mdYVGv9Jdq9UdJvFtz/t8Tb1uORo= X-Gm-Message-State: AOJu0YxgwV171T1sEaLvWbuMechEQAiEHRKxVBywLzt/ug4npbO8mCJY +sz6ENQVStspX0EBGSp/2jwFWtspesASdqFrXvNv0biqRkAiypqFlmgQBcNddys= X-Google-Smtp-Source: AGHT+IFZdUtnCWnzcpHEw8yRmFpezuqdyvwiDBNlN4d1VBdecsIWYxtVRCqsnvxOPYbnuKZnaw0VVA== X-Received: by 2002:a50:8753:0:b0:56e:2dfb:da7b with SMTP id 19-20020a508753000000b0056e2dfbda7bmr4967383edv.0.1712436093801; Sat, 06 Apr 2024 13:41:33 -0700 (PDT) Received: from windows (83.6.111.246.ipv4.supernova.orange.pl. [83.6.111.246]) by smtp.gmail.com with ESMTPSA id dy26-20020a05640231fa00b0056dbd754811sm2227327edb.40.2024.04.06.13.41.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Apr 2024 13:41:33 -0700 (PDT) From: =?utf-8?Q?S=C5=82awomir?= Grochowski To: Ihor Radchenko Cc: emacs-orgmode@gnu.org, emacs-devel@gnu.org, philipk@posteo.net, stefankangas@gmail.com, larsi@gnus.org, hmelman@gmail.com, eliz@gnu.org, info@protesilaos.com Subject: Re: [DISCUSSION] "quick-help" popup for org-columns (column view) In-Reply-To: <87jzlxro68.fsf@localhost> References: <87a5oayblv.fsf@gmail.com> <87jzlxro68.fsf@localhost> Date: Sat, 06 Apr 2024 22:41:32 +0200 Message-ID: <87zfu6b4w3.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2a00:1450:4864:20::52d; envelope-from=slawomir.grochowski@gmail.com; helo=mail-ed1-x52d.google.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -9.66 X-Spam-Score: -9.66 X-Migadu-Queue-Id: 7E8701FDCF X-Migadu-Scanner: mx12.migadu.com X-TUID: 5MQdWMFhMeTI --=-=-= Content-Type: text/plain 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. Patch in attachment. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-lisp-help-make-help-quick-toggle-reusable-for-other-.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)) ;; 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 bindings. 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) (let ((inhibit-read-only t) (padding 2) blocks) ;; Go through every section and prepare a text-rectangle to be ;; inserted later. - (dolist (section help-quick-sections) + (dolist (section sections) (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].")))) -(defun help-quick-toggle () +(defun help-quick-toggle-wrapper () + (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 bindings. 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))) -(defalias 'cheat-sheet #'help-quick) +(defalias 'cheat-sheet #'help-quick-wrapper) (defun help-quit () "Just exit from the Help command's command loop." -- 2.30.2 --=-=-= Content-Type: text/plain JD Smith writes: > 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 interest). Thank you for the link I haven't seen that topic. Regards, -- Slawomir Grochowski --=-=-=--