When I run

(setq-default show-trailing-whitespace t)

on startup, the Echo Area is affected. I can usually turn this off with hooks, e.g.

  (add-hook 'minibuffer-setup-hook
    (lambda () (setq show-trailing-whitespace nil)))
  (add-hook 'messages-buffer-mode-hook
    (lambda () (setq show-trailing-whitespace nil)))

However, I can't seem to find a suitable hook in this case. I'm used to inspecting modes of a buffer with C-h m, but the Echo Area disappears when clicked with a mouse or typing resumes.

The only Echo Area hook I can find mention of doesn't seem to do the trick:

  (add-hook 'echo-area-clear-hook
    (lambda () (setq show-trailing-whitespace nil)))

Defaulting show-trailing-whitespace to nil does turn off trailing whitespace showing in the Echo Area, but would necessitate manual enumeration of all modes in which to turn it on.

How can one disable show-trailing-whitespace in the Echo Area if the setting is defaulted to true?

1 Answer 1


The following solves the problem:

(with-current-buffer " *Echo Area 0*" (setq show-trailing-whitespace nil))

I'm not yet sure how robust/permanent this is; i.e., whether "*Echo Area 1*", "*Echo Area 2*"..., "*Echo Area n*" might eventually be created and need similar treatment.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.