0

Background:

I read my email through mu4e in (Doom) emacs. I set up an org-capture template that stores a TODO with a link to the current email I'm viewing, all working great.

Typically I do this from the inbox email folder, and I like to keep that clean, so I refile emails to my "All email" folder when I'm done with it.

If I refile after I added the org-todo, then the contained link no longer works (points to where the email used to be).

I'd like to keep my email inbox empty when I already track the todo elsewhere.

My question:

Is there a way to refile a message in mu4e, and at the same time add an org-todo with a valid link to the email?

I imagine I could write a custom elisp function to do it, but I'm not too comfortable with elisp in particular. I don't expect a copy-paste complete solution, but any help or pointers would be much appreciated!

Config:

I'm using Doom emacs with very little additional config, with

(doom! 
   ;; ...
   ;; lots of unrelated modules
   ;; ...
       
   :email
   (mu4e +gmail))

The capture template I have looks as follows:

(setq org-capture-templates 
  '(("m" "Mail" entry (file+headline "~/org/gtd.org" "Tasks")
     "* TODO Mail: (%:fromname) %:subject\nSCHEDULED:%t\n:PROPERTIES:\n:CREATED: %U\n:END:\n %a" :immediate-finish t :prepend t))
1

As you can see in the manual, what you store is either a link to a particular message (from message-view) or the last know query to it (from headers view). I guess the latter, the query, is what gives you trouble.

To avoid that, with the minimum fuss you can, either:

  • Link from the message view.
  • Refile first, then link.

or with a little work, pack everything in your own command skipping capture interface.


Although this is what the 1.4.6 manual states, I'm using 1.4.10 and I'm getting the same behavior of linking to the message id no matter from where I capture, and it doesn't get affected by refiles, or so it seems in a quick test.

| 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.