mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-24 20:08:10 +01:00
emacs/show: special case toggling display of images
According to emacs upstream [1], we can't expect overlay invisibility and images to get along. This commit uses the previously stashed undisplayer functions to actually remove the images from the buffer. When the image is toggled, it is essentially redisplayed from scratch, using the previously stashed redisplay data. [1]: https://lists.gnu.org/archive/html/emacs-devel/2023-08/msg00593.html
This commit is contained in:
parent
0646d4855b
commit
a064a25427
1 changed files with 18 additions and 2 deletions
|
@ -644,8 +644,24 @@ message at DEPTH in the current thread."
|
||||||
(when show
|
(when show
|
||||||
(button-put button :notmuch-lazy-part nil)
|
(button-put button :notmuch-lazy-part nil)
|
||||||
(notmuch-show-lazy-part lazy-part button))
|
(notmuch-show-lazy-part lazy-part button))
|
||||||
;; else there must be an overlay.
|
(let* ((part (plist-get properties :notmuch-part))
|
||||||
(overlay-put overlay 'invisible (not show))
|
(undisplayer (plist-get part :undisplayer))
|
||||||
|
(mime-type (plist-get part :computed-type))
|
||||||
|
(redisplay-data (button-get button
|
||||||
|
:notmuch-redisplay-data))
|
||||||
|
(imagep (string-match "^image/" mime-type)))
|
||||||
|
(cond
|
||||||
|
((and imagep (not show) undisplayer)
|
||||||
|
;; call undisplayer thunk created by gnus.
|
||||||
|
(funcall undisplayer)
|
||||||
|
;; there is an extra newline left
|
||||||
|
(delete-region
|
||||||
|
(+ 1 (button-end button))
|
||||||
|
(+ 2 (button-end button))))
|
||||||
|
((and imagep show redisplay-data)
|
||||||
|
(notmuch-show-lazy-part redisplay-data button))
|
||||||
|
(t
|
||||||
|
(overlay-put overlay 'invisible (not show)))))
|
||||||
t)))))))
|
t)))))))
|
||||||
|
|
||||||
;;; Part content ID handling
|
;;; Part content ID handling
|
||||||
|
|
Loading…
Reference in a new issue