Binding `r` to refile and mark as read.

82 views
Skip to first unread message

Brandon Amos

unread,
Apr 18, 2017, 10:58:32 AM4/18/17
to mu-di...@googlegroups.com

I would like to bind `r` in `mu4e-headers` mode to refile and
mark a message as read at the same time so that I don't have to
have a message view open all the time.
I noticed that by default `mu4e-marks` sets the `refile` command
as the first element, so the current unstable hack I am using to
accomplish this is to overwrite this entry:


(setcar mu4e-marks
'(refile
:char ("r" . "▶")
:prompt "refile"
:dyn-target (lambda (target msg) (mu4e-get-refile-folder msg))
:action (lambda (docid msg target)
(progn
(mu4e~proc-move docid (mu4e~mark-check-target target) "-N")
(mu4e~proc-move docid nil "+S-u-N")))))


What's a better way to accomplish this?

-Brandon.

Brandon Amos

unread,
Apr 18, 2017, 11:28:13 AM4/18/17
to mu-discuss
Actually, the snippet I sent above is not doing what I want. I just found this snippet on github showing a more stable way of replacing this entry by removing it and adding a new one.


  ;; Refile will set mail to All Mail (basically archiving them). I want this to
  ;; auto-mark them as read, so I redefine refile to add the +S tag.
  (setq mu4e-marks (assq-delete-all 'refile mu4e-marks))
  (push '(refile :char ("r" . "▶")
                 :prompt "refile"
                 :dyn-target (lambda (target msg) (mu4e-get-refile-folder msg))
                 :action
                 (lambda (docid msg target)
                   (mu4e~proc-move docid (mu4e~mark-check-target target) "-u-N")))
        mu4e-marks)


This person seems to have the same use case as me. However with this updated version, my messages aren't being marked as unread with the `r` shortcut and it causes messages to be duplicated in the new folder. I've checked to make sure `mu4e-marks` is set as I expect. What is going on here?

-Brandon.
Reply all
Reply to author
Forward
0 new messages