Mu4e: rename msg refile func, customisable target

This commit is contained in:
TEC 2020-10-31 19:04:29 +08:00
parent 16b4a31bf9
commit 3c0df378a6
No known key found for this signature in database
GPG key ID: 779591AFDB81F06C
2 changed files with 11 additions and 7 deletions

View file

@ -165,21 +165,25 @@ STR and any integer OFFSET."
+mu4e-header-colorized-faces))) +mu4e-header-colorized-faces)))
color)) color))
(defvar +org-capture-emails-file "todo.org"
"Default target for storing mu4e emails captured from within mu4e.
Requires a \"* Email\" heading be present in the file.")
;; Adding emails to the agenda ;; Adding emails to the agenda
;; Perfect for when you see an email you want to reply to ;; Perfect for when you see an email you want to reply to
;; later, but don't want to forget about ;; later, but don't want to forget about
;;;###autoload ;;;###autoload
(defun +mu4e/refile-msg-to-agenda (arg) (defun +mu4e/capture-msg-to-agenda (arg)
"Refile a message and add a entry in the agenda file with a "Refile a message and add a entry in `+org-capture-emails-file' with a
deadline. Default deadline is today. With one prefix, deadline deadline. Default deadline is today. With one prefix, deadline
is tomorrow. With two prefixes, select the deadline." is tomorrow. With two prefixes, select the deadline."
(interactive "p") (interactive "p")
(let ((file (car org-agenda-files)) (let ((sec "^* Email")
(sec "^* Email") (msg (mu4e-message-at-point)))
(msg (mu4e-message-at-point)))
(when msg (when msg
;; put the message in the agenda ;; put the message in the agenda
(with-current-buffer (find-file-noselect file) (with-current-buffer (find-file-noselect
(expand-file-name +org-capture-emails-file org-directory))
(save-excursion (save-excursion
;; find header section ;; find header section
(goto-char (point-min)) (goto-char (point-min))

View file

@ -179,7 +179,7 @@
:ne "h" #'+workspace/other) :ne "h" #'+workspace/other)
(map! :map mu4e-headers-mode-map (map! :map mu4e-headers-mode-map
:vne "l" #'+mu4e/refile-msg-to-agenda) :vne "l" #'+mu4e/capture-msg-to-agenda)
(map! :localleader (map! :localleader
:map mu4e-compose-mode-map :map mu4e-compose-mode-map