From db5b994d9e5d64b40ebfbb1b8e23c3a1303ef290 Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Wed, 28 Feb 2024 22:43:19 -0500 Subject: [PATCH] ADD mu4e spam folder --- etc/conf.org | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/etc/conf.org b/etc/conf.org index 12d5457..bc54e9d 100644 --- a/etc/conf.org +++ b/etc/conf.org @@ -3366,18 +3366,29 @@ Initialize by running =nd/mu-init=. (use-package password-store :straight t) + (defun nd/mu4e-junk-folder (msg) + (->> (mu4e-context-determine msg nil) + (mu4e-context-vars) + (alist-get 'nd/mu4e-junk-folder))) + + (defun nd/mu4e-headers-mark-for-junk () + (interactive) + (mu4e-headers-mark-and-next 'junk)) + (defun nd/make-mu4e-context (name dir addr smtp-srv sent-behavior) (let* ((trash (format "/%s/trash" dir)) (drafts (format "/%s/drafts" dir)) (sent (format "/%s/sent" dir)) (archive (format "/%s/archive" dir)) (inbox (format "/%s/inbox" dir)) + (junk (format "/%s/junk" dir)) (shortcuts (--map (list :maildir (car it) :key (cdr it)) `((,trash . ?t) (,drafts . ?d) (,sent . ?s) (,archive . ?a) - (,inbox . ?i)))) + (,inbox . ?i) + (,junk . ?j)))) (mf (lambda (d msg) (-some--> msg @@ -3390,6 +3401,7 @@ Initialize by running =nd/mu-init=. (mu4e-drafts-folder . ,drafts) (mu4e-sent-folder . ,sent) (mu4e-refile-folder . ,archive) + (nd/mu4e-junk-folder . ,junk) (mu4e-sent-messages-behavior . ,sent-behavior) (smtpmail-stream-type . starttls) (smtpmail-smtp-server . ,smtp-srv) @@ -3403,6 +3415,20 @@ Initialize by running =nd/mu-init=. `(,(regexp-quote mu4e-main-buffer-name) display-buffer-same-window)) + (add-to-list + 'mu4e-marks + '(junk :char "j" + :prompt "junk" + :dyn-target + (lambda (target msg) (nd/mu4e-junk-folder msg)) + :action + (lambda + (docid msg target) + (mu4e--server-move docid + (mu4e--mark-check-target target) + "-N")))) + + (setq mail-user-agent 'mu4e-user-agent message-kill-buffer-on-exit t @@ -4076,7 +4102,10 @@ Since I use vi mode in my terminal emulator, need to preserve the escape key's r ;; the old open attachment function broke in mu 1.6, fix it here (nd/when-bin "mu" (evil-define-key '(normal) mu4e-view-mode-map - "p" 'mu4e-view-mime-part-action)) + "p" #'mu4e-view-mime-part-action) + + (evil-define-key '(normal) mu4e-headers-mode-map + "." #'nd/mu4e-headers-mark-for-junk)) #+end_src ** local These are for mode-specific bindings that can/should be outside of the evil maps above (there are not many, and these may be merged with their evil bretheren in the future).