I started using notmuch and I often use the trash tag to have emails sent to Maildir\mail-account-i\Trash through a script. When in search mode, I have to do +trash RET on a mail (or a set of mails) to add the trash tag to this(these) mail(s).

How could I tag mails with trash by pressing the delete key instead of +trash RET (I'm using use-package)?

1 Answer 1

(use-package notmuch
  (defun mda/add-trash-tag-search()               
    (if (member "trash" (notmuch-search-get-tags))
        (notmuch-search-tag (list "-trash"))      
      (notmuch-search-tag (list "+trash"))        
  (defun mda/add-trash-tag-show()                 
    (if (member "trash" (notmuch-show-get-tags))  
        (notmuch-show-tag (list "-trash"))        
      (notmuch-show-tag (list "+trash"))          

  (:map notmuch-search-mode-map                         
        ("<deletechar>" .  mda/add-trash-tag-search)    
  (:map notmuch-show-mode-map                           
        ("<deletechar>" .  mda/add-trash-tag-show)      

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.