Capture email to the inbox

This commit is contained in:
Max Schlueter 2022-09-15 22:56:16 +02:00
parent b975c8c75c
commit 35fcc384cb

View File

@ -616,7 +616,39 @@ the inbox. Refile to any org-gtd incubate target (see manual)."
)))
email-name))
(setq +org-capture-emails-file (expand-file-name "gtd/projects.org" org-directory))
(setq +org-capture-emails-file (expand-file-name "newgtd/inbox.org" org-directory))
(after! mu4e
(map! :map mu4e-headers-mode-map
:vne "l" #'max/capture-msg-to-agenda))
(defun max/capture-msg-to-agenda (arg)
"Refile a message and add a entry in `+org-capture-emails-file'."
(interactive "p")
(let ((msg (mu4e-message-at-point)))
(when msg
;; put the message in the agenda
(with-current-buffer (find-file-noselect
(expand-file-name +org-capture-emails-file org-directory))
(save-excursion
(goto-char (point-max))
(outline-back-to-heading)
(org-insert-heading)
(let ((from (plist-get msg :from)))
(insert (concat "Reply to "
"[[mu4e:msgid:"
(plist-get msg :message-id) "]["
(truncate-string-to-width
(or (caar from) (cdar from)) 25 nil nil t)
" - "
(truncate-string-to-width
(plist-get msg :subject) 40 nil nil t)
"]]\n"
))
(org-time-stamp-inactive '(16)))))
(message "Refiled \"%s\""
(truncate-string-to-width
(plist-get msg :subject) 40 nil nil t)))))
(after! mu4e
(setq mu4e-maildir "~/Maildir")