From 57fd152296b9bd753f8448b6bbe24d953627afb6 Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Thu, 2 Apr 2026 19:45:48 +0300 Subject: [PATCH] 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. --- mu4e/mu4e-view.el | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/mu4e/mu4e-view.el b/mu4e/mu4e-view.el index 418d7f71..13849d33 100644 --- a/mu4e/mu4e-view.el +++ b/mu4e/mu4e-view.el @@ -543,11 +543,19 @@ determine which browser function to use." (xwidget-webkit-browse-url url)))) (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) "Render current buffer with MSG using Gnus' article mode. The buffer must already contain the raw message. This function 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 gnus-summary-buffer be nil; all gnus-art.el code ;; guards its usage with `gnus-buffer-live-p' or @@ -585,7 +593,11 @@ activates URLs." ;; just continue if some of the decoding fails. (ignore-errors (run-hooks 'gnus-article-decode-hook)) (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) (setq mu4e~gnus-article-mime-handles gnus-article-mime-handles gnus-article-decoded-p gnus-article-decode-hook)