Fix whitespace-mode display table restoration logic

* lisp/whitespace.el (whitespace-display-char-on): Fix the saving
logic -- `whitespace-mode' is on by this point (bug#48583).
This commit is contained in:
Lars Ingebrigtsen 2022-07-15 12:07:19 +02:00
parent 0f59d7b53b
commit 29eb459695

View file

@ -2403,9 +2403,11 @@ to `indent-tabs-mode' and `tab-width'."
;; Remember whether a buffer has a local display table.
(unless whitespace-display-table-was-local
(setq whitespace-display-table-was-local t)
(unless (or whitespace-mode global-whitespace-mode)
(setq whitespace-display-table
(copy-sequence buffer-display-table)))
;; Save the old table so we can restore it when
;; `whitespace-mode' is switched off again.
(when (or whitespace-mode global-whitespace-mode)
(setq whitespace-display-table
(copy-sequence buffer-display-table)))
;; Assure `buffer-display-table' is unique
;; when two or more windows are visible.
(setq buffer-display-table