I'm trying to use the flag show-trailing-white-space and it usually shows me what I want. I.e., I never want dangling white space at the end of a line containing text. However, between lines of text, I really don't care that there is white space. In fact, the editor enforces white space which is for indentation purposes.

In the image shown here, the red mark between :empty-set and :else is really annoying, but the red marks at the end of the other three lines is helpful.

Is there a way to tell show-trailing-white-space either to ignore any whitespace starting at the beginning of a line, or perhaps ignore indentation white space, or perhaps ignore whitespace before the first non-white-space-character?

enter image description here


1 Answer 1


Looks like it's displaying trailing whitespaces and some kind of indenting whitespaces. Look at whitespace-toggle-options documentation and this manual page.

  • sorry, but I don't understand your comment. The page you mention is indeed the documentation I was reading relevant to show-trailing-white-space. Are you suggesting there is an option to ignore blank lines. I see an option to ignore blank lines only at the beginning or end of file. Perhaps you see something in the docs that I don't see?
    – Jim Newton
    Commented Apr 5, 2020 at 9:41
  • I'm guessing your config is taking account of indenting whitespaces, either spaces or tabs and/or newlines, not just blank lines. Can't tell more from a screen capture.
    – Muihlinn
    Commented Apr 5, 2020 at 10:13
  • if whitespace-cleanup takes care of those "blank" lines, it's what I was pointing up.
    – Muihlinn
    Commented Apr 5, 2020 at 10:24
  • No, in my screen capture, there is a line which contains no text, but is highlighted anyway. In my opinion this is not problematic trailing white space and should be ignored by show-tailing-white-space sorry if that wasn't clear from my OP. I'd like to tell show-trailing-white-space to ignore lines which contain only white space.
    – Jim Newton
    Commented Apr 5, 2020 at 12:04
  • OK, I do understand now that you're not using whitespace-mode. I guess you can customize whitespace-trailing-regexp to your needs, but probably it'll have unwanted side effects. I'd rather put delete-trailing-whitespace in your before-save-hook to delete unneeded whitespaces and fix visualization at once.
    – Muihlinn
    Commented Apr 5, 2020 at 15:56

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.