mu4e: cosmetics

This commit is contained in:
djcb
2015-12-30 15:35:26 +02:00
parent 02620af4c2
commit 9da7fbb3de
2 changed files with 21 additions and 16 deletions

View File

@ -266,7 +266,8 @@ Function will return the cdr of the list element."
(lambda (option) (lambda (option)
;; try to detect old-style options, and warn ;; try to detect old-style options, and warn
(when (characterp (car-safe (cdr-safe option))) (when (characterp (car-safe (cdr-safe option)))
(mu4e-error (concat "Please use the new format for options/actions; " (mu4e-error
(concat "Please use the new format for options/actions; "
"see the manual"))) "see the manual")))
(let* ((kar (substring (car option) 0 1)) (let* ((kar (substring (car option) 0 1))
(val (cdr option))) (val (cdr option)))
@ -277,7 +278,8 @@ Function will return the cdr of the list element."
(response (response
(mu4e~read-char-choice (mu4e~read-char-choice
(concat prompt optionsstr (concat prompt optionsstr
" [" (propertize "C-g" 'face 'mu4e-highlight-face) " to cancel]") " [" (propertize "C-g" 'face 'mu4e-highlight-face)
" to cancel]")
;; the allowable chars ;; the allowable chars
(map 'list (lambda(elm) (string-to-char (car elm))) options))) (map 'list (lambda(elm) (string-to-char (car elm))) options)))
(chosen (chosen
@ -307,9 +309,10 @@ Function will return the cdr of the list element."
dirs)) dirs))
(defvar mu4e-cache-maildir-list nil (defvar mu4e-cache-maildir-list nil
"Whether to cache the list of maildirs; set it to t if you find that "Whether to cache the list of maildirs; set it to t if you find
generating the list on the fly is too slow. If you do, you can set `mu4e-maildir-list' to that generating the list on the fly is too slow. If you do, you
nil to force regenerating the cache the next time `mu4e-get-maildirs' gets called.") can set `mu4e-maildir-list' to nil to force regenerating the
cache the next time `mu4e-get-maildirs' gets called.")
(defvar mu4e-maildir-list nil (defvar mu4e-maildir-list nil
"Cached list of maildirs.") "Cached list of maildirs.")
@ -324,7 +327,8 @@ the list of maildirs will not change until you restart mu4e."
(setq mu4e-maildir-list (setq mu4e-maildir-list
(sort (sort
(append (append
(when (file-accessible-directory-p (concat mu4e-maildir "/cur")) '("/")) (when (file-accessible-directory-p
(concat mu4e-maildir "/cur")) '("/"))
(mu4e~get-maildirs-1 mu4e-maildir "/")) (mu4e~get-maildirs-1 mu4e-maildir "/"))
(lambda (s1 s2) (string< (downcase s1) (downcase s2)))))) (lambda (s1 s2) (string< (downcase s1) (downcase s2))))))
mu4e-maildir-list) mu4e-maildir-list)
@ -351,9 +355,11 @@ maildirs under `mu4e-maildir'."
mlist ", ")) mlist ", "))
(kar (read-char (concat prompt fnames)))) (kar (read-char (concat prompt fnames))))
(if (member kar '(?/ ?o)) ;; user chose 'other'? (if (member kar '(?/ ?o)) ;; user chose 'other'?
(funcall mu4e-completing-read-function prompt (mu4e-get-maildirs) nil nil "/") (funcall mu4e-completing-read-function prompt
(mu4e-get-maildirs) nil nil "/")
(or (car-safe (or (car-safe
(find-if (lambda (item) (= kar (cdr item))) mu4e-maildir-shortcuts)) (find-if (lambda (item) (= kar (cdr item)))
mu4e-maildir-shortcuts))
(mu4e-warn "Unknown shortcut '%c'" kar))))))) (mu4e-warn "Unknown shortcut '%c'" kar)))))))
@ -734,7 +740,7 @@ This is used by the completion function in mu4e-compose."
Checks whether the server process is live." Checks whether the server process is live."
(mu4e~proc-running-p)) (mu4e~proc-running-p))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; starting / getting mail / updating the index ;; starting / getting mail / updating the index
;; ;;
;; ;;
@ -782,7 +788,7 @@ successful, call FUNC (if non-nil) afterwards."
;; set up the 'pong' handler func ;; set up the 'pong' handler func
(setq mu4e-pong-func (setq mu4e-pong-func
(lambda (props) (lambda (props)
(setq mu4e~server-props props) ;; save the props we got from the server (setq mu4e~server-props props) ;; save props from the server
(let ((version (plist-get props :version)) (let ((version (plist-get props :version))
(doccount (plist-get props :doccount))) (doccount (plist-get props :doccount)))
(mu4e~check-requirements) (mu4e~check-requirements)
@ -962,7 +968,7 @@ in the background; otherwise, pop up a window."
(get-buffer-process mu4e~update-buffer)))) (get-buffer-process mu4e~update-buffer))))
(when (process-live-p proc) (when (process-live-p proc)
(interrupt-process proc t)))) (interrupt-process proc t))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -1159,7 +1165,7 @@ receive (:info add :path <path> :docid <docid>) as well as (:update
<msg-sexp>)." <msg-sexp>)."
(mu4e~proc-add path maildir)) (mu4e~proc-add path maildir))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun mu4e~fontify-cited () (defun mu4e~fontify-cited ()
"Colorize message content based on the citation level. This is "Colorize message content based on the citation level. This is
used in the view and compose modes." used in the view and compose modes."
@ -1185,7 +1191,7 @@ the view and compose modes."
(let ((p (search-forward "^-- *$" nil t))) (let ((p (search-forward "^-- *$" nil t)))
(when p (when p
(add-text-properties p (point-max) '(face mu4e-footer-face))))))) (add-text-properties p (point-max) '(face mu4e-footer-face)))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(provide 'mu4e-utils) (provide 'mu4e-utils)

View File

@ -538,7 +538,6 @@ FUNC should be a function taking two arguments:
(dolist (part (mu4e-msg-field msg :parts)) (dolist (part (mu4e-msg-field msg :parts))
(funcall func msg part))) (funcall func msg part)))
(defvar mu4e-view-mode-map nil (defvar mu4e-view-mode-map nil
"Keymap for \"*mu4e-view*\" buffers.") "Keymap for \"*mu4e-view*\" buffers.")
(unless mu4e-view-mode-map (unless mu4e-view-mode-map
@ -552,7 +551,7 @@ FUNC should be a function taking two arguments:
;; note, 'z' is by-default bound to 'bury-buffer' ;; note, 'z' is by-default bound to 'bury-buffer'
;; but that's not very useful in this case ;; but that's not very useful in this case
(define-key map "z" 'mu4e~view-quit-buffer) (define-key map "z" 'ignore)
(define-key map "s" 'mu4e-headers-search) (define-key map "s" 'mu4e-headers-search)
(define-key map "S" 'mu4e-view-search-edit) (define-key map "S" 'mu4e-view-search-edit)
@ -672,7 +671,7 @@ FUNC should be a function taking two arguments:
(define-key menumap [sepa0] '("--")) (define-key menumap [sepa0] '("--"))
(define-key menumap [wrap-lines] (define-key menumap [wrap-lines]
'("Toggle wrap lines" . visual-line-mode)) '("Toggle wrap lines" . visual-line-mode))
(define-key menumap [hide-cited] (define-key menumap [toggle-html]
'("Toggle view-html" . mu4e-view-toggle-html)) '("Toggle view-html" . mu4e-view-toggle-html))
(define-key menumap [hide-cited] (define-key menumap [hide-cited]
'("Toggle hide cited" . mu4e-view-toggle-hide-cited)) '("Toggle hide cited" . mu4e-view-toggle-hide-cited))