mu4e: cosmetics

This commit is contained in:
djcb 2016-06-08 19:25:52 +03:00
parent e977309de5
commit ed16684f45
4 changed files with 40 additions and 34 deletions

View File

@ -276,7 +276,7 @@ appear on disk."
;; our contacts are already sorted - just need to tell the ;; our contacts are already sorted - just need to tell the
;; completion machinery not to try to undo that... ;; completion machinery not to try to undo that...
'(metadata '(metadata
(display-sort-function . mu4e~sort-contacts-for-completion) (display-sort-function . mu4e~sort-contacts-for-completion)
(cycle-sort-function . mu4e~sort-contacts-for-completion))))) (cycle-sort-function . mu4e~sort-contacts-for-completion)))))
(defun mu4e~compose-complete-contact (&optional start) (defun mu4e~compose-complete-contact (&optional start)
@ -502,7 +502,7 @@ tempfile)."
(mu4e~compose-set-friendly-buffer-name compose-type) (mu4e~compose-set-friendly-buffer-name compose-type)
(set-buffer-modified-p nil) (set-buffer-modified-p nil)
;; now jump to some useful positions, and start writing that mail! ;; now jump to some useful positions, and start writing that mail!
(if (member compose-type '(new forward)) (if (member compose-type '(new forward))
(message-goto-to) (message-goto-to)
(message-goto-body)) (message-goto-body))
@ -512,7 +512,7 @@ tempfile)."
;; remember the compose-type ;; remember the compose-type
(set (make-local-variable 'mu4e~compose-type) compose-type) (set (make-local-variable 'mu4e~compose-type) compose-type)
(put 'mu4e~compose-type 'permanent-local t) (put 'mu4e~compose-type 'permanent-local t)
;; hide some headers ;; hide some headers
(mu4e~compose-hide-headers) (mu4e~compose-hide-headers)
;; switch on the mode ;; switch on the mode

View File

