mu4e-view: avoid cleaning up too much

In mu4e--view-cleanup-message-text (used for "reply citing") we were
removing all gnus "buttons", however gnus also includes buttons for
addresses, URLs etc., which should stay.

So be a bit let eager and only remove gnus-mm-display-part items.

Issue #2922
This commit is contained in:
Dirk-Jan C. Binnema
2026-04-20 21:54:27 +03:00
committed by Seth Ladygo
parent c09dfc432c
commit 105a93dd9e

View File

@ -517,20 +517,19 @@ As a side-effect, a message that is being viewed loses its
(goto-char (point-min))))) (goto-char (point-min)))))
(defun mu4e--view-cleanup-message-text () (defun mu4e--view-cleanup-message-text ()
"Clean up the rendered-message for use as cited text. "Clean up the rendered message for use as cited text in replies.
This expects to be called while in that message buffer. In particular, strip Gnus MIME-part buttons (e.g. attachment
lines like \"[2. foo.pdf --- application/pdf; foo.pdf]\") so
they do not end up in cited replies.
Strip Gnus MIME-part buttons (e.g. attachment lines like \"[2. This expects to be called while in that message buffer."
foo.pdf --- application/pdf; foo.pdf]\") so they do not end up in
cited replies.
The buttons are identified via the
`gnus-callback' text property that Gnus puts on them, rather than
by matching their textual format."
(let ((pos (point-min)) start) (let ((pos (point-min)) start)
(while (setq start (text-property-not-all (while (setq start (text-property-any
pos (point-max) 'gnus-callback nil)) pos (point-max)
;; filter out gnus-mm-display-part, not
;; _all_ buttons (#2922)
'gnus-callback 'gnus-mm-display-part))
(let* ((end (or (next-single-property-change (let* ((end (or (next-single-property-change
start 'gnus-callback nil (point-max)) start 'gnus-callback nil (point-max))
(point-max))) (point-max)))