Subject: bug#38421: Status: 27.0.50; Gnus fontifies patch attachments when gnus-visual is nil

From: Filipp Gunbin <[email-masked]>
Date: Fri, 29 Nov 2019 00:48:11 +0300

tags 38421 + patch
quit

>From 5ce40fc8e81a82d173e9cb17fa3390369b9b87f4 Mon Sep 17 00:00:00 2001
From: Filipp Gunbin <[email-masked]>
Date: Thu, 28 Nov 2019 23:24:40 +0300
Subject: [PATCH] Fontify inline article parts only if gnus-visual says to do
 so

* lisp/gnus/mm-view.el (mm-display-inline-fontify): Check gnus-visual
before calling font-lock-ensure.
---
 lisp/gnus/mm-view.el | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lisp/gnus/mm-view.el b/lisp/gnus/mm-view.el
index 559ec7a669..3762e866fb 100644
--- a/lisp/gnus/mm-view.el
+++ b/lisp/gnus/mm-view.el
@@ -32,6 +32,7 @@
 
 (autoload 'gnus-completing-read "gnus-util")
 (autoload 'gnus-article-prepare-display "gnus-art")
+(autoload 'gnus-visual-p "gnus")
 (autoload 'vcard-parse-string "vcard")
 (autoload 'vcard-format-string "vcard")
 (autoload 'fill-flowed "flow-fill")
@@ -499,8 +500,9 @@ mm-display-inline-fontify
 			 (copy-sequence auto-mode-alist))))
 	      (set-auto-mode)
 	      (setq mode major-mode)))
-	  ;; Do not fontify if the guess mode is fundamental.
-	  (unless (eq major-mode 'fundamental-mode)
+          (when (and (gnus-visual-p 'article-highlight 'highlight)
+                     ;; Do not fontify if the guessed mode is fundamental
+                     (not (eq major-mode 'fundamental-mode)))
 	    (font-lock-ensure))))
       (setq text (buffer-string))
       (when (eq mode 'diff-mode)
-- 
2.24.0