Commit 2ad38b47 authored by Lars Ingebrigtsen's avatar Lars Ingebrigtsen

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.
parent 94b6eb80
Pipeline #6210 failed with stage
in 25 seconds
......@@ -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
......
......@@ -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
+++
......
......@@ -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
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment