aboutsummaryrefslogtreecommitdiffhomepage
path: root/emacs
diff options
context:
space:
mode:
authorGravatar Mark Walters <markwalters1009@gmail.com>2013-06-10 05:57:12 +0100
committerGravatar David Bremner <bremner@debian.org>2013-06-13 00:07:07 +0900
commit055f7621d649021b354fabea90f55136b55bf6ef (patch)
tree176886a6e62136eb314ce9cbb979ed55878d90b0 /emacs
parent490b02345e5a33fa7906495def4a7b714f145f79 (diff)
emacs: show move addition of :notmuch-part to separate function
This separates out the adding of the :notmuch-part text property to a separate function to simplify calling from the lazy part insertion code.
Diffstat (limited to 'emacs')
-rw-r--r--emacs/notmuch-show.el39
1 files changed, 22 insertions, 17 deletions
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 43aa88b0..6ec70c90 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -807,6 +807,27 @@ message at DEPTH in the current thread."
;; Return true if we created an overlay.
t))
+(defun notmuch-show-record-part-information (part beg end)
+ "Store PART as a text property from BEG to END"
+
+ ;; Record part information. Since we already inserted subparts,
+ ;; don't override existing :notmuch-part properties.
+ (notmuch-map-text-property beg end :notmuch-part
+ (lambda (v) (or v part)))
+ ;; Make :notmuch-part front sticky and rear non-sticky so it stays
+ ;; applied to the beginning of each line when we indent the
+ ;; message. Since we're operating on arbitrary renderer output,
+ ;; watch out for sticky specs of t, which means all properties are
+ ;; front-sticky/rear-nonsticky.
+ (notmuch-map-text-property beg end 'front-sticky
+ (lambda (v) (if (listp v)
+ (pushnew :notmuch-part v)
+ v)))
+ (notmuch-map-text-property beg end 'rear-nonsticky
+ (lambda (v) (if (listp v)
+ (pushnew :notmuch-part v)
+ v))))
+
(defun notmuch-show-insert-bodypart (msg part depth &optional hide)
"Insert the body part PART at depth DEPTH in the current thread.
@@ -836,23 +857,7 @@ If HIDE is non-nil then initially hide this part."
(when hide
(save-excursion
(notmuch-show-toggle-part-invisibility button)))
- ;; Record part information. Since we already inserted subparts,
- ;; don't override existing :notmuch-part properties.
- (notmuch-map-text-property beg (point) :notmuch-part
- (lambda (v) (or v part)))
- ;; Make :notmuch-part front sticky and rear non-sticky so it stays
- ;; applied to the beginning of each line when we indent the
- ;; message. Since we're operating on arbitrary renderer output,
- ;; watch out for sticky specs of t, which means all properties are
- ;; front-sticky/rear-nonsticky.
- (notmuch-map-text-property beg (point) 'front-sticky
- (lambda (v) (if (listp v)
- (pushnew :notmuch-part v)
- v)))
- (notmuch-map-text-property beg (point) 'rear-nonsticky
- (lambda (v) (if (listp v)
- (pushnew :notmuch-part v)
- v)))))
+ (notmuch-show-record-part-information part beg (point))))
(defun notmuch-show-insert-body (msg body depth)
"Insert the body BODY at depth DEPTH in the current thread."