Subject: bug#78201: Suggest show-trailing-whitespace customize option "unless special"

From: Joel Reicher <[email-masked]>
Date: Fri, 02 May 2025 12:09:03 +1000

A global value of t for show-trailing-whitespace is often not 
useful as some special modes insert trailing whitespace that can't 
(by definition) be edited.

When users want something like this they probably "really mean" to 
show trailing whitespace in all and only editable modes, 
i.e. non-special ones.

I've had pretty good success with

(add-hook 'change-major-mode-after-body-hook (lambda () (if (not 
(eq (get major-mode 'mode-class) 'special)) (setq 
show-trailing-whitespace t))))

which also allows an explicit exception for diff mode (as 
mentioned in bug#75993 it was missing the special mode class).

Thanks and regards,

       - Joel