@ -215,7 +215,7 @@ Field must be a symbol, one of: :date, :subject, :size, :prio,
(defvar mu4e-headers-default-prefix '("|" . "") "Default.") (defvar mu4e-headers-default-prefix '("|" . "") "Default.")
(defvar mu4e-headers-actions (defvar mu4e-headers-actions
'( ("capture message" . mu4e-action-capture-message) '( ("capture message" . mu4e-action-capture-message)
("show this thread" . mu4e-action-show-thread)) ("show this thread" . mu4e-action-show-thread))
"List of actions to perform on messages in the headers list. "List of actions to perform on messages in the headers list.
The actions are of the form (NAME SHORTCUT FUNC) where: The actions are of the form (NAME SHORTCUT FUNC) where:
@ -320,13 +320,13 @@ headers."
(when (mu4e-mark-docid-marked-p docid) (when (mu4e-mark-docid-marked-p docid)
(mu4e-mark-set 'unmark)) (mu4e-mark-set 'unmark))
;; re-use the thread info from the old one; this is needed because ;; re-use the thread info from the old one; this is needed because
;; *update* messages don't have thread info by themselves (unlike ;; *update* messages don't have thread info by themselves (unlike
;; search results) ;; search results)
;; since we still have the search results, re-use ;; since we still have the search results, re-use
;; those ;; those
(plist-put msg :thread (plist-put msg :thread
(mu4e~headers-field-for-docid docid :thread)) (mu4e~headers-field-for-docid docid :thread))
;; first, remove the old one (otherwise, we'd have two headers with ;; first, remove the old one (otherwise, we'd have two headers with
;; the same docid... ;; the same docid...
@ -340,8 +340,8 @@ headers."
;; now, if this update was about *moving* a message, we don't show it ;; now, if this update was about *moving* a message, we don't show it
;; anymore (of course, we cannot be sure if the message really no ;; anymore (of course, we cannot be sure if the message really no
;; longer matches the query, but this seem a good heuristic. ;; longer matches the query, but this seem a good heuristic. if it
;; if it was only a flag-change, show the message with its updated flags. ;; was only a flag-change, show the message with its updated flags.
(unless is-move (unless is-move
(mu4e~headers-header-handler msg point)) (mu4e~headers-header-handler msg point))
@ -382,7 +382,7 @@ into a string."
(let ((name (car ct)) (email (cdr ct))) (let ((name (car ct)) (email (cdr ct)))
(or name email "?"))) contacts ", ")) (or name email "?"))) contacts ", "))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defsubst mu4e~headers-thread-prefix (thread) (defsubst mu4e~headers-thread-prefix (thread)
"Calculate the thread prefix based on thread info THREAD." "Calculate the thread prefix based on thread info THREAD."
(when thread (when thread
@ -430,7 +430,7 @@ while our display may be different)."
('signed (funcall get-prefix mu4e-headers-signed-mark)) ('signed (funcall get-prefix mu4e-headers-signed-mark))
('unread (funcall get-prefix mu4e-headers-unread-mark))))))) ('unread (funcall get-prefix mu4e-headers-unread-mark)))))))
str)) str))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defconst mu4e-headers-from-or-to-prefix '("" . "To ") (defconst mu4e-headers-from-or-to-prefix '("" . "To ")
@ -493,7 +493,8 @@ found."
(let* ((item (or (assoc field mu4e-header-info-custom) (let* ((item (or (assoc field mu4e-header-info-custom)
(mu4e-error "field %S not found" field))) (mu4e-error "field %S not found" field)))
(func (or (plist-get (cdr-safe item) :function) (func (or (plist-get (cdr-safe item) :function)
(mu4e-error "no :function defined for field %S %S" field (cdr item))))) (mu4e-error "no :function defined for field %S %S"
field (cdr item)))))
(funcall func msg))) (funcall func msg)))
(defun mu4e~headers-field-apply-basic-properties (msg field val width) (defun mu4e~headers-field-apply-basic-properties (msg field val width)
@ -680,7 +681,7 @@ after the end of the search results."
(define-key map (kbd "[") 'mu4e-headers-prev-unread) (define-key map (kbd "[") 'mu4e-headers-prev-unread)
(define-key map (kbd "]") 'mu4e-headers-next-unread) (define-key map (kbd "]") 'mu4e-headers-next-unread)
;; change the number of headers ;; change the number of headers
(define-key map (kbd "C-+") 'mu4e-headers-split-view-grow) (define-key map (kbd "C-+") 'mu4e-headers-split-view-grow)
(define-key map (kbd "C--") 'mu4e-headers-split-view-shrink) (define-key map (kbd "C--") 'mu4e-headers-split-view-shrink)
@ -688,7 +689,7 @@ after the end of the search results."
(define-key map (kbd "<C-kp-subtract>") 'mu4e-headers-split-view-shrink) (define-key map (kbd "<C-kp-subtract>") 'mu4e-headers-split-view-shrink)
(define-key map ";" 'mu4e-context-switch) (define-key map ";" 'mu4e-context-switch)
;; switching to view mode (if it's visible) ;; switching to view mode (if it's visible)
(define-key map "y" 'mu4e-select-other-view) (define-key map "y" 'mu4e-select-other-view)
@ -749,20 +750,24 @@ after the end of the search results."
(define-key menumap [sepa0] '("--")) (define-key menumap [sepa0] '("--"))
(define-key menumap [toggle-include-related] (define-key menumap [toggle-include-related]
'(menu-item "Toggle related messages" mu4e-headers-toggle-include-related '(menu-item "Toggle related messages"
:button (:toggle . (and (boundp 'mu4e-headers-include-related) mu4e-headers-toggle-include-related
mu4e-headers-include-related)))) :button (:toggle .
(and (boundp 'mu4e-headers-include-related)
mu4e-headers-include-related))))
(define-key menumap [toggle-threading] (define-key menumap [toggle-threading]
'(menu-item "Toggle threading" mu4e-headers-toggle-threading '(menu-item "Toggle threading" mu4e-headers-toggle-threading
:button (:toggle . (and (boundp 'mu4e-headers-show-threads) :button (:toggle .
mu4e-headers-show-threads)))) (and (boundp 'mu4e-headers-show-threads)
mu4e-headers-show-threads))))
(define-key menumap [sepa1] '("--")) (define-key menumap [sepa1] '("--"))
(define-key menumap [execute-marks] '("Execute marks" (define-key menumap [execute-marks] '("Execute marks"
. mu4e-mark-execute-all)) . mu4e-mark-execute-all))
(define-key menumap [unmark-all] '("Unmark all" . mu4e-mark-unmark-all)) (define-key menumap [unmark-all] '("Unmark all" . mu4e-mark-unmark-all))
(define-key menumap [unmark] '("Unmark" . mu4e-headers-mark-for-unmark)) (define-key menumap [unmark]
'("Unmark" . mu4e-headers-mark-for-unmark))
(define-key menumap [mark-pattern] '("Mark pattern" . (define-key menumap [mark-pattern] '("Mark pattern" .
mu4e-headers-mark-pattern)) mu4e-headers-mark-pattern))
@ -784,11 +789,12 @@ after the end of the search results."
(define-key menumap [forward] '("Forward" . mu4e-compose-forward)) (define-key menumap [forward] '("Forward" . mu4e-compose-forward))
(define-key menumap [reply] '("Reply" . mu4e-compose-reply)) (define-key menumap [reply] '("Reply" . mu4e-compose-reply))
(define-key menumap [compose-new] '("Compose new" . mu4e-compose-new)) (define-key menumap [compose-new] '("Compose new" . mu4e-compose-new))
(define-key menumap [sepa3] '("--")) (define-key menumap [sepa3] '("--"))
(define-key menumap [query-next] '("Next query" . mu4e-headers-query-next)) (define-key menumap [query-next]
'("Next query" . mu4e-headers-query-next))
(define-key menumap [query-prev] '("Previous query" . (define-key menumap [query-prev] '("Previous query" .
mu4e-headers-query-prev)) mu4e-headers-query-prev))
(define-key menumap [narrow-search] '("Narrow search" . (define-key menumap [narrow-search] '("Narrow search" .
@ -980,7 +986,7 @@ message plist, or nil if not found."
(let ((this-msgid (mu4e-message-field msg :message-id))) (let ((this-msgid (mu4e-message-field msg :message-id)))
(when (and this-msgid (string= msgid this-msgid)) (when (and this-msgid (string= msgid this-msgid))
msg))))) msg)))))
;;;; markers mark headers for ;;;; markers mark headers for
(defun mu4e~headers-mark (docid mark) (defun mu4e~headers-mark (docid mark)
"(Visually) mark the header for DOCID with character MARK." "(Visually) mark the header for DOCID with character MARK."
@ -1063,7 +1069,7 @@ the query history stack."
'face 'mu4e-modeline-face) 'face 'mu4e-modeline-face)
" " " "
(mu4e-context-label))))) (mu4e-context-label)))))
(switch-to-buffer buf) (switch-to-buffer buf)
(run-hook-with-args 'mu4e-headers-search-hook expr) (run-hook-with-args 'mu4e-headers-search-hook expr)
(mu4e~proc-find (mu4e~proc-find
@ -1230,7 +1236,7 @@ descendants."
(last-marked-point)) (last-marked-point))
(mu4e-headers-for-each (mu4e-headers-for-each
(lambda (mymsg) (lambda (mymsg)
(let ((my-thread-id (mu4e~headers-get-thread-info mymsg 'thread-id))) (let ((my-thread-id (mu4e~headers-get-thread-info mymsg 'thread-id)))
(if subthread (if subthread
;; subthread matching; mymsg's thread path should have path as its ;; subthread matching; mymsg's thread path should have path as its
;; prefix ;; prefix
@ -1376,8 +1382,8 @@ the last search expression. Note that you can go back to previous
query (effectively, 'widen' it), with `mu4e-headers-query-prev'." query (effectively, 'widen' it), with `mu4e-headers-query-prev'."
(interactive (interactive
(let ((filter (let ((filter
(read-string (mu4e-format "Narrow down to: ") (read-string (mu4e-format "Narrow down to: ")
nil 'mu4e~headers-search-hist nil t))) nil 'mu4e~headers-search-hist nil t)))
(list filter))) (list filter)))
(unless mu4e~headers-last-query (unless mu4e~headers-last-query
(mu4e-warn "There's nothing to filter")) (mu4e-warn "There's nothing to filter"))
@ -1587,7 +1593,7 @@ untrashed). If BACKWARDS is non-`nil', move backwards."
(interactive) (interactive)
(or (mu4e-headers-find-if-next (or (mu4e-headers-find-if-next
(lambda (msg) (lambda (msg)
(let ((flags (mu4e-message-field msg :flags))) (let ((flags (mu4e-message-field msg :flags)))
(and (member 'unread flags) (not (member 'trashed flags))))) (and (member 'unread flags) (not (member 'trashed flags)))))
backwards) backwards)
(mu4e-message (format "No %s unread message found" (mu4e-message (format "No %s unread message found"

View File

@ -27,7 +27,6 @@
(require 'mu4e-utils) (require 'mu4e-utils)
(require 'mu4e-meta) (require 'mu4e-meta)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; internal vars ;; internal vars

View File

@ -834,7 +834,8 @@ successful, call FUNC (if non-nil) afterwards."
(setq mu4e~update-timer (setq mu4e~update-timer
(run-at-time (run-at-time
0 mu4e-update-interval 0 mu4e-update-interval
(lambda () (mu4e-update-mail-and-index mu4e-index-update-in-background))))) (lambda () (mu4e-update-mail-and-index
mu4e-index-update-in-background)))))
(mu4e-message "Started mu4e with %d message%s in store" (mu4e-message "Started mu4e with %d message%s in store"
doccount (if (= doccount 1) "" "s")))))) doccount (if (= doccount 1) "" "s"))))))
;; wake up server ;; wake up server