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
: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).