0

I use Emacs and mu4e for email. I set up multiple accounts as in the manual. I also included this snippet from here to send deleted messages to a folder instead of deleting them permanently:

(add-to-list 'mu4e-marks
     '(trash
       :char ("d" . "▼")
       :prompt "dtrash"
       :dyn-target (lambda (target msg) (mu4e-get-trash-folder msg))
       :action (lambda (docid msg target) 
                 (mu4e~proc-move docid
                    (mu4e~mark-check-target target) "-N"))))

The problem is that all deleted messages are marked to go to the Trash of the main account instead of the Trash of their own account. Running help on key d shows:

d runs the command mu4e-headers-mark-or-move-to-trash (found in
mu4e-headers-mode-map), which is an interactive compiled Lisp function in
‘/usr/local/Cellar/mu/1.4.1/share/emacs/site-lisp/mu/mu4e/mu4e-headers.el’.

It is bound to d, .

(mu4e-headers-mark-or-move-to-trash)

which in turn shows:

mu4e-headers-mark-or-move-to-trash is an interactive compiled Lisp function in
‘/usr/local/Cellar/mu/1.4.1/share/emacs/site-lisp/mu/mu4e/mu4e-headers.el’.

It is bound to d, .

(mu4e-headers-mark-or-move-to-trash)

Mark message for "move" to the trash folder if the message
maildir matches any regexp in ‘mu4e-move-to-trash-patterns’.
Otherwise mark with the "trash" flag.
Also see ‘mu4e-view-mark-or-move-to-trash’.

The variable mu4e-move-to-trash-patterns is set to nil, and mu4e-view-mark-or-move-to-trash shows:

mu4e-view-mark-or-move-to-trash is an interactive compiled Lisp function in
‘/usr/local/Cellar/mu/1.4.1/share/emacs/site-lisp/mu/mu4e/mu4e-view.el’.

(mu4e-view-mark-or-move-to-trash &optional N)

See ‘mu4e-headers-mark-or-move-to-trash’.

How can I send each message to the trash of its own mailbox?

0

The answer was in that same tutorial with the use of contexts:

(setq mu4e-contexts
 `( ,(make-mu4e-context
     :name "Gmail"
     :match-func (lambda (msg) (when msg
       (string-prefix-p "/Gmail" (mu4e-message-field msg :maildir))))
     :vars '(
       (mu4e-trash-folder . "/Gmail/[Gmail].Trash")
       (mu4e-refile-folder . "/Gmail/[Gmail].Archive")
       ))
   ,(make-mu4e-context
     :name "Exchange"
     :match-func (lambda (msg) (when msg
       (string-prefix-p "/Exchange" (mu4e-message-field msg :maildir))))
     :vars '(
       (mu4e-trash-folder . "/Exchange/Deleted Items")
       (mu4e-refile-folder . exchange-mu4e-refile-folder)
       ))
   ))
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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