notmuch.git  about / heads / tags
Unnamed repository; edit this file 'description' to name the repository.
   commit bfcfa947f8a989594d73a40a056cbb0bd37188ab (patch)
   parent b1129d90 emacs: save undisplayer function for MIME parts
     tree 6a08991d91ee4b556d93df36bc1b86430a29b3d7
   author David Bremner <david@tethera.net>  2023-09-24 06:51:50 -0300
committer David Bremner <david@tethera.net>  2023-10-01 07:47:16 -0300

emacs/show: save redisplay redisplay data when showing lazy part.

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


glossary
--------
Commit objects reference one tree, and zero or more parents.

Single parent commits can typically generate a patch in
unified diff format via `git format-patch'.

Multiple parents means the commit is a merge.

Root commits have no ancestor.  Note that it is
possible to have multiple root commits when merging independent histories.

Every commit references one top-level tree object.

git clone https://yhetil.org/notmuch.git