Fix recent whitespace.el changes
* etc/NEWS (Changes in Specialized Modes and Packages in Emacs 31.1): Announce new user option whitespace-global-mode-buffers (bug#79230). * lisp/whitespace.el (whitespace-global-modes): Improve docstring grammar. (whitespace-global-mode-buffers): Make default value match *scratch* exactly for backward compatibility. Fix custom :type. (whitespace-enable-predicate): Prefer any over seq-find.
This commit is contained in:
9
etc/NEWS
9
etc/NEWS
@@ -1760,6 +1760,15 @@ If 'page-delimiters' is set in 'whitespace-style', or the new minor mode
|
||||
width of the window. The new 'whitespace-page-delimiter' face can be
|
||||
used to customize the appearance.
|
||||
|
||||
---
|
||||
*** New user option 'whitespace-global-mode-buffers'.
|
||||
Normally, 'global-whitespace-mode' skips special buffers whose name
|
||||
starts with an asterisk '*'. This user option provides an override: it
|
||||
contains a list of regular expressions used to match the names of
|
||||
special buffers in which 'global-whitespace-mode' should turn on. The
|
||||
default value preserves the existing exception for the "*scratch*"
|
||||
buffer.
|
||||
|
||||
** Bookmark
|
||||
|
||||
---
|
||||
|
||||
@@ -907,8 +907,8 @@ means that `whitespace-mode' is turned on for buffers in C and
|
||||
C++ modes only.
|
||||
|
||||
Global `whitespace-mode' will not automatically turn on in internal
|
||||
buffers (with name starting from space) and special buffers (with name
|
||||
starting from \"*\"), except \"*scratch*\" buffer. Use
|
||||
buffers (whose name starts with a space) and special buffers (whose name
|
||||
starts with \"*\"), with the exception of the \"*scratch*\" buffer. Use
|
||||
`whitespace-global-mode-buffers' to customize this behavior."
|
||||
:type '(choice :tag "Global Modes"
|
||||
(const :tag "None" nil)
|
||||
@@ -919,11 +919,11 @@ starting from \"*\"), except \"*scratch*\" buffer. Use
|
||||
(repeat :inline t
|
||||
(symbol :tag "Mode")))))
|
||||
|
||||
(defcustom whitespace-global-mode-buffers (list (regexp-quote "*scratch*"))
|
||||
(defcustom whitespace-global-mode-buffers (list (rx bos "*scratch*" eos))
|
||||
"Buffer name regexps where global `whitespace-mode' can be auto-enabled.
|
||||
The value is a list of regexps. Set this custom option when you need
|
||||
`whitespace-mode' in special buffers like *Org Src*."
|
||||
:type '(list (regexp :tag "Regexp matching buffer name"))
|
||||
`whitespace-mode' in special buffers like \"*Org Src*\"."
|
||||
:type '(repeat (regexp :tag "Regexp matching buffer name"))
|
||||
:version "31.1")
|
||||
|
||||
(defcustom whitespace-action nil
|
||||
@@ -1049,14 +1049,13 @@ See also `whitespace-newline' and `whitespace-display-mappings'."
|
||||
;; ...we have a display (not running a batch job)
|
||||
(not noninteractive)
|
||||
;; ...the buffer is not internal (name starts with a space)
|
||||
(not (eq (aref (buffer-name) 0) ?\ ))
|
||||
(not (eq (aref (buffer-name) 0) ?\s))
|
||||
;; ...the buffer is not special (name starts with *)
|
||||
(or (not (eq (aref (buffer-name) 0) ?*))
|
||||
;; except the scratch buffer.
|
||||
(seq-find
|
||||
(lambda (re)
|
||||
(string-match-p re (buffer-name)))
|
||||
whitespace-global-mode-buffers))))
|
||||
;; except, e.g., the scratch buffer.
|
||||
(any (lambda (re)
|
||||
(string-match-p re (buffer-name)))
|
||||
whitespace-global-mode-buffers))))
|
||||
"Predicate to decide which buffers obey `global-whitespace-mode'.
|
||||
This function is called with no argument and should return non-nil
|
||||
if the current buffer should obey `global-whitespace-mode'.
|
||||
|
||||
Reference in New Issue
Block a user