* mu4e: mark messages as flagged ('+') or unflagged ('-')

this maps to the the Maildir 'F' flag, which is a persistent mark on a
  message file; similar to the Gmail '*' marker
This commit is contained in:
djcb 2012-05-11 11:18:00 +03:00
parent a6f7f98f04
commit 192c5b12bc
4 changed files with 41 additions and 12 deletions

View File

@ -242,11 +242,13 @@ if provided, or at the end of the buffer otherwise."
(flags (plist-get msg :flags))
(line (cond
((member 'draft flags)
(propertize line 'face 'mu4e-draft-face 'draft t))
(propertize line 'face 'mu4e-draft-face))
((member 'trashed flags)
(propertize line 'face 'mu4e-trashed-face))
((member 'unread flags)
(propertize line 'face 'mu4e-unread-face))
((member 'flagged flags)
(propertize line 'face 'mu4e-flagged-face))
(t ;; else
(propertize line 'face 'mu4e-header-face)))))
@ -286,7 +288,8 @@ after the end of the search results."
(defun mu4e~headers-mark-unmark()(interactive)(mu4e-headers-mark-and-next 'unmark))
(defun mu4e~headers-mark-read()(interactive)(mu4e-headers-mark-and-next 'read))
(defun mu4e~headers-mark-unread()(interactive)(mu4e-headers-mark-and-next 'unread))
(defun mu4e~headers-mark-flag()(interactive)(mu4e-headers-mark-and-next 'flag))
(defun mu4e~headers-mark-unflag()(interactive)(mu4e-headers-mark-and-next 'unflag))
(setq mu4e-headers-mode-map
(let ((map (make-sparse-keymap)))
@ -335,7 +338,9 @@ after the end of the search results."
(define-key map (kbd "o") 'mu4e~headers-mark-unread)
(define-key map (kbd "r") 'mu4e~headers-mark-read)
(define-key map (kbd "u") 'mu4e~headers-mark-unmark)
(define-key map (kbd "+") 'mu4e~headers-mark-flag)
(define-key map (kbd "-") 'mu4e~headers-mark-unflag)
(define-key map "m" 'mu4e-headers-mark-for-move-and-next)
(define-key map "U" 'mu4e-mark-unmark-all)
@ -635,6 +640,8 @@ header."
("elete" ?D delete)
("unread" ?o unread)
("read" nil read)
("star" ?+ star)
("unstar" ?- unstar)
("unmark" nil unmark))))
(target
(when (eq mark 'move)

View File

@ -65,10 +65,6 @@ where
(defconst mu4e~mark-fringe-format (format "%%-%ds" mu4e~mark-fringe-len)
"Format string to set a mark and leave remaining space.")
(defun mu4e~mark-initialize ()
"Initialize the marks subsystem."
(make-local-variable 'mu4e~mark-map)
@ -94,6 +90,8 @@ The following marks are available, and the corresponding props:
`delete' n remove the message
`read' n mark the message as read
`unread' n mark the message as unread
`flag' n mark this message for flagging
`unflag' n mark this message for unflagging
`unmark' n unmark this message"
(interactive)
(let* ((docid (mu4e~headers-docid-at-point))
@ -104,6 +102,8 @@ The following marks are available, and the corresponding props:
('delete "D")
('unread "U")
('read "R")
('flag "+")
('unflag "-")
('unmark " ")
(t (error "Invalid mark %S" mark)))))
(unless docid (error "No message on this line"))
@ -194,6 +194,8 @@ If NO-CONFIRMATION is non-nil, don't ask user for confirmation."
(move (mu4e~proc-move docid target))
(read (mu4e~proc-move docid nil "+S-u-N"))
(unread (mu4e~proc-move docid nil "-S+u"))
(flag (mu4e~proc-move docid nil "+F-u-N"))
(unflag (mu4e~proc-move docid nil "-F"))
(trash
(unless mu4e-trash-folder
(error "`mu4e-trash-folder' not set"))

View File

@ -183,6 +183,11 @@ be sure it no longer matches)."
flag set)."
:group 'mu4e-faces)
(defface mu4e-flagged-face
'((t :inherit font-lock-builtin-face :bold t))
"Face for a flagged message header."
:group 'mu4e-faces)
(defface mu4e-header-face
'((t :inherit default))
"Face for a header without any special flags."

View File

@ -312,11 +312,11 @@ is nil, and otherwise open it."
(define-key map "s" 'mu4e-headers-search)
(define-key map "S" 'mu4e-view-headers-search-edit)
(define-key map "/" 'mu4e-view-headers-search-narrow)
(define-key map (kbd "<M-left>") 'mu4e-headers-query-prev)
(define-key map (kbd "<M-right>") 'mu4e-headers-query-next)
(define-key map "b" 'mu4e-headers-search-bookmark)
(define-key map "b" 'mu4e-headers-search-bookmark)
(define-key map "B" 'mu4e-headers-search-bookmark-edit)
(define-key map "%" 'mu4e-view-mark-pattern)
@ -371,6 +371,9 @@ is nil, and otherwise open it."
(define-key map "D" 'mu4e-view-mark-for-delete)
(define-key map "m" 'mu4e-view-mark-for-move)
(define-key map (kbd "+") 'mu4e-view-mark-flag)
(define-key map (kbd "-") 'mu4e-view-mark-unflag)
;; misc
(define-key map "w" 'mu4e-view-toggle-wrap-lines)
(define-key map "h" 'mu4e-view-toggle-hide-cited)
@ -430,13 +433,13 @@ is nil, and otherwise open it."
(define-key menumap [query-next] '("Next query" . mu4e-headers-query-next))
(define-key menumap [query-prev] '("Previous query" . mu4e-headers-query-prev))
(define-key menumap [query-prev] '("Previous query" . mu4e-headers-query-prev))
(define-key menumap [narrow-search] '("Narrow search" . mu4e-headers-search-narrow))
(define-key menumap [bookmark] '("Search bookmark" . mu4e-headers-search-bookmark))
(define-key menumap [jump] '("Jump to maildir" . mu4e~headers-jump-to-maildir))
(define-key menumap [refresh] '("Refresh" . mu4e-headers-rerun-search))
(define-key menumap [search] '("Search" . mu4e-headers-search))
(define-key menumap [sepa4] '("--"))
(define-key menumap [next] '("Next" . mu4e-view-headers-next))
@ -879,6 +882,18 @@ user that unmarking only works in the header list."
(mu4e~view-mark-set 'delete)
(mu4e-view-headers-next))
(defun mu4e-view-mark-flag ()
"Mark the current message for flagging."
(interactive)
(mu4e~view-mark-set 'flag)
(mu4e-view-headers-next))
(defun mu4e-view-mark-unflag ()
"Mark the current message for unflagging."
(interactive)
(mu4e~view-mark-set 'unflag)
(mu4e-view-headers-next))
(defun mu4e-view-marked-execute ()
"Execute the marks."
(interactive)