GNU bug report logs - #38421
27.0.50; Gnus fontifies patch attachments when gnus-visual is nil

Previous Next

Package: emacs;

Reported by: Filipp Gunbin <fgunbin <at> fastmail.fm>

Date: Thu, 28 Nov 2019 19:21:02 UTC

Severity: normal

Tags: fixed

Found in version 27.0.50

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 38421 in the body.
You can then email your comments to 38421 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#38421; Package emacs. (Thu, 28 Nov 2019 19:21:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Filipp Gunbin <fgunbin <at> fastmail.fm>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 28 Nov 2019 19:21:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Filipp Gunbin <fgunbin <at> fastmail.fm>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.50; Gnus fontifies patch attachments when gnus-visual is nil
Date: Thu, 28 Nov 2019 22:08:28 +0300
When gnus-visual is nil, attachments of type text/x-patch (and probably
others) still get fontified when Gnus displays them inline.

I have a patch, will attach it soon.
Thanks.


In GNU Emacs 27.0.50 (build 9, x86_64-apple-darwin19.0.0, NS appkit-1894.10 Version 10.15.1 (Build 19B88))
 of 2019-11-28 built on fgunbin.local
Repository revision: b05aa8d742d80aeb692c54289e8ccb074a68bf51
Repository branch: master
System Description:  Mac OS X 10.15.1




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38421; Package emacs. (Thu, 28 Nov 2019 21:49:01 GMT) Full text and rfc822 format available.

Message #8 received at 38421 <at> debbugs.gnu.org (full text, mbox):

From: Filipp Gunbin <fgunbin <at> fastmail.fm>
To: bug#38421 <38421 <at> debbugs.gnu.org>
Subject: Re: Status: 27.0.50; Gnus fontifies patch attachments when
 gnus-visual is nil
Date: Fri, 29 Nov 2019 00:48:11 +0300
[Message part 1 (text/plain, inline)]
tags 38421 + patch
quit

[0001-Fontify-inline-article-parts-only-if-gnus-visual-say.patch (text/x-diff, inline)]
From 5ce40fc8e81a82d173e9cb17fa3390369b9b87f4 Mon Sep 17 00:00:00 2001
From: Filipp Gunbin <fgunbin <at> fastmail.fm>
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


Added tag(s) patch. Request was from Filipp Gunbin <fgunbin <at> fastmail.fm> to control <at> debbugs.gnu.org. (Thu, 28 Nov 2019 21:49:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38421; Package emacs. (Tue, 17 Dec 2019 12:57:01 GMT) Full text and rfc822 format available.

Message #13 received at 38421 <at> debbugs.gnu.org (full text, mbox):

From: Filipp Gunbin <fgunbin <at> fastmail.fm>
To: emacs-devel <at> gnu.org
Cc: bug#38421 <38421 <at> debbugs.gnu.org>
Subject: Re: bug#38421: Status: 27.0.50; Gnus fontifies patch attachments
 when gnus-visual is nil
Date: Tue, 17 Dec 2019 15:55:52 +0300
Could someone please review the patch? (bug#38421)

It's simple, but I'm not sure about using gnus-visual-p in mm-* files.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38421; Package emacs. (Sun, 19 Jul 2020 15:21:01 GMT) Full text and rfc822 format available.

Message #16 received at 38421 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: emacs-devel <at> gnu.org
Cc: bug#38421 <38421 <at> debbugs.gnu.org>
Subject: Re: bug#38421: Status: 27.0.50; Gnus fontifies patch attachments
 when gnus-visual is nil
Date: Sun, 19 Jul 2020 17:20:08 +0200
Filipp Gunbin <fgunbin <at> fastmail.fm> writes:

> Could someone please review the patch? (bug#38421)
>
> It's simple, but I'm not sure about using gnus-visual-p in mm-* files.

I don't think we can use that function there, because these are general
utility functions (used by mh-e, for instance).

As the comment in mm-view.el says:

;; Shouldn't these functions check whether the user even wants to use
;; font-lock?

They should, indeed.  But I'm not quite sure what the correct approach
for the application (that is Gnus) to inhibit these functions...

What functions to use is decided by mm-inline-media-tests, and there's
no way to use one version if we want highlights and another if we
don't...

Anybody got any ideas here?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Removed tag(s) patch. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 19 Jul 2020 15:21:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38421; Package emacs. (Sun, 02 Aug 2020 17:46:02 GMT) Full text and rfc822 format available.

Message #21 received at 38421 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: emacs-devel <at> gnu.org
Cc: bug#38421 <38421 <at> debbugs.gnu.org>
Subject: Re: bug#38421: Status: 27.0.50; Gnus fontifies patch attachments
 when gnus-visual is nil
Date: Sun, 02 Aug 2020 19:45:20 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> What functions to use is decided by mm-inline-media-tests, and there's
> no way to use one version if we want highlights and another if we
> don't...
>
> Anybody got any ideas here?

Apparently not, so I added a variable callers (like Gnus) can bind to
switch font-locking off.  Seems to work OK for me (in Emacs 28).

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 02 Aug 2020 17:46:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 38421 <at> debbugs.gnu.org and Filipp Gunbin <fgunbin <at> fastmail.fm> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 02 Aug 2020 17:46:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38421; Package emacs. (Fri, 07 Aug 2020 18:14:02 GMT) Full text and rfc822 format available.

Message #28 received at 38421 <at> debbugs.gnu.org (full text, mbox):

From: Filipp Gunbin <fgunbin <at> fastmail.fm>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: bug#38421 <38421 <at> debbugs.gnu.org>
Subject: Re: bug#38421: Status: 27.0.50; Gnus fontifies patch attachments
 when gnus-visual is nil
Date: Fri, 07 Aug 2020 21:13:23 +0300
On 02/08/2020 19:45 +0200, Lars Ingebrigtsen wrote:

> Lars Ingebrigtsen <larsi <at> gnus.org> writes:
>
>> What functions to use is decided by mm-inline-media-tests, and there's
>> no way to use one version if we want highlights and another if we
>> don't...
>>
>> Anybody got any ideas here?
>
> Apparently not, so I added a variable callers (like Gnus) can bind to
> switch font-locking off.  Seems to work OK for me (in Emacs 28).

Thanks!
Filipp




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 05 Sep 2020 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 204 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.