Automate standard replies

2021-03-21 Thread Francesco Ariis
Hello mutters,
how can I automate typing standard replies?

Example: say I want to type «lgtm» (top post) as a reply to a message,
as now I have to:
- press `r` (reply)
- press `i` (my editor is Vim)
- «lgtm»
- then  (exit insert mode)
- ZZ (exit/save file)
- finally `y` to send

Is there a way to one-button this? I thought about a macro,
but I suspect that wouldn’t work, since I am firing up an
editor.
Thanks in advance
—F


Re: Automate standard replies

2021-03-21 Thread Remco Rijnders
On Sun, Mar 21, 2021 at 12:15:23PM +0100, Francesco wrote in 
<2021032523.GA10364@extensa>:

Hello mutters,
   how can I automate typing standard replies?

Example: say I want to type «lgtm» (top post) as a reply to a message,
as now I have to:
- press `r` (reply)
- press `i` (my editor is Vim)
- «lgtm»
- then  (exit insert mode)
- ZZ (exit/save file)
- finally `y` to send

Is there a way to one-button this? I thought about a macro,
but I suspect that wouldn’t work, since I am firing up an
editor.


I can think of a few ways you can make a macro work for you:

1) In the macro, change the attribution to what you want to include at the top.
Edit your message as desired, proceed as normal (reset attribution).

2) In the macro, change the signature to what you want to include at the bottom.
Edit your message as desired, proceed as normal (reset signature).

3) In the macro, change your editor to a script (sed?) that mangles your message
as you want it. Reset the editor to vim.

There are probably other ways to do it too, but I hope this might get you going.

Kind regards,

Remco


Re: Automate standard replies

2021-03-21 Thread P. Mazart
Hi Francesco,

Francesco Ariis schrieb am 21.03.2021 12:15:23:
> Is there a way to one-button this? I thought about a macro,
> but I suspect that wouldn’t work, since I am firing up an
> editor.

You could do that with changing the editor then „editing“ then changing
the editor back to vim.

I do something similar with labeling a received email:
macro pager,index y "set editor=\"~/bin/editlabel 
append\"Nset 
editor=vim" "Append label"

(change editor, edit existing email on disk, sync-mailbox, set mail as new, 
change editor back to vim)

I guess you could what you want with vim/ex/sed/awk or else.

Also keep in mind that procmail may be able to automate this process
entirely.

Best Regards,
PM


Re: Automate standard replies

2021-03-21 Thread Cameron Simpson
On 21Mar2021 12:15, Francesco Ariis  wrote:
>how can I automate typing standard replies?
>
>Example: say I want to type «lgtm» (top post) as a reply to a message,
>as now I have to:
>- press `r` (reply)
>- press `i` (my editor is Vim)
>- «lgtm»
>- then  (exit insert mode)
>- ZZ (exit/save file)
>- finally `y` to send
>
>Is there a way to one-button this? I thought about a macro,
>but I suspect that wouldn’t work, since I am firing up an
>editor.
>Thanks in advance

If you're automating this, you don't want an editor do you?

Use  to send the raw message to a script of your own. Some 
random macros of my own:

#macro index,pager ,x "mailunpack -d ~/"
macro index,pager V "mail-open-attachments" "extract 
attachments to temp dir and open"
macro index,pager H "unhdr|a2urls|sort -u|less" "list URLs"

BTW, I've got "set autoedit=yes" and "set edit_headers=yes", drops you 
straight into an editor on reply etc.

Cheers,
Cameron Simpson