I generally like
show-trailing-whitespace. But it's distracting in shell/REPL modes, where for instance completion may leave a trailing space (e.g.
ls foo TAB RET in
shell-mode). Plus I'm not git- or diff-ing the contents.
What I came up with for my
;; Show trailing whitespace in most modes... (setq-default show-trailing-whitespace t) ;; ...except I don't like that in comint-modes (shells/REPLs), because ;; completion sometimes leaving a trailing space that's distracting to ;; have highlighted, and anyway I'm not git- or diff-ing the contents. (add-hook 'comint-mode-hook (lambda () (setq show-trailing-whitespace nil)))
As far as I can tell this is working fine. But I wonder if someone more-experienced might say, "The problem with doing it that way is X", or, "The idiomatic way to do that instead is Y"?
(I realize this might border on being an opinion or "best way" type of question. So I apologize in advance if it's not appropriate. But knowing the answer would help me, and maybe some other folks.)