ADD mu4e spam folder

This commit is contained in:
Nathan Dwarshuis 2024-02-28 22:43:19 -05:00
parent 723955a12d
commit db5b994d9e
1 changed files with 31 additions and 2 deletions

View File

@ -3366,18 +3366,29 @@ Initialize by running =nd/mu-init=.
(use-package password-store (use-package password-store
:straight t) :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) (defun nd/make-mu4e-context (name dir addr smtp-srv sent-behavior)
(let* ((trash (format "/%s/trash" dir)) (let* ((trash (format "/%s/trash" dir))
(drafts (format "/%s/drafts" dir)) (drafts (format "/%s/drafts" dir))
(sent (format "/%s/sent" dir)) (sent (format "/%s/sent" dir))
(archive (format "/%s/archive" dir)) (archive (format "/%s/archive" dir))
(inbox (format "/%s/inbox" dir)) (inbox (format "/%s/inbox" dir))
(junk (format "/%s/junk" dir))
(shortcuts (--map (list :maildir (car it) :key (cdr it)) (shortcuts (--map (list :maildir (car it) :key (cdr it))
`((,trash . ?t) `((,trash . ?t)
(,drafts . ?d) (,drafts . ?d)
(,sent . ?s) (,sent . ?s)
(,archive . ?a) (,archive . ?a)
(,inbox . ?i)))) (,inbox . ?i)
(,junk . ?j))))
(mf (lambda (d msg) (mf (lambda (d msg)
(-some--> msg (-some--> msg
@ -3390,6 +3401,7 @@ Initialize by running =nd/mu-init=.
(mu4e-drafts-folder . ,drafts) (mu4e-drafts-folder . ,drafts)
(mu4e-sent-folder . ,sent) (mu4e-sent-folder . ,sent)
(mu4e-refile-folder . ,archive) (mu4e-refile-folder . ,archive)
(nd/mu4e-junk-folder . ,junk)
(mu4e-sent-messages-behavior . ,sent-behavior) (mu4e-sent-messages-behavior . ,sent-behavior)
(smtpmail-stream-type . starttls) (smtpmail-stream-type . starttls)
(smtpmail-smtp-server . ,smtp-srv) (smtpmail-smtp-server . ,smtp-srv)
@ -3403,6 +3415,20 @@ Initialize by running =nd/mu-init=.
`(,(regexp-quote mu4e-main-buffer-name) `(,(regexp-quote mu4e-main-buffer-name)
display-buffer-same-window)) 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 (setq mail-user-agent 'mu4e-user-agent
message-kill-buffer-on-exit t 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 ;; the old open attachment function broke in mu 1.6, fix it here
(nd/when-bin "mu" (nd/when-bin "mu"
(evil-define-key '(normal) mu4e-view-mode-map (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 #+end_src
** local ** 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). 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).