unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org
Subject: [PATCH v2 2/4] emacs/show: save redisplay redisplay data when showing lazy part.
Date: Sun, 24 Sep 2023 06:51:50 -0300	[thread overview]
Message-ID: <20230924095152.1394168-3-david@tethera.net> (raw)
In-Reply-To: <20230924095152.1394168-1-david@tethera.net>

This data will be used to redisplay an image that is hidden by
deleting it from the buffer.  We cannot easily delay until the image
is hidden, as we won't have the original data at that point.
---
 emacs/notmuch-show.el | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 36cce619..107ce1b8 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1019,10 +1019,13 @@ will return nil if the CID is unknown or cannot be retrieved."
 	   (part-end (copy-marker (point) t))
 	   ;; We have to save the depth as we can't find the depth
 	   ;; when narrowed.
-	   (depth (notmuch-show-get-depth)))
+	   (depth (notmuch-show-get-depth))
+	   (mime-type (plist-get (cadr part-args) :computed-type)))
       (save-restriction
 	(narrow-to-region part-beg part-end)
 	(delete-region part-beg part-end)
+	(when (and mime-type (string-match "^image/" mime-type))
+	  (button-put button :notmuch-redisplay-data part-args))
 	(apply #'notmuch-show-insert-bodypart-internal part-args)
 	(indent-rigidly part-beg
 			part-end
-- 
2.40.1

  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 ` David Bremner [this message]
2023-09-24  9:51 ` [PATCH v2 3/4] emacs: save image redisplay data during non-lazy display David Bremner
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-3-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).