Re: custom macro for "q" key
> On 2021-09-02 06:54, Jon LaBadie wrote: On Wed, Sep 01, 2021 at 08:04:29AM +0200, Fourhundred Thecat wrote: On 2021-08-30 14:28, li...@ifohancroft.com wrote: macro index,pager c "?" macro index q "?" bind browser q exit You are defining macros in the index and pager. Why the switch to bind instead of a macro for the browser? when I use macro, instead of bind, then "quit" does exist. macro browser q quit but when I press "q" in browser, I get: Macro loop detected. Here is the whole relevant block from muttrc: bind index,pagerc browse-mailboxes bindindex q browse-mailboxes bindpager q exit macro browser q quit
Re: custom macro for "q" key
On Wed, Sep 01, 2021 at 08:04:29AM +0200, Fourhundred Thecat wrote: On 2021-08-30 14:28, li...@ifohancroft.com wrote: ... macro index,pager c "?" macro indexq "?" bind browser q exit But it does not behave as I expected: Likely showing my mutt-ignorance here, but ... You are defining macros in the index and pager. Why the switch to bind instead of a macro for the browser? -- Jon H. LaBadie j...@labadie.us 11226 South Shore Rd. (703) 787-0688 (H) Reston, VA 20190 (703) 935-6720 (C)
Re: custom macro for "q" key
> On 2021-09-02 04:47, Fourhundred Thecat wrote: > On 2021-09-01 20:54, li...@ifohancroft.com wrote: And also, you suggested previously to use "exit", but this keyword does not seem to exist in my mutt (2.0.2). When I use this binding: bind browser q quit sorry, I meant to say: you suggested previously to use "quit", but this keyword does not seem to exist in my mutt
Re: custom macro for "q" key
> On 2021-09-01 20:54, li...@ifohancroft.com wrote: I understand what "index" and "pager" is. But what is the name when I am in the list of my folders? I think I need to bind q for exit, when I am in the list of my folders: bind q exit thank you, Unless I am wrong and there is more than one list of folders, its bind type is 'browser'. One way to check/confirm that is by pressing '?' while there and checking what the status line says. It should say something like: Help for . (35%) yes, the is called "browser" in my case also. But when I bind: bind browser q exit and use "q" in browser, it does not exit, but just cycles between browser and the folder where I came from. And also, you suggested previously to use "exit", but this keyword does not seem to exist in my mutt (2.0.2). When I use this binding: bind browser q quit .mutt/muttrc, line 80: quit: no such function in map So basically, now I just need to find pout, how to actually exit when I press "q" in browser. thank you,
Re: custom macro for "q" key
I understand what "index" and "pager" is. But what is the name when I am in the list of my folders? I think I need to bind q for exit, when I am in the list of my folders: bindq exit thank you, Unless I am wrong and there is more than one list of folders, its bind type is 'browser'. One way to check/confirm that is by pressing '?' while there and checking what the status line says. It should say something like: Help for . (35%) That is what you should use when binding. Chances are, its type is also index or pager as opposed to having a separate one. In which case your macro won't be possible.
Re: Automatic Key Search for email Sender?
On Wed, Sep 1, 2021 at 12:05 PM Jörg Sommer wrote: > D.J.J. Ring, Jr. schrieb am Di 31. Aug, 17:13 (-0400): > > Is there a way to get mutt to automatically search for a gpg key for an > > email sender and put it in my keychain? > > If you use Emacs, you can do it there. I've wrote a blogpost (in German) > about this. https://jo-so.de/2020-11/neomutt.html Maybe you can use a > translator (https://www.deepl.com/translator) to read the text. > > Kind regards > > Jörg > > Automatic email encryption for Neomutt with Emacs ✎ Email encryption has always been a bit unwieldy, because it was added to the email system as an extension only after many years, and it is often implemented by add-on programs. In Thunderbird, for example, this was the Enigmail extension, but since version 78, encryption has been integrated into Thunderbird. One problem is that you often don't even know that the other person offers a PGP key and you have to remember to enable encryption when you write. I myself use Neomutt as an email program and had written myself a program years ago that uses the send-hook intervention point to set crypt_autoencrypt. The system also worked quite reliably (but not always). Recently I discovered Web Key Directory (WKD) for PGP keys, which is much faster than querying a PGP key server. With gpg --locate-keys ... you can check availability based on local storage or by WKD; other sources can be set with --auto-key-locate local,wkd,keyserver, So my idea was to use Emacs to check key availability while writing the text. Roughly speaking, the flow is as follows: when opening the email (message-mode-hook) in Emacs to compose the text, I start querying the keys for the named recipients in the background. When saving (before-save-hook) the query has returned a result for all keys (exit code 0), the field Pgp: ES is inserted. This entry tells Neomutt to encrypt and sign the email. (add-hook 'message-mode-hook (lambda () (setq-local gpg-key-locate (let ((addrs (delq nil (mapcar (lambda (el) (when (string-match "[^ <]+@[^ >]+" el) (match-string 0 el))) (nconc (split-string (or (message-field-value "To") "") ",\s*") (split-string (or (message-field-value "Cc") "") ",\s*") ))) )) ;; Use to blacklist some addresses ;; (delete-if ;; (lambda (el) (find el '("f...@example.org") :test #'string=)) ;; addrs) (when addrs (start-process-shell-command "gpg-key-locate" nil (concat "gpg --locate-keys " (mapconcat 'shell-quote-argument addrs " ") ))) )) (add-hook 'before-save-hook (lambda () (when (and gpg-key-locate (string= "exit" (process-status gpg-key-locate)) (= 0 (process-exit-status gpg-key-locate))) (save-excursion (message-goto-eoh) (insert "Pgp: ES\n") (setq gpg-key-locate nil) ) )) t t) )) Use Emacs to autoencrypt emails Gpg offers the option to lookup a key in the local key storage or via Web Key Directory (WKD). The WKD lookup is pretty fast and could be done for every email. Hence, I'm using Emacs to do the lookup while I'm composing the message and if a key is available for all recipients, I add the header field Pgp: ES which tells neomutt to enable encryption. I'm also using trust-model tofu+pgp in gpg.conf to use the Trust on first use model to ease key verification. https://wiki.gnupg.org/WKD https://gnupg.org/ftp/people/neal/tofu.pdf Keywords: privacy Emacs PGP programming Source/Golem Copyright © 2017-2021 Jörg Sommer - Imprint & Privacy - Creative Commons License
Re: custom macro for "q" key
> On 2021-08-30 14:28, li...@ifohancroft.com wrote: Hi, You basically have to unbind q for index (perhaps also pager, depending on what you want) and create the same macro you already have for 'c', for 'q' as well. Then for 'browser' bind 'q' to to 'quit' again. So basically: bind index,pager c noop # Unbinding the key first, because the manual says that macros shouldn't be bound to keys that are already bound bind index,pager q noop # Same as above macro index,pager c "?" macro index,pager q "?" bind browser q quit Hi, I have used your suggestions, with some modifications (I had to use exit, instead of quit), but it does not behave as I expected: macro index,pager c "?" macro indexq "?" bind browser q exit But it does not behave as I expected: - When I start mutt, I land in index. When press "q", then I go to the list of folders (good: this is what I want). But, now (I am in list of folders), pressing "q" should exit mutt. Instead, it goes back to index. - When I am in pager, and press "q", then I go back to the underlying folder (good: this is what I want). When I press "q" one more time, then I go to the list of my folders (also what I want). But then if I pres "q" again, I go back to the folder where I cam from, instead of exiting mutt. I understand what "index" and "pager" is. But what is the name when I am in the list of my folders? I think I need to bind q for exit, when I am in the list of my folders: bindq exit thank you,