notmuch-wash-excerpt-citations))
;; Mostly useful for debugging.
-(defcustom notmuch-show-all-multipart/alternative-parts nil
+(defcustom notmuch-show-all-multipart/alternative-parts t
"Should all parts of multipart/alternative parts be shown?"
:group 'notmuch
:type 'boolean)
"Use external viewers to view all attachments from the current message."
(interactive)
(with-current-notmuch-show-message
- ; We ovverride the mm-inline-media-tests to indicate which message
+ ; We override the mm-inline-media-tests to indicate which message
; parts are already sufficiently handled by the original
; presentation of the message in notmuch-show mode. These parts
; will be inserted directly into the temporary buffer of
")"))))))
(defun notmuch-show-clean-address (address)
- "Clean a single email address for display."
- (let* ((parsed (mail-header-parse-address address))
- (address (car parsed))
- (name (cdr parsed)))
- ;; Remove double quotes. They might be required during transport,
- ;; but we don't need to see them.
- (when name
- (setq name (replace-regexp-in-string "\"" "" name)))
- ;; If the address is 'foo@bar.com <foo@bar.com>' then show just
- ;; 'foo@bar.com'.
- (when (string= name address)
- (setq name nil))
-
- (if (not name)
- address
- (concat name " <" address ">"))))
+ "Try to clean a single email ADDRESS for display. Return
+unchanged ADDRESS if parsing fails."
+ (condition-case nil
+ (let* ((parsed (mail-header-parse-address address))
+ (address (car parsed))
+ (name (cdr parsed)))
+ ;; Remove double quotes. They might be required during transport,
+ ;; but we don't need to see them.
+ (when name
+ (setq name (replace-regexp-in-string "\"" "" name)))
+ ;; If the address is 'foo@bar.com <foo@bar.com>' then show just
+ ;; 'foo@bar.com'.
+ (when (string= name address)
+ (setq name nil))
+
+ (if (not name)
+ address
+ (concat name " <" address ">")))
+ (error address)))
(defun notmuch-show-insert-headerline (headers date tags depth)
"Insert a notmuch style headerline based on HEADERS for a
'face 'message-mml)
(defun notmuch-show-insert-part-header (nth content-type declared-type &optional name comment)
- (insert-button
- (concat "[ "
- (if name (concat name ": ") "")
- declared-type
- (if (not (string-equal declared-type content-type))
- (concat " (as " content-type ")")
- "")
- (or comment "")
- " ]\n")
- :type 'notmuch-show-part-button-type
- :notmuch-part nth
- :notmuch-filename name))
+ (let ((button))
+ (setq button
+ (insert-button
+ (concat "[ "
+ (if name (concat name ": ") "")
+ declared-type
+ (if (not (string-equal declared-type content-type))
+ (concat " (as " content-type ")")
+ "")
+ (or comment "")
+ " ]")
+ :type 'notmuch-show-part-button-type
+ :notmuch-part nth
+ :notmuch-filename name))
+ (insert "\n")
+ ;; return button
+ button))
;; Functions handling particular MIME parts.
"Filename to save as: "
(or mailcap-download-directory "~/")
nil nil
- filename))
- (require-final-newline nil)
- (coding-system-for-write 'no-conversion))
- (write-region (point-min) (point-max) file)))))
+ filename)))
+ ;; Don't re-compress .gz & al. Arguably we should make
+ ;; `file-name-handler-alist' nil, but that would chop
+ ;; ange-ftp, which is reasonable to use here.
+ (mm-write-region (point-min) (point-max) file nil nil nil 'no-conversion t)))))
(defun notmuch-show-mm-display-part-inline (msg part content-type content)
"Use the mm-decode/mm-view functions to display a part in the
(save-excursion
(save-restriction
(narrow-to-region start (point-max))
- (run-hook-with-args 'notmuch-show-insert-text/plain-hook depth))))
+ (run-hook-with-args 'notmuch-show-insert-text/plain-hook msg depth))))
t)
(defun notmuch-show-insert-part-text/x-vcalendar (msg part content-type nth depth declared-type)
(setq content-start (point-marker))
+ (plist-put msg :headers-invis-spec headers-invis-spec)
+ (plist-put msg :message-invis-spec message-invis-spec)
+
;; Set `headers-start' to point after the 'Subject:' header to be
;; compatible with the existing implementation. This just sets it
;; to after the first header.
;; message.
(put-text-property message-start message-end :notmuch-message-extent (cons message-start message-end))
- (plist-put msg :headers-invis-spec headers-invis-spec)
- (overlay-put (make-overlay headers-start headers-end) 'invisible headers-invis-spec)
-
- (plist-put msg :message-invis-spec message-invis-spec)
+ (let ((headers-overlay (make-overlay headers-start headers-end))
+ (invis-specs (list headers-invis-spec message-invis-spec)))
+ (overlay-put headers-overlay 'invisible invis-specs)
+ (overlay-put headers-overlay 'priority 10))
(overlay-put (make-overlay body-start body-end) 'invisible message-invis-spec)
;; Save the properties for this message. Currently this saves the
messages from the thread matching this search term are shown if
non-nil.
-The optional BUFFER-NAME provides the neame of the buffer in
+The optional BUFFER-NAME provides the name of the buffer in
which the message thread is shown. If it is nil (which occurs
when the command is called interactively) the argument to the
function is used. "
without removing any tags, and '\\[notmuch-show-archive-thread]' to archive an entire thread
without scrolling through with \\[notmuch-show-advance-and-archive]).
-You can add or remove arbitary tags from the current message with
+You can add or remove arbitrary tags from the current message with
'\\[notmuch-show-add-tag]' or '\\[notmuch-show-remove-tag]'.
All currently available key bindings:
(add-to-invisibility-spec spec))))
(defun notmuch-show-message-visible (props visible-p)
- (if visible-p
- ;; When making the message visible, the headers may or not be
- ;; visible. So we check that property separately.
- (let ((headers-visible (plist-get props :headers-visible)))
- (notmuch-show-element-visible props headers-visible :headers-invis-spec)
- (notmuch-show-element-visible props t :message-invis-spec))
- (notmuch-show-element-visible props nil :headers-invis-spec)
- (notmuch-show-element-visible props nil :message-invis-spec))
-
+ (notmuch-show-element-visible props visible-p :message-invis-spec)
(notmuch-show-set-prop :message-visible visible-p props))
(defun notmuch-show-headers-visible (props visible-p)
- (if (plist-get props :message-visible)
- (notmuch-show-element-visible props visible-p :headers-invis-spec))
+ (notmuch-show-element-visible props visible-p :headers-invis-spec)
(notmuch-show-set-prop :headers-visible visible-p props))
;; Functions for setting and getting attributes of the current