mu4e: some whitespace cleanup

This commit is contained in:
djcb 2017-01-30 21:07:00 +02:00
parent 5a09733048
commit 05faceeb49
2 changed files with 80 additions and 81 deletions

View File

@ -1,6 +1,6 @@
;;; mu4e-actions.el -- part of mu4e, the mu mail user agent ;;; mu4e-actions.el -- part of mu4e, the mu mail user agent
;; ;;
;; Copyright (C) 2011-2016 Dirk-Jan C. Binnema ;; Copyright (C) 2011-2017 Dirk-Jan C. Binnema
;; Author: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> ;; Author: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
;; Maintainer: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> ;; Maintainer: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
@ -90,19 +90,19 @@ return the filename."
(write-file tmpfile) (write-file tmpfile)
;; rewrite attachment urls ;; rewrite attachment urls
(mapc (lambda (attachment) (mapc (lambda (attachment)
(goto-char (point-min)) (goto-char (point-min))
(while (re-search-forward (format "src=\"cid:%s\"" (while (re-search-forward (format "src=\"cid:%s\""
(plist-get attachment :cid)) nil t) (plist-get attachment :cid)) nil t)
(if (plist-get attachment :temp) (if (plist-get attachment :temp)
(replace-match (format "src=\"%s\"" (plist-get attachment :temp))) (replace-match (format "src=\"%s\"" (plist-get attachment :temp)))
(replace-match (format "src=\"%s%s\"" temporary-file-directory (replace-match (format "src=\"%s%s\"" temporary-file-directory
(plist-get attachment :name))) (plist-get attachment :name)))
(let ((tmp-attachment-name (format "%s%s" temporary-file-directory (let ((tmp-attachment-name (format "%s%s" temporary-file-directory
(plist-get attachment :name)))) (plist-get attachment :name))))
(mu4e~proc-extract 'save (mu4e-message-field msg :docid) (mu4e~proc-extract 'save (mu4e-message-field msg :docid)
(plist-get attachment :index) (plist-get attachment :index)
mu4e-decryption-policy tmp-attachment-name) mu4e-decryption-policy tmp-attachment-name)
(mu4e-remove-file-later tmp-attachment-name))))) (mu4e-remove-file-later tmp-attachment-name)))))
attachments) attachments)
(save-buffer) (save-buffer)
tmpfile))) tmpfile)))
@ -113,7 +113,7 @@ You can influence the browser to use with the variable
`browse-url-generic-program', and see the discussion of privacy `browse-url-generic-program', and see the discussion of privacy
aspects in `(mu4e) Displaying rich-text messages'." aspects in `(mu4e) Displaying rich-text messages'."
(browse-url (concat "file://" (browse-url (concat "file://"
(mu4e~write-body-to-html msg)))) (mu4e~write-body-to-html msg))))
(defun mu4e-action-view-with-xwidget (msg) (defun mu4e-action-view-with-xwidget (msg)
"View the body of the message inside xwidget-webkit. This is "View the body of the message inside xwidget-webkit. This is
@ -122,7 +122,7 @@ aspects in `(mu4e) Displaying rich-text messages'."
(unless (fboundp 'xwidget-webkit-browse-url) (unless (fboundp 'xwidget-webkit-browse-url)
(mu4e-error "No xwidget support available")) (mu4e-error "No xwidget support available"))
(xwidget-webkit-browse-url (xwidget-webkit-browse-url
(concat "file://" (mu4e~write-body-to-html msg)) t)) (concat "file://" (mu4e~write-body-to-html msg)) t))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -338,7 +338,7 @@ display the message."
(when msgid (when msgid
(let ((mu4e-headers-show-threads t) (let ((mu4e-headers-show-threads t)
(mu4e-headers-include-related t)) (mu4e-headers-include-related t))
(mu4e-headers-search (mu4e-headers-search
(format "msgid:%s" msgid) (format "msgid:%s" msgid)
nil nil nil nil nil nil
msgid (eq major-mode 'mu4e-view-mode)))))) msgid (eq major-mode 'mu4e-view-mode))))))

View File

@ -1,6 +1,6 @@
;;; mu4e-headers.el -- part of mu4e, the mu mail user agent ;;; mu4e-headers.el -- part of mu4e, the mu mail user agent
;; ;;
;; Copyright (C) 2011-2016 Dirk-Jan C. Binnema ;; Copyright (C) 2011-2017 Dirk-Jan C. Binnema
;; Author: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> ;; Author: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
;; Maintainer: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> ;; Maintainer: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
@ -156,17 +156,17 @@ Note that this is merely a display filter.")
element is a symbol in the list (DRAFT FLAGGED NEW PASSED element is a symbol in the list (DRAFT FLAGGED NEW PASSED
REPLIED SEEN TRASHED ATTACH ENCRYPTED SIGNED UNREAD)." REPLIED SEEN TRASHED ATTACH ENCRYPTED SIGNED UNREAD)."
:type '(set :type '(set
(const :tag "Draft" draft) (const :tag "Draft" draft)
(const :tag "Flagged" flagged) (const :tag "Flagged" flagged)
(const :tag "New" new) (const :tag "New" new)
(const :tag "Passed" passed) (const :tag "Passed" passed)
(const :tag "Replied" replied) (const :tag "Replied" replied)
(const :tag "Seen" seen) (const :tag "Seen" seen)
(const :tag "Trashed" trashed) (const :tag "Trashed" trashed)
(const :tag "Attach" attach) (const :tag "Attach" attach)
(const :tag "Encrypted" encrypted) (const :tag "Encrypted" encrypted)
(const :tag "Signed" signed) (const :tag "Signed" signed)
(const :tag "Unread" unread)) (const :tag "Unread" unread))
:group 'mu4e-headers) :group 'mu4e-headers)
(defcustom mu4e-headers-found-hook nil (defcustom mu4e-headers-found-hook nil
@ -382,14 +382,14 @@ If SKIP-HOOK is not nil, `mu4e-message-changed-hook' will be invoked."
(mu4e~headers-remove-header docid t) (mu4e~headers-remove-header docid t)
;; if we were viewing this message, close it now. ;; if we were viewing this message, close it now.
(when (and (mu4e~headers-view-this-message-p docid) (when (and (mu4e~headers-view-this-message-p docid)
(buffer-live-p mu4e~view-buffer)) (buffer-live-p mu4e~view-buffer))
(with-current-buffer mu4e~view-buffer (with-current-buffer mu4e~view-buffer
;; XXX it seems this sometimes fails; investigate; ;; XXX it seems this sometimes fails; investigate;
;; for now, just ignore the error ;; for now, just ignore the error
(ignore-errors (ignore-errors
(kill-buffer-and-window)))) (kill-buffer-and-window))))
(unless skip-hook (unless skip-hook
(run-hooks 'mu4e-message-changed-hook))))) (run-hooks 'mu4e-message-changed-hook)))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -430,24 +430,24 @@ function is for display. (This difference is significant, since
internally, the Maildir spec determines what the flags look like, internally, the Maildir spec determines what the flags look like,
while our display may be different)." while our display may be different)."
(let ((str "") (let ((str "")
(get-prefix (get-prefix
(lambda (cell) (if mu4e-use-fancy-chars (cdr cell) (car cell))))) (lambda (cell) (if mu4e-use-fancy-chars (cdr cell) (car cell)))))
(dolist (flag mu4e-headers-visible-flags) (dolist (flag mu4e-headers-visible-flags)
(when (member flag flags) (when (member flag flags)
(setq str (setq str
(concat str (concat str
(case flag (case flag
('draft (funcall get-prefix mu4e-headers-draft-mark)) ('draft (funcall get-prefix mu4e-headers-draft-mark))
('flagged (funcall get-prefix mu4e-headers-flagged-mark)) ('flagged (funcall get-prefix mu4e-headers-flagged-mark))
('new (funcall get-prefix mu4e-headers-new-mark)) ('new (funcall get-prefix mu4e-headers-new-mark))
('passed (funcall get-prefix mu4e-headers-passed-mark)) ('passed (funcall get-prefix mu4e-headers-passed-mark))
('replied (funcall get-prefix mu4e-headers-replied-mark)) ('replied (funcall get-prefix mu4e-headers-replied-mark))
('seen (funcall get-prefix mu4e-headers-seen-mark)) ('seen (funcall get-prefix mu4e-headers-seen-mark))
('trashed (funcall get-prefix mu4e-headers-trashed-mark)) ('trashed (funcall get-prefix mu4e-headers-trashed-mark))
('attach (funcall get-prefix mu4e-headers-attach-mark)) ('attach (funcall get-prefix mu4e-headers-attach-mark))
('encrypted (funcall get-prefix mu4e-headers-encrypted-mark)) ('encrypted (funcall get-prefix mu4e-headers-encrypted-mark))
('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))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -486,7 +486,6 @@ date. The formats used for date and time are
(format-time-string mu4e-headers-time-format date) (format-time-string mu4e-headers-time-format date)
(format-time-string mu4e-headers-date-format date)))))) (format-time-string mu4e-headers-date-format date))))))
(defsubst mu4e~headers-thread-subject (msg) (defsubst mu4e~headers-thread-subject (msg)
"Get the subject if it is the first one in a thread; otherwise, "Get the subject if it is the first one in a thread; otherwise,
return the thread-prefix without the subject-text. In other words, return the thread-prefix without the subject-text. In other words,
@ -534,11 +533,11 @@ found."
(:date (format-time-string mu4e-headers-date-format val)) (:date (format-time-string mu4e-headers-date-format val))
(:mailing-list (mu4e~headers-mailing-list val)) (:mailing-list (mu4e~headers-mailing-list val))
(:human-date (propertize (mu4e~headers-human-date msg) (:human-date (propertize (mu4e~headers-human-date msg)
'help-echo (format-time-string 'help-echo (format-time-string
mu4e-headers-long-date-format mu4e-headers-long-date-format
(mu4e-msg-field msg :date)))) (mu4e-msg-field msg :date))))
(:flags (propertize (mu4e~headers-flags-str val) (:flags (propertize (mu4e~headers-flags-str val)
'help-echo (format "%S" val))) 'help-echo (format "%S" val)))
(:tags (propertize (mapconcat 'identity val ", "))) (:tags (propertize (mapconcat 'identity val ", ")))
(:size (mu4e-display-size val)) (:size (mu4e-display-size val))
(t (mu4e~headers-custom-field msg field)))) (t (mu4e~headers-custom-field msg field))))
@ -556,8 +555,8 @@ found."
(defun mu4e~headers-field-handler (f-w msg) (defun mu4e~headers-field-handler (f-w msg)
"Create a description of the field of MSG described by F-W." "Create a description of the field of MSG described by F-W."
(let* ((field (car f-w)) (let* ((field (car f-w))
(width (cdr f-w)) (width (cdr f-w))
(val (mu4e-message-field msg (car f-w)))) (val (mu4e-message-field msg (car f-w))))
(dolist (func mu4e~headers-field-handler-functions) (dolist (func mu4e~headers-field-handler-functions)
(setq val (funcall func msg field val width))) (setq val (funcall func msg field val width)))
val)) val))
@ -568,14 +567,14 @@ found."
(defun mu4e~headers-line-apply-flag-face (msg line) (defun mu4e~headers-line-apply-flag-face (msg line)
"Adjust LINE's face property based on FLAGS." "Adjust LINE's face property based on FLAGS."
(let* ((flags (mu4e-message-field msg :flags)) (let* ((flags (mu4e-message-field msg :flags))
(face (cond (face (cond
((memq 'trashed flags) 'mu4e-trashed-face) ((memq 'trashed flags) 'mu4e-trashed-face)
((memq 'draft flags) 'mu4e-draft-face) ((memq 'draft flags) 'mu4e-draft-face)
((or (memq 'unread flags) (memq 'new flags)) ((or (memq 'unread flags) (memq 'new flags))
'mu4e-unread-face) 'mu4e-unread-face)
((memq 'flagged flags) 'mu4e-flagged-face) ((memq 'flagged flags) 'mu4e-flagged-face)
((memq 'replied flags) 'mu4e-replied-face) ((memq 'replied flags) 'mu4e-replied-face)
((memq 'passed flags) 'mu4e-forwarded-face) ((memq 'passed flags) 'mu4e-forwarded-face)
(t 'mu4e-header-face)))) (t 'mu4e-header-face))))
;; hmmm, this only works with emacs 24.4+ ;; hmmm, this only works with emacs 24.4+
(when (fboundp 'add-face-text-property) (when (fboundp 'add-face-text-property)
@ -594,7 +593,7 @@ if provided, or at the end of the buffer otherwise."
(when (buffer-live-p mu4e~headers-buffer) (when (buffer-live-p mu4e~headers-buffer)
(with-current-buffer mu4e~headers-buffer (with-current-buffer mu4e~headers-buffer
(unless (and mu4e-headers-hide-predicate (unless (and mu4e-headers-hide-predicate
(funcall mu4e-headers-hide-predicate msg)) (funcall mu4e-headers-hide-predicate msg))
(let ((docid (mu4e-message-field msg :docid)) (let ((docid (mu4e-message-field msg :docid))
(line (mapconcat (line (mapconcat
(lambda (f-w) (mu4e~headers-field-handler f-w msg)) (lambda (f-w) (mu4e~headers-field-handler f-w msg))
@ -853,7 +852,7 @@ after the end of the search results."
(info (cdr (assoc field (info (cdr (assoc field
(append mu4e-header-info mu4e-header-info-custom)))) (append mu4e-header-info mu4e-header-info-custom))))
(require-full (plist-get info :require-full)) (require-full (plist-get info :require-full))
(sortable (plist-get info :sortable)) (sortable (plist-get info :sortable))
;; if sortable, it is either t (when field is sortable itself) ;; if sortable, it is either t (when field is sortable itself)
;; or a symbol (if another field is used for sorting) ;; or a symbol (if another field is used for sorting)
(sortfield (when sortable (if (booleanp sortable) field sortable))) (sortfield (when sortable (if (booleanp sortable) field sortable)))
@ -1093,12 +1092,12 @@ the query history stack."
mode-name "mu4e-headers" mode-name "mu4e-headers"
mu4e~headers-last-query expr) mu4e~headers-last-query expr)
(add-to-list 'global-mode-string (add-to-list 'global-mode-string
'(:eval '(:eval
(concat (concat
(propertize (propertize
(mu4e~quote-for-modeline mu4e~headers-last-query) (mu4e~quote-for-modeline mu4e~headers-last-query)
'face 'mu4e-modeline-face) 'face 'mu4e-modeline-face)
" " " "
(mu4e-context-label))))) (mu4e-context-label)))))
;; when the buffer is already visible, select it; otherwise, ;; when the buffer is already visible, select it; otherwise,
;; switch to it. ;; switch to it.
@ -1127,15 +1126,15 @@ of `mu4e-split-view', and return a window for the message view."
;; get a new view window ;; get a new view window
(setq mu4e~headers-view-win (setq mu4e~headers-view-win
(let* ((new-win-func (let* ((new-win-func
(cond (cond
((eq mu4e-split-view 'horizontal) ;; split horizontally ((eq mu4e-split-view 'horizontal) ;; split horizontally
'(split-window-vertically mu4e-headers-visible-lines)) '(split-window-vertically mu4e-headers-visible-lines))
((eq mu4e-split-view 'vertical) ;; split vertically ((eq mu4e-split-view 'vertical) ;; split vertically
'(split-window-horizontally mu4e-headers-visible-columns))))) '(split-window-horizontally mu4e-headers-visible-columns)))))
(cond ((with-demoted-errors "Unable to split window: %S" (cond ((with-demoted-errors "Unable to split window: %S"
(eval new-win-func))) (eval new-win-func)))
(t ;; no splitting; just use the currently selected one (t ;; no splitting; just use the currently selected one
(selected-window))))) (selected-window)))))
mu4e~headers-view-win) mu4e~headers-view-win)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -1210,7 +1209,7 @@ matching messages with that mark."
'( ("subject" . :subject) '( ("subject" . :subject)
("from" . :from) ("from" . :from)
("to" . :to) ("to" . :to)
("cc" . :cc) ("cc" . :cc)
("bcc" . :bcc) ("bcc" . :bcc)
("list" . :mailing-list)))) ("list" . :mailing-list))))
(pattern (read-string (pattern (read-string
@ -1291,10 +1290,10 @@ descendants."
(interactive (interactive
(let* ((subthread current-prefix-arg)) (let* ((subthread current-prefix-arg))
(list current-prefix-arg (list current-prefix-arg
;; FIXME: e.g., for refiling we should evaluate this ;; FIXME: e.g., for refiling we should evaluate this
;; for each line separately ;; for each line separately
(mu4e~mark-get-markpair (mu4e~mark-get-markpair
(if subthread "Mark subthread with: " "Mark whole thread with: ") t)))) (if subthread "Mark subthread with: " "Mark whole thread with: ") t))))
(mu4e-headers-mark-thread-using-markpair markpair subthread)) (mu4e-headers-mark-thread-using-markpair markpair subthread))
(defun mu4e-headers-mark-subthread (&optional markpair) (defun mu4e-headers-mark-subthread (&optional markpair)