mu4e-view: don't make clickables when already

Don't make clickable links when displaying in html mode already, since
in that case the html-render handles it, and we shouldn't mess up the
display.

As discussed in issue #2094.
This commit is contained in:
Dirk-Jan C. Binnema
2026-04-02 19:45:48 +03:00
committed by Seth Ladygo
parent d7b0001f96
commit 57fd152296

View File

@ -543,11 +543,19 @@ determine which browser function to use."
(xwidget-webkit-browse-url url)))) (xwidget-webkit-browse-url url))))
(mu4e-action-view-in-browser msg))) (mu4e-action-view-in-browser msg)))
(defun mu4e--view-html-displayed-p ()
"Is any text/html MIME part currently displayed?
Uses the MIME handle alist populated by Gnus after rendering."
(seq-find (lambda (handle)
(and (equal (mm-handle-media-type (cdr handle)) "text/html")
(mm-handle-displayed-p (cdr handle))))
gnus-article-mime-handle-alist))
(defun mu4e--view-render-buffer (msg) (defun mu4e--view-render-buffer (msg)
"Render current buffer with MSG using Gnus' article mode. "Render current buffer with MSG using Gnus' article mode.
The buffer must already contain the raw message. This function The buffer must already contain the raw message. This function
decodes and displays it, sets up the original-article-buffer, and decodes and displays it, sets up the original-article-buffer, and
activates URLs." activates URLs (in plain-text mode only)."
(let* ((inhibit-read-only t) (let* ((inhibit-read-only t)
;; Let gnus-summary-buffer be nil; all gnus-art.el code ;; Let gnus-summary-buffer be nil; all gnus-art.el code
;; guards its usage with `gnus-buffer-live-p' or ;; guards its usage with `gnus-buffer-live-p' or
@ -585,7 +593,11 @@ activates URLs."
;; just continue if some of the decoding fails. ;; just continue if some of the decoding fails.
(ignore-errors (run-hooks 'gnus-article-decode-hook)) (ignore-errors (run-hooks 'gnus-article-decode-hook))
(gnus-article-prepare-display) (gnus-article-prepare-display)
(mu4e--view-activate-urls) ;; Only activate URLs in plain-text mode; in HTML mode
;; the renderer already provides its own clickable links
;; (#2094).
(unless (mu4e--view-html-displayed-p)
(mu4e--view-activate-urls))
(kill-local-variable 'bookmark-make-record-function) (kill-local-variable 'bookmark-make-record-function)
(setq mu4e~gnus-article-mime-handles gnus-article-mime-handles (setq mu4e~gnus-article-mime-handles gnus-article-mime-handles
gnus-article-decoded-p gnus-article-decode-hook) gnus-article-decoded-p gnus-article-decode-hook)