summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDirk-Jan C. Binnema <djcb@djcbsoftware.nl>2026-04-18 21:10:39 +0300
committerDirk-Jan C. Binnema <djcb@djcbsoftware.nl>2026-04-18 21:10:39 +0300
commit57f36666cf322fbe8cda894b860aa7a299bdedd5 (patch)
treeeb3493f18d9b9fe7cdcb74cc8de7029853e048df
parented83a695c199e8acf7afcc32004d7bf8a392f9d3 (diff)
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.
-rw-r--r--mu4e/mu4e-view.el8
1 files changed, 6 insertions, 2 deletions
diff --git a/mu4e/mu4e-view.el b/mu4e/mu4e-view.el
index 2b9dda2..7ee4761 100644
--- a/mu4e/mu4e-view.el
+++ b/mu4e/mu4e-view.el
@@ -1091,8 +1091,12 @@ corresponding Gnus selector button in the buffer."
(lambda (h) (equal (mm-handle-media-type h) "text/plain"))
children))
(target (if (mm-handle-displayed-p html) plain html))
- (pos (text-property-any (point-min) (point-max)
- 'gnus-data target)))
+ ;; Search from the body (this avoids find the wrong
+ ;; `gnus-data' in the Attachments: header, if any.
+ (pos (save-excursion
+ (article-goto-body)
+ (text-property-any (point) (point-max)
+ 'gnus-data target))))
(progn
(goto-char pos)
(gnus-article-press-button)