[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: A different way to interactively pass options to commands
From: |
Doug Davis |
Subject: |
Re: A different way to interactively pass options to commands |
Date: |
Wed, 17 Feb 2021 20:16:18 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (darwin) |
Lars Ingebrigtsen <larsi@gnus.org> writes:
> Yes, it does sound quite attractive. For instance, in Gnus, when
> responding to a message, there's... I don't know how many commands.
> Let's see:
>
> S F gnus-summary-followup-with-original
> S L gnus-summary-reply-to-list-with-original
> S N gnus-summary-followup-to-mail-with-original
> S R gnus-summary-reply-with-original
> S V gnus-summary-very-wide-reply-with-original
> S W gnus-summary-wide-reply-with-original
> S f gnus-summary-followup
> S n gnus-summary-followup-to-mail
> S r gnus-summary-reply
> S v gnus-summary-very-wide-reply
> S w gnus-summary-wide-reply
> S B R gnus-summary-reply-broken-reply-to-with-original
> S B r gnus-summary-reply-broken-reply-to
>
> 13! Geez. Anyway, the interface you describe would fit this use case
> well, it seems to me: The choices are whether to include the original or
> not, and what subset of the To/Cc's to include in the set... Currently,
> users are probably tapping `S C-h' and then learn what the binding is,
> and then using that. And then forgetting until the next time.
>
> A Magit-like popup menu would probably be a much superior interface
> here, I think?
I think the menu of gnus-summary response functions can definitely
benefit from something like transient. Below is a proof-of-concept I
just used to call `gnus-summary-wide-reply-with-original' after binding
a new pop-up function to "." followed up by invoking the desired gnus
function with "-w", "-o", "r".
The total number of keystrokes is a bit more than "S W" but the
interface is indeed a welcome addition that would help with
discoverability of the (potentially many) actions, as Óscar mentioned,
if/when the actions and arguments grow. The flag arguments also make it
clear that "-w, --wide" and "-o, --original" are add-ons to the core
action.
I'm sure there's room for refinement; my transient use has been limited
to useless tinkering as a curious magit user, this is honestly the first
real use I've gotten out of writing transient-using code myself ;)
thanks for sparking the idea
#+begin_src emacs-lisp
;; package code:
(require 'transient)
(require 'gnus-sum)
(defun gp--reply-action (&optional args)
(interactive
(list (transient-args 'gnus-summary-popup)))
(let ((-v (member "--very" args))
(-w (member "--wide" args))
(-o (member "--original" args)))
(call-interactively
(cond ((and -v -w -o) 'gnus-summary-very-wide-reply-with-original)
((and -v -w) 'gnus-summary-very-wide-reply)
((and -w -o) 'gnus-summary-wide-reply-with-original)
(-w 'gnus-summary-wide-reply)
(-o 'gnus-summary-reply-with-original)
(t 'gnus-summary-reply)))))
(define-transient-command gnus-summary-popup ()
"Gnus reply popup"
["Arguments"
("-v" "very" "--very")
("-w" "wide" "--wide")
("-o" "original" "--original")]
["Actions"
("r" "Reply" gp--reply-action)])
(provide 'gnus-popup)
;; user code:
(require 'gnus-popup)
(define-key gnus-summary-mode-map (kbd ".") 'gnus-summary-popup)
#+end_src
- Re: A different way to interactively pass options to commands, (continued)
Re: A different way to interactively pass options to commands, Óscar Fuentes, 2021/02/17
Re: A different way to interactively pass options to commands, Lars Ingebrigtsen, 2021/02/17
Re: A different way to interactively pass options to commands, Óscar Fuentes, 2021/02/17
Re: A different way to interactively pass options to commands, Lars Ingebrigtsen, 2021/02/18
Re: A different way to interactively pass options to commands,
Doug Davis <=
Re: A different way to interactively pass options to commands, Lars Ingebrigtsen, 2021/02/18
Re: A different way to interactively pass options to commands, Kévin Le Gouguec, 2021/02/18
Re: A different way to interactively pass options to commands, Lars Ingebrigtsen, 2021/02/18
Re: A different way to interactively pass options to commands, Dmitry Gutov, 2021/02/18
Re: A different way to interactively pass options to commands, Stefan Kangas, 2021/02/18
Re: A different way to interactively pass options to commands, Dmitry Gutov, 2021/02/18
Re: A different way to interactively pass options to commands, Stefan Kangas, 2021/02/18
Re: A different way to interactively pass options to commands, Lars Ingebrigtsen, 2021/02/19
Re: A different way to interactively pass options to commands, Óscar Fuentes, 2021/02/18
Re: A different way to interactively pass options to commands, Stefan Monnier, 2021/02/18