unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#38421: 27.0.50; Gnus fontifies patch attachments when gnus-visual is nil
@ 2019-11-28 19:08 Filipp Gunbin
  2019-11-28 21:48 ` bug#38421: Status: " Filipp Gunbin
  0 siblings, 1 reply; 6+ messages in thread
From: Filipp Gunbin @ 2019-11-28 19:08 UTC (permalink / raw)
  To: 38421


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





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#38421: Status: 27.0.50; Gnus fontifies patch attachments when gnus-visual is nil
  2019-11-28 19:08 bug#38421: 27.0.50; Gnus fontifies patch attachments when gnus-visual is nil Filipp Gunbin
@ 2019-11-28 21:48 ` Filipp Gunbin
  2019-12-17 12:55   ` Filipp Gunbin
       [not found]   ` <m2woavp0vb.fsf@fastmail.fm>
  0 siblings, 2 replies; 6+ messages in thread
From: Filipp Gunbin @ 2019-11-28 21:48 UTC (permalink / raw)
  To: bug#38421

[-- Attachment #1: Type: text/plain, Size: 25 bytes --]

tags 38421 + patch
quit


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 1401 bytes --]

From 5ce40fc8e81a82d173e9cb17fa3390369b9b87f4 Mon Sep 17 00:00:00 2001
From: Filipp Gunbin <fgunbin@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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#38421: Status: 27.0.50; Gnus fontifies patch attachments when gnus-visual is nil
  2019-11-28 21:48 ` bug#38421: Status: " Filipp Gunbin
@ 2019-12-17 12:55   ` Filipp Gunbin
       [not found]   ` <m2woavp0vb.fsf@fastmail.fm>
  1 sibling, 0 replies; 6+ messages in thread
From: Filipp Gunbin @ 2019-12-17 12:55 UTC (permalink / raw)
  To: emacs-devel; +Cc: bug#38421

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.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#38421: Status: 27.0.50; Gnus fontifies patch attachments when gnus-visual is nil
       [not found]   ` <m2woavp0vb.fsf@fastmail.fm>
@ 2020-07-19 15:20     ` Lars Ingebrigtsen
       [not found]     ` <87d04rpm53.fsf@gnus.org>
  1 sibling, 0 replies; 6+ messages in thread
From: Lars Ingebrigtsen @ 2020-07-19 15:20 UTC (permalink / raw)
  To: emacs-devel; +Cc: bug#38421

Filipp Gunbin <fgunbin@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





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#38421: Status: 27.0.50; Gnus fontifies patch attachments when gnus-visual is nil
       [not found]     ` <87d04rpm53.fsf@gnus.org>
@ 2020-08-02 17:45       ` Lars Ingebrigtsen
       [not found]       ` <87wo2heybz.fsf@gnus.org>
  1 sibling, 0 replies; 6+ messages in thread
From: Lars Ingebrigtsen @ 2020-08-02 17:45 UTC (permalink / raw)
  To: emacs-devel; +Cc: bug#38421

Lars Ingebrigtsen <larsi@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





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#38421: Status: 27.0.50; Gnus fontifies patch attachments when gnus-visual is nil
       [not found]       ` <87wo2heybz.fsf@gnus.org>
@ 2020-08-07 18:13         ` Filipp Gunbin
  0 siblings, 0 replies; 6+ messages in thread
From: Filipp Gunbin @ 2020-08-07 18:13 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: bug#38421

On 02/08/2020 19:45 +0200, Lars Ingebrigtsen wrote:

> Lars Ingebrigtsen <larsi@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





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-08-07 18:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-28 19:08 bug#38421: 27.0.50; Gnus fontifies patch attachments when gnus-visual is nil Filipp Gunbin
2019-11-28 21:48 ` bug#38421: Status: " Filipp Gunbin
2019-12-17 12:55   ` Filipp Gunbin
     [not found]   ` <m2woavp0vb.fsf@fastmail.fm>
2020-07-19 15:20     ` Lars Ingebrigtsen
     [not found]     ` <87d04rpm53.fsf@gnus.org>
2020-08-02 17:45       ` Lars Ingebrigtsen
     [not found]       ` <87wo2heybz.fsf@gnus.org>
2020-08-07 18:13         ` Filipp Gunbin

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).