From 6f32ac371bd120aa39fe147ab31e048bf981012b Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 20 Feb 2019 01:28:19 -0500 Subject: [PATCH] Highlight non-standard whitespace in file buffers Prevents whitespace-mode from being enabled in special buffers (like circe). --- core/core-ui.el | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/core/core-ui.el b/core/core-ui.el index 125310083..a7c745a93 100644 --- a/core/core-ui.el +++ b/core/core-ui.el @@ -464,14 +464,13 @@ instead). Meant for `kill-buffer-query-functions'." e.g. If you indent with spaces by default, tabs will be highlighted. If you indent with tabs, spaces at BOL are highlighted. -Does nothing if `whitespace-mode' is already active or the current major mode is -derived from `special-mode'." +Does nothing if `whitespace-mode' is already active or the current buffer is +read-only or not file-visiting." (unless (or (bound-and-true-p global-whitespace-mode) (bound-and-true-p whitespace-mode) (eq major-mode 'fundamental-mode) - (eq (get major-mode 'mode-class) 'special) - (derived-mode-p 'special-mode) - buffer-read-only) + buffer-read-only + (null buffer-file-name)) (require 'whitespace) (set (make-local-variable 'whitespace-style) (if (bound-and-true-p whitespace-newline-mode)