Some time ago I wrote about my email capturing workflow. After I’ve written that text, I noticed that my command does not work well when launched in message mode (as opposed to the headers view mode). I tried to debug this problem, but to no avail.
Until yesterday. It just occurred to me that the problem may be the asynchronicity again. I applied the method from my previous post and voilà! It Just Works™ now.
I’m not really sure about the exact reason for that behavior (I would guess that it might be buried deeply in the mu4e~proc-move
function), but here’s the updated code.
(defun pause (count) "Pause for COUNT seconds (default one)" (interactive "p") (sleep-for count)) (defun mu4e-flag-message-at-point-now () "Flag the message at point immediately." (interactive) (let ((msg (mu4e-message-at-point))) (funcall (plist-get (cdr (assq 'flag mu4e-marks)) :action) (plist-get msg :docid) msg nil))) (defun make-this-message-into-an-org-todo-item () "Flag this message as important and capture it in Org-mode." (interactive) (mu4e-flag-message-at-point-now) (when (eq major-mode 'mu4e-view-mode) (pause 0.2)) (org-capture nil "t"))
Notice that sleep-for
(and hence pause
) accepts non-integer values (which is handy in this case – a second is a long time!).