From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org
Subject: [PATCH v2 3/4] emacs: save image redisplay data during non-lazy display
Date: Sun, 24 Sep 2023 06:51:51 -0300 [thread overview]
Message-ID: <20230924095152.1394168-4-david@tethera.net> (raw)
In-Reply-To: <20230924095152.1394168-1-david@tethera.net>
This data will eventually be used to redisplay hidden images. A
certain amount of refactoring is done here to avoid code
duplication.
---
emacs/notmuch-show.el | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 107ce1b8..54cf00c6 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1109,14 +1109,18 @@ is t, hide the part initially and show the button."
(and deep button)
(and high button)
(and long button))))
- (content-beg (point)))
+ (content-beg (point))
+ (part-data (list msg part mime-type nth depth button)))
;; Store the computed mime-type for later use (e.g. by attachment handlers).
(plist-put part :computed-type mime-type)
- (if show-part
- (notmuch-show-insert-bodypart-internal msg part mime-type nth depth button)
+ (cond
+ (show-part
+ (apply #'notmuch-show-insert-bodypart-internal part-data)
+ (when (and button (string-match "^image/" mime-type))
+ (button-put button :notmuch-redisplay-data part-data)))
+ (t
(when button
- (button-put button :notmuch-lazy-part
- (list msg part mime-type nth depth button))))
+ (button-put button :notmuch-lazy-part part-data))))
;; Some of the body part handlers leave point somewhere up in the
;; part, so we make sure that we're down at the end.
(goto-char (point-max))
--
2.40.1
next prev parent reply other threads:[~2023-09-24 9:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-24 9:51 v2 Image toggle fixes for emacs 29.1 David Bremner
2023-09-24 9:51 ` [PATCH v2 1/4] emacs: save undisplayer function for MIME parts David Bremner
2023-09-24 9:51 ` [PATCH v2 2/4] emacs/show: save redisplay redisplay data when showing lazy part David Bremner
2023-09-24 9:51 ` David Bremner [this message]
2023-09-24 9:51 ` [PATCH v2 4/4] emacs/show: special case toggling display of images David Bremner
2023-10-01 11:13 ` v2 Image toggle fixes for emacs 29.1 David Bremner
2023-10-01 13:39 ` Michael J Gruber
2023-10-01 19:08 ` 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=20230924095152.1394168-4-david@tethera.net \
--to=david@tethera.net \
--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).