From 3c0df378a6f5c338566a5d478144bfa5aa05b0a3 Mon Sep 17 00:00:00 2001 From: TEC Date: Sat, 31 Oct 2020 19:04:29 +0800 Subject: [PATCH] Mu4e: rename msg refile func, customisable target --- modules/email/mu4e/autoload/email.el | 16 ++++++++++------ modules/email/mu4e/config.el | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/modules/email/mu4e/autoload/email.el b/modules/email/mu4e/autoload/email.el index e737ec994..410d85988 100644 --- a/modules/email/mu4e/autoload/email.el +++ b/modules/email/mu4e/autoload/email.el @@ -165,21 +165,25 @@ STR and any integer OFFSET." +mu4e-header-colorized-faces))) 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 ;; Perfect for when you see an email you want to reply to ;; later, but don't want to forget about ;;;###autoload -(defun +mu4e/refile-msg-to-agenda (arg) - "Refile a message and add a entry in the agenda file with a +(defun +mu4e/capture-msg-to-agenda (arg) + "Refile a message and add a entry in `+org-capture-emails-file' with a deadline. Default deadline is today. With one prefix, deadline is tomorrow. With two prefixes, select the deadline." (interactive "p") - (let ((file (car org-agenda-files)) - (sec "^* Email") - (msg (mu4e-message-at-point))) + (let ((sec "^* Email") + (msg (mu4e-message-at-point))) (when msg ;; 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 ;; find header section (goto-char (point-min)) diff --git a/modules/email/mu4e/config.el b/modules/email/mu4e/config.el index 79c6c9ecf..e4b21abd7 100644 --- a/modules/email/mu4e/config.el +++ b/modules/email/mu4e/config.el @@ -179,7 +179,7 @@ :ne "h" #'+workspace/other) (map! :map mu4e-headers-mode-map - :vne "l" #'+mu4e/refile-msg-to-agenda) + :vne "l" #'+mu4e/capture-msg-to-agenda) (map! :localleader :map mu4e-compose-mode-map