mu4e-view: improve html/text toggling

Fix the mu4e-view-toggle-html switching, which could re-insert body
parts when an Attachments: header was present.

I.e. specifically toggle the part in the body.
This commit is contained in:
Dirk-Jan C. Binnema
2026-04-18 21:10:39 +03:00
committed by Seth Ladygo
parent e432d3d626
commit 04c02573e1

View File

@ -1091,8 +1091,12 @@ corresponding Gnus selector button in the buffer."
(lambda (h) (equal (mm-handle-media-type h) "text/plain")) (lambda (h) (equal (mm-handle-media-type h) "text/plain"))
children)) children))
(target (if (mm-handle-displayed-p html) plain html)) (target (if (mm-handle-displayed-p html) plain html))
(pos (text-property-any (point-min) (point-max) ;; Search from the body (this avoids find the wrong
'gnus-data target))) ;; `gnus-data' in the Attachments: header, if any.
(pos (save-excursion
(article-goto-body)
(text-property-any (point) (point-max)
'gnus-data target))))
(progn (progn
(goto-char pos) (goto-char pos)
(gnus-article-press-button) (gnus-article-press-button)