aboutsummaryrefslogtreecommitdiffhomepage
path: root/emacs
diff options
context:
space:
mode:
authorGravatar David Edmondson <dme@dme.org>2010-05-10 11:15:30 +0100
committerGravatar Carl Worth <cworth@cworth.org>2011-05-17 16:34:26 -0700
commitf35813df38c811f35a654cc6e949a21a303a334b (patch)
treed19141e176b07d709d762511058ebf858e87b9b4 /emacs
parent0c68a5d8479bff77d31d37d552db907cfc2329d5 (diff)
emacs: Allow indentation of multipart children.
Signed-off-by: Jameson Rollins <jrollins@finestructure.net>
Diffstat (limited to 'emacs')
-rw-r--r--emacs/notmuch-show.el24
1 files changed, 19 insertions, 5 deletions
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index a6a43bb5..b2080032 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -82,6 +82,12 @@ any given message."
notmuch-wash-elide-blank-lines
notmuch-wash-excerpt-citations))
+(defcustom notmuch-show-indent-multipart nil
+ "Should the sub-parts of a multipart/* part be indented?"
+ ;; dme: Not sure which is a good default.
+ :group 'notmuch
+ :type 'boolean)
+
(defmacro with-current-notmuch-show-message (&rest body)
"Evaluate body with current buffer set to the text of current message"
`(save-excursion
@@ -305,7 +311,8 @@ current buffer, if possible."
(defun notmuch-show-insert-part-multipart/alternative (msg part content-type nth depth declared-type)
(notmuch-show-insert-part-header nth declared-type content-type nil)
(let ((chosen-type (car (notmuch-show-multipart/alternative-choose (notmuch-show-multipart/*-to-list part))))
- (inner-parts (plist-get part :content)))
+ (inner-parts (plist-get part :content))
+ (start (point)))
;; This inserts all parts of the chosen type rather than just one,
;; but it's not clear that this is the wrong thing to do - which
;; should be chosen if there are more than one that match?
@@ -314,16 +321,23 @@ current buffer, if possible."
(if (string= chosen-type inner-type)
(notmuch-show-insert-bodypart msg inner-part depth)
(notmuch-show-insert-part-header (plist-get inner-part :id) inner-type inner-type nil " (not shown)"))))
- inner-parts))
+ inner-parts)
+
+ (when notmuch-show-indent-multipart
+ (indent-rigidly start (point) 1)))
t)
(defun notmuch-show-insert-part-multipart/* (msg part content-type nth depth declared-type)
- (let ((inner-parts (plist-get part :content)))
- (notmuch-show-insert-part-header nth declared-type content-type nil)
+ (notmuch-show-insert-part-header nth declared-type content-type nil)
+ (let ((inner-parts (plist-get part :content))
+ (start (point)))
;; Show all of the parts.
(mapc (lambda (inner-part)
(notmuch-show-insert-bodypart msg inner-part depth))
- inner-parts))
+ inner-parts)
+
+ (when notmuch-show-indent-multipart
+ (indent-rigidly start (point) 1)))
t)
(defun notmuch-show-insert-part-message/rfc822 (msg part content-type nth depth declared-type)