emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 2ad38b4: If gnus-visual is nil, don't fontify patches and the lik


From: Lars Ingebrigtsen
Subject: master 2ad38b4: If gnus-visual is nil, don't fontify patches and the like
Date: Sun, 2 Aug 2020 13:44:43 -0400 (EDT)

branch: master
commit 2ad38b4745bf0203ca9ca0fe2eeb376943d384c6
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    If gnus-visual is nil, don't fontify patches and the like
    
    * doc/misc/emacs-mime.texi (Display Customization): Document it.
    
    * lisp/gnus/gnus-art.el (gnus-mime-display-single): Bind it.
    
    * lisp/gnus/mm-view.el (mm-inline-font-lock): New variable (bug#38421).
    (mm-display-inline-fontify): Use it.
---
 doc/misc/emacs-mime.texi |  7 +++++++
 etc/NEWS                 |  6 ++++++
 lisp/gnus/gnus-art.el    |  1 +
 lisp/gnus/mm-view.el     | 10 ++++++++--
 4 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/doc/misc/emacs-mime.texi b/doc/misc/emacs-mime.texi
index 2f38dcd..974cc10 100644
--- a/doc/misc/emacs-mime.texi
+++ b/doc/misc/emacs-mime.texi
@@ -472,6 +472,13 @@ the case if you save it to disk and launch it in a 
different way
 to launch any external programs, set this variable to @code{nil} or
 @code{ask}.
 
+@item mm-inline-font-lock
+@vindex mm-inline-font-lock
+If non-@code{nil}, inlined parts that support font locking (for
+instance, patches or code snippets) will be font-locked.  This may be
+overriden by callers that have their own ways of enabling/inhibiting
+font locking.
+
 @end table
 
 @node Files and Directories
diff --git a/etc/NEWS b/etc/NEWS
index aeba96e..7221c9c 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -231,6 +231,12 @@ was sent.  To restore the original behavior of dating a 
message
 from when it is first saved or delayed, add the symbol 'Date' back to
 this user option.
 
++++
+*** New variable 'mm-inline-font-lock'.
+This variable is supposed to be bound by callers to determine whether
+inline MIME parts (that support it) are supposed to be font-locked or
+not.
+
 ** Help
 
 +++
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el
index cb20d71..d33539b 100644
--- a/lisp/gnus/gnus-art.el
+++ b/lisp/gnus/gnus-art.el
@@ -6018,6 +6018,7 @@ If nil, don't show those extra buttons."
 (defun gnus-mime-display-single (handle)
   (let ((type (mm-handle-media-type handle))
        (ignored gnus-ignored-mime-types)
+       (mm-inline-font-lock (gnus-visual-p 'article-highlight 'highlight))
        (not-attachment t)
        display text)
     (catch 'ignored
diff --git a/lisp/gnus/mm-view.el b/lisp/gnus/mm-view.el
index 828ac63..bd5960c 100644
--- a/lisp/gnus/mm-view.el
+++ b/lisp/gnus/mm-view.el
@@ -59,11 +59,16 @@
   "The attributes of renderer types for text/html.")
 
 (defcustom mm-fill-flowed t
-  "If non-nil a format=flowed article will be displayed flowed."
+  "If non-nil, format=flowed articles will be displayed flowed."
   :type 'boolean
   :version "22.1"
   :group 'mime-display)
 
+;; Not a defcustom, since it's usually overridden by the callers of
+;; the mm functions.
+(defvar mm-inline-font-lock t
+  "If non-nil, do font locking of inline media types that support it.")
+
 (defcustom mm-inline-large-images-proportion 0.9
   "Maximum proportion large images can occupy in the buffer.
 This is only used if `mm-inline-large-images' is set to
@@ -502,7 +507,8 @@ If MODE is not set, try to find mode automatically."
              (delay-mode-hooks (set-auto-mode))
              (setq mode major-mode)))
          ;; Do not fontify if the guess mode is fundamental.
-         (unless (eq major-mode 'fundamental-mode)
+         (when (and (not (eq major-mode 'fundamental-mode))
+                    mm-inline-font-lock)
            (font-lock-ensure))))
       (setq text (buffer-string))
       (when (eq mode 'diff-mode)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]