notmuch.git  about / heads / tags
Unnamed repository; edit this file 'description' to name the repository.
   commit 0646d4855bff8b1f7ab10d5207cd66c9e75ea810 (patch)
   parent bfcfa947 emacs/show: save redisplay redisplay data when showing lazy part.
     tree cec21750ec7e8213f3c8533ba25bbf7776cfe593
   author David Bremner <david@tethera.net>  2023-09-24 06:51:51 -0300
committer David Bremner <david@tethera.net>  2023-10-01 07:47:16 -0300

emacs: save image redisplay data during non-lazy display

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))


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