From: Mark Walters <markwalters1009@gmail.com>
To: notmuch@notmuchmail.org, Austin Clements <aclements@csail.mit.edu>
Subject: [PATCH v5 5/6] emacs: show move addition of :notmuch-part to separate function
Date: Mon, 10 Jun 2013 05:57:12 +0100 [thread overview]
Message-ID: <1370840233-23258-6-git-send-email-markwalters1009@gmail.com> (raw)
In-Reply-To: <1370840233-23258-1-git-send-email-markwalters1009@gmail.com>
This separates out the adding of the :notmuch-part text property to a
separate function to simplify calling from the lazy part insertion
code.
---
emacs/notmuch-show.el | 39 ++++++++++++++++++++++-----------------
1 files changed, 22 insertions(+), 17 deletions(-)
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 43aa88b..6ec70c9 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."
--
1.7.9.1
next prev parent reply other threads:[~2013-06-10 4:57 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-10 4:57 [PATCH v5 0/6] emacs: show: lazy handling of hidden parts Mark Walters
2013-06-10 4:57 ` [PATCH v5 1/6] emacs: show: fake wash parts are handled at insert-bodypart level Mark Walters
2013-06-10 4:57 ` [PATCH v5 2/6] emacs: show: move the insertion of the header button to the top level Mark Walters
2013-06-10 4:57 ` [PATCH v5 3/6] emacs: show: pass button to create-overlays Mark Walters
2013-06-10 4:57 ` [PATCH v5 4/6] emacs: show: modify the way hidden state is recorded Mark Walters
2013-06-10 4:57 ` Mark Walters [this message]
2013-06-10 4:57 ` [PATCH v5 6/6] emacs: show: implement lazy hidden part handling Mark Walters
2013-06-10 5:07 ` [PATCH v5 0/6] emacs: show: lazy handling of hidden parts Austin Clements
2013-06-10 15:22 ` Tomi Ollila
2013-06-10 15:57 ` Adam Wolfe Gordon
2013-06-12 15:12 ` David Bremner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1370840233-23258-6-git-send-email-markwalters1009@gmail.com \
--to=markwalters1009@gmail.com \
--cc=aclements@csail.mit.edu \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).