* cosmetics

This commit is contained in:
djcb 2012-04-28 13:47:13 +03:00
parent 99c1042769
commit 63711fd046
2 changed files with 53 additions and 54 deletions

View File

@ -107,12 +107,12 @@ are of the form:
(defconst mu4e~hdrs-fringe (make-string mu4e~hdrs-fringe-len ?\s) (defconst mu4e~hdrs-fringe (make-string mu4e~hdrs-fringe-len ?\s)
"The space on the left of message headers to put marks.") "The space on the left of message headers to put marks.")
(defconst mu4e~hdrs-fringe-format (format "%%-%ds" mu4e~hdrs-fringe-len) (defconst mu4e~hdrs-fringe-format (format "%%-%ds" mu4e~hdrs-fringe-len)
"Format string to set a mark and leave remaining space.") "Format string to set a mark and leave remaining space.")
;; docid cookies ;; docid cookies
(defconst mu4e~docid-pre "\376" (defconst mu4e~docid-pre "\376"
"Each header starts (invisibly) with the `mu4e-docid-pre', "Each header starts (invisibly) with the `mu4e-docid-pre',
followed by the docid, followed by `mu4e-docid-post'.") followed by the docid, followed by `mu4e-docid-post'.")
(defconst mu4e~docid-post "\377" (defconst mu4e~docid-post "\377"
"Each header starts (invisibly) with the `mu4e-docid-pre', "Each header starts (invisibly) with the `mu4e-docid-pre',
followed by the docid, followed by `mu4e-docid-post'.") followed by the docid, followed by `mu4e-docid-post'.")
@ -570,7 +570,7 @@ with DOCID which must be present in the headers buffer."
;; (which is invisible). jump past that… ;; (which is invisible). jump past that…
(unless (re-search-forward mu4e~docid-post nil t) (unless (re-search-forward mu4e~docid-post nil t)
(error "Cannot find the `mu4e~docid-post' separator")) (error "Cannot find the `mu4e~docid-post' separator"))
;; clear old marks, and add the new ones. ;; clear old marks, and add the new ones.
(let ((msg (get-text-property (point) 'msg))) (let ((msg (get-text-property (point) 'msg)))
(delete-char mu4e~hdrs-fringe-len) (delete-char mu4e~hdrs-fringe-len)
@ -579,7 +579,7 @@ with DOCID which must be present in the headers buffer."
'face 'mu4e-header-marks-face 'face 'mu4e-header-marks-face
'docid docid 'docid docid
'msg msg))) 'msg msg)))
(goto-char oldpoint)))) (goto-char oldpoint))))
@ -780,8 +780,8 @@ current window. "
(let ((inhibit-read-only t)) (let ((inhibit-read-only t))
(erase-buffer) (erase-buffer)
(insert (propertize "Waiting for message..." (insert (propertize "Waiting for message..."
'face 'mu4e-system-face 'intangible t))) 'face 'mu4e-system-face 'intangible t))
(mu4e~proc-view docid))) (mu4e~proc-view docid))))
(defun mu4e~hdrs-kill-buffer-and-window () (defun mu4e~hdrs-kill-buffer-and-window ()
"Quit the message view and return to the main view." "Quit the message view and return to the main view."

View File

@ -100,7 +100,7 @@ display with `mu4e-view-toggle-hide-cited (default keybinding:
<w>)." <w>)."
:group 'mu4e-view) :group 'mu4e-view)
(defvar mu4e-view-actions (defvar mu4e-view-actions
'( ("capture message" ?c mu4e-action-capture-message) '( ("capture message" ?c mu4e-action-capture-message)
("view as pdf" ?p mu4e-action-view-as-pdf)) ("view as pdf" ?p mu4e-action-view-as-pdf))
@ -111,7 +111,7 @@ where:
* NAME is the name of the action (e.g. \"Count lines\") * NAME is the name of the action (e.g. \"Count lines\")
* SHORTCUT is a one-character shortcut to call this action * SHORTCUT is a one-character shortcut to call this action
* FUNC is a function which receives a message plist as an argument.") * FUNC is a function which receives a message plist as an argument.")
(defvar mu4e-view-attachment-actions (defvar mu4e-view-attachment-actions
'( ("open-with" ?w mu4e-view-open-attachment-with) '( ("open-with" ?w mu4e-view-open-attachment-with)
("in-emacs" ?e mu4e-view-open-attachment-emacs) ("in-emacs" ?e mu4e-view-open-attachment-emacs)
@ -196,60 +196,57 @@ based on the settings of `mu4e~view-wrap-lines' and
As a side-effect, a message that is being viewed loses its 'unread' As a side-effect, a message that is being viewed loses its 'unread'
marking if it still had that." marking if it still had that."
(let ((buf (get-buffer-create mu4e-view-buffer-name)) (let ((buf (get-buffer-create mu4e-view-buffer-name)))
(inhibit-read-only t))
(with-current-buffer buf (with-current-buffer buf
(setq mu4e-view-buffer buf) (let ((inhibit-read-only t))
(erase-buffer) (setq ;; buffer local
(insert (mu4e-view-message-text msg)) mu4e-current-msg msg
mu4e~view-hdrs-buffer hdrsbuf
mu4e-view-buffer buf)
;; initialize view-mode (erase-buffer)
(mu4e-view-mode) (insert (mu4e-view-message-text msg))
(setq ;; these are buffer-local
buffer-read-only t
mu4e-current-msg msg
mu4e~view-hdrs-buffer hdrsbuf
mu4e~view-link-map (make-hash-table :size 32 :rehash-size 2 :weakness nil))
(switch-to-buffer buf) (switch-to-buffer buf)
(goto-char (point-min)) (goto-char (point-min))
(mu4e~view-fontify-cited) (mu4e~view-fontify-cited)
(mu4e~view-fontify-footer) (mu4e~view-fontify-footer)
(mu4e~view-make-urls-clickable) (mu4e~view-make-urls-clickable)
(unless update (unless update
;; if we're showing the message for the first time, use the values of ;; if we're showing the message for the first time, use the values of
;; user-settable variables `mu4e~view-wrap-lines' and ;; user-settable variables `mu4e~view-wrap-lines' and
;; `mu4e~view-hide-cited' to determine whether we should wrap/hide ;; `mu4e~view-hide-cited' to determine whether we should wrap/hide
(progn (progn
(when mu4e~view-lines-wrapped (mu4e~view-wrap-lines)) (when mu4e~view-lines-wrapped (mu4e~view-wrap-lines))
(when mu4e~view-cited-hidden (mu4e~view-hide-cited)))) (when mu4e~view-cited-hidden (mu4e~view-hide-cited))))
;; no use in trying to set flags again ;; no use in trying to set flags again
(unless update (unless update
(mu4e~view-mark-as-read-maybe))))) (mu4e~view-mark-as-read-maybe)))
(mu4e-view-mode))))
(defun mu4e~view-construct-header (key val &optional dont-propertize-val) (defun mu4e~view-construct-header (key val &optional dont-propertize-val)
"Return header KEY with value VAL if VAL is non-nil. If "Return header KEY with value VAL if VAL is non-nil. If
DONT-PROPERTIZE-VAL is non-nil, do not add text-properties to VAL." DONT-PROPERTIZE-VAL is non-nil, do not add text-properties to VAL."
(if val (if val
(with-temp-buffer (with-temp-buffer
(insert (propertize key 'face 'mu4e-view-header-key-face) ": " (insert (propertize key 'face 'mu4e-view-header-key-face) ": "
(if dont-propertize-val (if dont-propertize-val
val val
(propertize val 'face 'mu4e-view-header-value-face)) "\n") (propertize val 'face 'mu4e-view-header-value-face)) "\n")
;; temporarily set the fill column <margin> positions to the right, so ;; temporarily set the fill column <margin> positions to the right, so
;; we can indent following lines with positions ;; we can indent following lines with positions
(let*((margin 1) (fill-column (- fill-column margin))) (let*((margin 1) (fill-column (- fill-column margin)))
(fill-region (point-min) (point-max)) (fill-region (point-min) (point-max))
(goto-char (point-min)) (goto-char (point-min))
(while (and (zerop (forward-line 1)) (not (looking-at "^$"))) (while (and (zerop (forward-line 1)) (not (looking-at "^$")))
(indent-to-column margin))) (indent-to-column margin)))
(buffer-string)) (buffer-string))
"")) ""))
(defun mu4e~view-construct-contacts (msg field) (defun mu4e~view-construct-contacts (msg field)
"Add a header for a contact field (ie., :to, :from, :cc, :bcc)." "Add a header for a contact field (ie., :to, :from, :cc, :bcc)."
@ -340,7 +337,7 @@ is nil, and otherwise open it."
(define-key map "%" 'mu4e-view-mark-matches) (define-key map "%" 'mu4e-view-mark-matches)
(define-key map "t" 'mu4e-view-mark-subthread) (define-key map "t" 'mu4e-view-mark-subthread)
(define-key map "T" 'mu4e-view-mark-thread) (define-key map "T" 'mu4e-view-mark-thread)
(define-key map "j" 'mu4e-jump-to-maildir) (define-key map "j" 'mu4e-jump-to-maildir)
(define-key map "g" 'mu4e-view-go-to-url) (define-key map "g" 'mu4e-view-go-to-url)
@ -558,6 +555,8 @@ Seen; if the message is not New/Unread, do nothing."
number them so they can be opened using `mu4e-view-go-to-url'." number them so they can be opened using `mu4e-view-go-to-url'."
(let ((num 0)) (let ((num 0))
(save-excursion (save-excursion
(setq mu4e~view-link-map ;; buffer local
(make-hash-table :size 32 :rehash-size 2 :weakness nil))
(goto-char (point-min)) (goto-char (point-min))
(while (re-search-forward mu4e~view-url-regexp nil t) (while (re-search-forward mu4e~view-url-regexp nil t)
(let ((url (match-string 0)) (let ((url (match-string 0))
@ -812,7 +811,7 @@ attachments) in response to a (mu4e~proc-extract 'temp ... )."
(if (eq mark 'move) (if (eq mark 'move)
(mu4e-mark-for-move-set) (mu4e-mark-for-move-set)
(mu4e-mark-at-point mark))))) (mu4e-mark-at-point mark)))))
(defun mu4e~split-view-p () (defun mu4e~split-view-p ()
"Return t if we're in split-view, nil otherwise." "Return t if we're in split-view, nil otherwise."