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.
This commit is contained in:
David Bremner 2023-09-24 06:51:51 -03:00
parent bfcfa947f8
commit 0646d4855b

View file

@ -1109,14 +1109,18 @@ is t, hide the part initially and show the button."
(and deep button) (and deep button)
(and high button) (and high button)
(and long 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). ;; Store the computed mime-type for later use (e.g. by attachment handlers).
(plist-put part :computed-type mime-type) (plist-put part :computed-type mime-type)
(if show-part (cond
(notmuch-show-insert-bodypart-internal msg part mime-type nth depth button) (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 (when button
(button-put button :notmuch-lazy-part (button-put button :notmuch-lazy-part part-data))))
(list msg part mime-type nth depth button))))
;; Some of the body part handlers leave point somewhere up in the ;; Some of the body part handlers leave point somewhere up in the
;; part, so we make sure that we're down at the end. ;; part, so we make sure that we're down at the end.
(goto-char (point-max)) (goto-char (point-max))