Merge pull request #1390 from Ambrevar/easy-accounts

mu4e: Easy accounts with make-mu4e-context-account
This commit is contained in:
Dirk-Jan C. Binnema
2019-04-17 22:59:30 +03:00
committed by GitHub
4 changed files with 223 additions and 6 deletions

View File

@ -742,6 +742,29 @@ after the end of the search results."
(mu4e~headers-defun-mark-for unread)
(mu4e~headers-defun-mark-for action)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar mu4e-move-to-trash-patterns '()
"List of regexps to match for moving to trash instead of flagging them.
This is particularly useful for mailboxes that don't use the
trash flag like Gmail. See `mu4e-headers-mark-or-move-to-trash'
and `mu4e-view-mark-or-move-to-trash'.")
(defun mu4e-headers-mark-or-move-to-trash ()
"Mark message for \"move\" to the trash folder if the message
maildir matches any regexp in `mu4e-move-to-trash-patterns'.
Otherwise mark with the \"trash\" flag.
Also see `mu4e-view-mark-or-move-to-trash'."
(interactive)
(let ((msg-dir (mu4e-message-field (mu4e-message-at-point) :maildir)))
(if (not (seq-filter (lambda (re)
(string-match re msg-dir))
mu4e-move-to-trash-patterns))
(mu4e-headers-mark-for-trash)
(mu4e-mark-set 'move (if (functionp mu4e-trash-folder)
(funcall mu4e-trash-folder (mu4e-message-at-point))
mu4e-trash-folder))
(mu4e-headers-next))))
;;; headers-mode and mode-map ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar mu4e-headers-mode-map nil
"Keymap for *mu4e-headers* buffers.")
@ -801,8 +824,8 @@ after the end of the search results."
(define-key map "y" 'mu4e-select-other-view)
;; marking/unmarking ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define-key map (kbd "<backspace>") 'mu4e-headers-mark-for-trash)
(define-key map (kbd "d") 'mu4e-headers-mark-for-trash)
(define-key map (kbd "<backspace>") 'mu4e-headers-mark-or-move-to-trash)
(define-key map (kbd "d") 'mu4e-headers-mark-or-move-to-trash)
(define-key map (kbd "<delete>") 'mu4e-headers-mark-for-delete)
(define-key map (kbd "<deletechar>") 'mu4e-headers-mark-for-delete)
(define-key map (kbd "D") 'mu4e-headers-mark-for-delete)