From f21feaf00e78087dc6bed930695f449a52541bee Mon Sep 17 00:00:00 2001 From: YugaEgo Date: Wed, 27 Jul 2022 11:52:01 +0200 Subject: [PATCH] Improve 'diff-whitespace-style' user option declaration * lisp/vc/diff-mode.el (diff-whitespace-style): Use ':require'. Minor docstring fix. (top level): Do not require 'whitespace. (whitespace-style, whitespace-trailing-regexp): Add defvars (rollback recent removal). * etc/NEWS: Extend 'diff-whitespace-style' introduction. (Bug#56679) (bug#56679). --- etc/NEWS | 4 +++- lisp/vc/diff-mode.el | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 7c1462ee573..b79e216aa02 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1206,7 +1206,9 @@ contents. --- *** New user option 'diff-whitespace-style'. -This option determines buffer-local 'whitespace-style' value. +Sets the value of the buffer-local variable 'whitespace-style' in +'diff-mode' buffers. By default, this variable is '(face trailing)', +which preserves behavior from previous Emacs versions. ** Ispell diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index 8d9caf35a3b..aa426446d73 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -56,7 +56,6 @@ (eval-when-compile (require 'cl-lib)) (eval-when-compile (require 'subr-x)) (require 'easy-mmode) -(require 'whitespace) (autoload 'vc-find-revision "vc") (autoload 'vc-find-revision-no-save "vc") @@ -149,7 +148,8 @@ and hunk-based syntax highlighting otherwise as a fallback." (const :tag "Allow hunk-based fallback" hunk-also))) (defcustom diff-whitespace-style '(face trailing) - "Specify `whitespace-style' variable for the current Diff mode buffer." + "Specify `whitespace-style' variable for `diff-mode' buffers." + :require 'whitespace :type (get 'whitespace-style 'custom-type) :version "29.1") @@ -1490,6 +1490,9 @@ See `after-change-functions' for the meaning of BEG, END and LEN." (nconc minor-mode-map-alist (list (cons 'diff-mode-read-only diff-mode-shared-map)))) +(defvar whitespace-style) +(defvar whitespace-trailing-regexp) + ;;;###autoload (define-derived-mode diff-mode fundamental-mode "Diff" "Major mode for viewing/editing context diffs. -- 2.39.2