emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Philip Kaludercic <philipk@posteo.net>
To: "Sławomir Grochowski" <slawomir.grochowski@gmail.com>
Cc: Eli Zaretskii <eliz@gnu.org>,
	 yantar92@posteo.net, emacs-orgmode@gnu.org,
	 emacs-devel@gnu.org,  stefankangas@gmail.com, larsi@gnus.org,
	 hmelman@gmail.com,  info@protesilaos.com
Subject: Re: [DISCUSSION] "quick-help" popup for org-columns (column view)
Date: Mon, 08 Apr 2024 08:24:20 +0000	[thread overview]
Message-ID: <87plv02rez.fsf@posteo.net> (raw)
In-Reply-To: <87frvwl2wv.fsf@gmail.com> ("Sławomir Grochowski"'s message of "Mon, 08 Apr 2024 09:38:40 +0200")

Sławomir Grochowski <slawomir.grochowski@gmail.com> writes:

> chad <yandros@gmail.com> writes:
>
>> If you don't mind me asking:
>
> Thank you for sharing your views. 
>
>> What are your high-level goals and immediate needs for changing
>> help-quick?
>
> I want to reuse quick-help for functionality in org-mode - column view
> package. See first email in this thread - there is even a screenshot.
>
>> It looks like you may be trying to have multiple
>> simultaneous quick-help buffers active at once?
>
> Philip Kaludercic <philipk@posteo.net> writes:
>
>> 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.
>
> Yes you are right. There is no need to create multiple quick-help
> buffers. 
>
>> 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).
>
> Is this really a good practice?

It certainly is practice.

> Relying on global variables instead of passing variables as a parameters?

A lot of Emacs Lisp code uses dynamic scope.  Examples include
`default-directory' or a lot of search functionality.

> I tried like this:
>
> +(defun org-columns-help-quick-toggle ()
> +  (interactive)
> +  (let ((help-quick-sections org-columns-help-quick-sections))
> +    (help-quick-toggle)))
>
> So passing a 'sections' data works.
> But it doesn't read keymaps from `org-columns-map'.
> Because as I understand it read keymaps available only in the created buffer
> "*Quick Help*" not from the buffer with org-colview.
>
> This is the line from function: `help-quick' where it happens:
> + (let* ((bind (where-is-internal (car ent) nil t))
> Signature:
> (where-is-internal DEFINITION &optional KEYMAP FIRSTONLY NOINDIRECT NO-REMAP)
>
> So previously I was passing a keymap `org-columns-map' to function 'where-is-internal'.
>
> Eli Zaretskii <eliz@gnu.org> writes:
>> In any case, we cannot change the signature of help-quick, since it's a
>> public function.
>
> If I can't modify the function `help-quick' how can I make it work?

We could add a `help-quick-use-map' variable and bind it to `global-map'
by default.  You can then re-bind it in your command.

> I'm attaching the whole patch:
>
> From dcc5172c87f9f7acfc9ab3a72f7de8b363a05447 Mon Sep 17 00:00:00 2001
> From: Slawomir Grochowski <slawomir.grochowski@gmail.com>
> Date: Sun, 7 Apr 2024 01:13:27 +0200
> Subject: [PATCH] lisp/org-colview.el: add help-quick sections for org-colview
>
> ---
>  lisp/org-colview.el | 41 +++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 41 insertions(+)
>
> diff --git a/lisp/org-colview.el b/lisp/org-colview.el
> index d71c84a76..547f50df8 100644
> --- a/lisp/org-colview.el
> +++ b/lisp/org-colview.el
> @@ -169,6 +169,7 @@ See `org-columns-summary-types' for details.")
>    (org-cycle-overview)
>    (org-cycle-content))
>  
> +(org-defkey org-columns-map "?"        #'org-columns-help-quick-toggle)
>  (org-defkey org-columns-map "c"        #'org-columns-content)
>  (org-defkey org-columns-map "o"        #'org-overview)
>  (org-defkey org-columns-map "e"        #'org-columns-edit-value)
> @@ -231,6 +232,46 @@ See `org-columns-summary-types' for details.")
>      "--"
>      ["Quit" org-columns-quit t]))
>  
> +(defvar org-columns-help-quick-sections
> +  '(("Move"
> +     (org-columns-move-up . "up")
> +     (org-columns-move-down . "down")
> +     (org-columns-move-cursor-left . "left")
> +     (org-columns-move-cursor-right . "right"))
> +    ("Move column & row"
> +     (org-columns-move-row-up . "move row up")
> +     (org-columns-move-row-down . "move row down")
> +     (org-columns-move-left . "move column left")
> +     (org-columns-move-right . "move column right"))
> +    ("Add & delete column"
> +     (org-columns-new . "add column")
> +     (org-columns-delete . "delete column"))
> +    ("Edit column"
> +     (org-columns-narrow . "narrow")
> +     (org-columns-widen . "widen")
> +     (org-columns-edit-attributes . "attributes"))
> +    ("Edit values"
> +     (org-columns-edit-value . "edit value")
> +     (org-columns-edit-allowed . "edit allowed value")
> +     (org-columns-next-allowed-value . "next allowed value")
> +     (org-columns-previous-allowed-value . "previous allowed value")
> +     (org-columns-toggle-or-columns-quit . "toggle checkbox or quit")
> +     (org-columns-todo . "change TODO state"))
> +    ("View"
> +     (org-columns-content . "show content")
> +     (org-overview . "show overview")
> +     (org-columns-show-value . "show value"))
> +    ("Misc."
> +     (org-columns-open-link . "open link")
> +     (org-columns-redo . "redo")
> +     (org-columns-help-quick-toggle . "toggle this help")
> +     (org-columns-quit . "quit"))))
> +
> +(defun org-columns-help-quick-toggle ()
> +  (interactive)
> +  (let ((help-quick-sections org-columns-help-quick-sections))
> +    (help-quick-toggle)))
> +
>  (defun org-columns--displayed-value (spec value &optional no-star)
>    "Return displayed value for specification SPEC in current entry.
>  
> -- 
> 2.30.2
>
>
> Regards,

-- 
	Philip Kaludercic on peregrine


  reply	other threads:[~2024-04-08  8:25 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-08 19:55 [DISCUSSION] "quick-help" popup for org-columns (column view) Sławomir Grochowski
2024-02-08 22:16 ` Adam Porter
2024-02-08 23:01   ` Stefan Kangas
2024-02-09 23:02     ` Ihor Radchenko
2024-02-10 15:44       ` Philip Kaludercic
2024-02-10 18:04         ` [External] : " Drew Adams
2024-03-20 23:15     ` JD Smith
2024-03-20 14:08 ` Ihor Radchenko
2024-04-06 20:41   ` Sławomir Grochowski
2024-04-06 22:08     ` chad
2024-04-06 22:40     ` Philip Kaludercic
2024-04-07  5:57     ` Eli Zaretskii
2024-04-08  7:38       ` Sławomir Grochowski
2024-04-08  8:24         ` Philip Kaludercic [this message]
2024-04-08 19:13           ` Sławomir Grochowski
2024-04-10  8:26             ` Philip Kaludercic
2024-04-10 20:42               ` Sławomir Grochowski
2024-04-11  6:37                 ` Philip Kaludercic
2024-04-11  6:58                   ` Philip Kaludercic
2024-04-11  8:43                     ` Sławomir Grochowski
2024-04-13  8:37                   ` Philip Kaludercic
2024-04-15 12:39                     ` Sławomir Grochowski
2024-04-16  7:24                       ` Philip Kaludercic
2024-04-18 20:55                         ` Sławomir Grochowski
2024-05-02 18:04                           ` Sławomir Grochowski
2024-04-08 11:46         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87plv02rez.fsf@posteo.net \
    --to=philipk@posteo.net \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=hmelman@gmail.com \
    --cc=info@protesilaos.com \
    --cc=larsi@gnus.org \
    --cc=slawomir.grochowski@gmail.com \
    --cc=stefankangas@gmail.com \
    --cc=yantar92@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).