aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2020-08-02 19:44:30 +0200
committerLars Ingebrigtsen2020-08-02 19:44:30 +0200
commit2ad38b4745bf0203ca9ca0fe2eeb376943d384c6 (patch)
treee0e3fe0de250802e5ed5d6d267b4d97a396a9f25
parent94b6eb807c8991897796fd18ccd414c7d9b9ad3b (diff)
downloademacs-2ad38b4745bf0203ca9ca0fe2eeb376943d384c6.tar.gz
emacs-2ad38b4745bf0203ca9ca0fe2eeb376943d384c6.zip
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.
-rw-r--r--doc/misc/emacs-mime.texi7
-rw-r--r--etc/NEWS6
-rw-r--r--lisp/gnus/gnus-art.el1
-rw-r--r--lisp/gnus/mm-view.el10
4 files changed, 22 insertions, 2 deletions
diff --git a/doc/misc/emacs-mime.texi b/doc/misc/emacs-mime.texi
index 2f38dcd4956..974cc10458d 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
472to launch any external programs, set this variable to @code{nil} or 472to launch any external programs, set this variable to @code{nil} or
473@code{ask}. 473@code{ask}.
474 474
475@item mm-inline-font-lock
476@vindex mm-inline-font-lock
477If non-@code{nil}, inlined parts that support font locking (for
478instance, patches or code snippets) will be font-locked. This may be
479overriden by callers that have their own ways of enabling/inhibiting
480font locking.
481
475@end table 482@end table
476 483
477@node Files and Directories 484@node Files and Directories
diff --git a/etc/NEWS b/etc/NEWS
index aeba96e3811..7221c9cf9e6 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -231,6 +231,12 @@ was sent. To restore the original behavior of dating a message
231from when it is first saved or delayed, add the symbol 'Date' back to 231from when it is first saved or delayed, add the symbol 'Date' back to
232this user option. 232this user option.
233 233
234+++
235*** New variable 'mm-inline-font-lock'.
236This variable is supposed to be bound by callers to determine whether
237inline MIME parts (that support it) are supposed to be font-locked or
238not.
239
234** Help 240** Help
235 241
236+++ 242+++
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el
index cb20d7102bd..d33539bc7f7 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."
6018(defun gnus-mime-display-single (handle) 6018(defun gnus-mime-display-single (handle)
6019 (let ((type (mm-handle-media-type handle)) 6019 (let ((type (mm-handle-media-type handle))
6020 (ignored gnus-ignored-mime-types) 6020 (ignored gnus-ignored-mime-types)
6021 (mm-inline-font-lock (gnus-visual-p 'article-highlight 'highlight))
6021 (not-attachment t) 6022 (not-attachment t)
6022 display text) 6023 display text)
6023 (catch 'ignored 6024 (catch 'ignored
diff --git a/lisp/gnus/mm-view.el b/lisp/gnus/mm-view.el
index 828ac633dc5..bd5960c18b2 100644
--- a/lisp/gnus/mm-view.el
+++ b/lisp/gnus/mm-view.el
@@ -59,11 +59,16 @@
59 "The attributes of renderer types for text/html.") 59 "The attributes of renderer types for text/html.")
60 60
61(defcustom mm-fill-flowed t 61(defcustom mm-fill-flowed t
62 "If non-nil a format=flowed article will be displayed flowed." 62 "If non-nil, format=flowed articles will be displayed flowed."
63 :type 'boolean 63 :type 'boolean
64 :version "22.1" 64 :version "22.1"
65 :group 'mime-display) 65 :group 'mime-display)
66 66
67;; Not a defcustom, since it's usually overridden by the callers of
68;; the mm functions.
69(defvar mm-inline-font-lock t
70 "If non-nil, do font locking of inline media types that support it.")
71
67(defcustom mm-inline-large-images-proportion 0.9 72(defcustom mm-inline-large-images-proportion 0.9
68 "Maximum proportion large images can occupy in the buffer. 73 "Maximum proportion large images can occupy in the buffer.
69This is only used if `mm-inline-large-images' is set to 74This 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."
502 (delay-mode-hooks (set-auto-mode)) 507 (delay-mode-hooks (set-auto-mode))
503 (setq mode major-mode))) 508 (setq mode major-mode)))
504 ;; Do not fontify if the guess mode is fundamental. 509 ;; Do not fontify if the guess mode is fundamental.
505 (unless (eq major-mode 'fundamental-mode) 510 (when (and (not (eq major-mode 'fundamental-mode))
511 mm-inline-font-lock)
506 (font-lock-ensure)))) 512 (font-lock-ensure))))
507 (setq text (buffer-string)) 513 (setq text (buffer-string))
508 (when (eq mode 'diff-mode) 514 (when (eq mode 'diff-mode)