show-trailing-whitespace set to
t globally in my
.emacs file, and this is generally not a problem except for when I'm in
diff-mode looking at a patch which has mandatory trailing white space for blank context lines.
One solution would be to simply turn off
diff-mode in some relevant hook, but actually I'd like for trailing white space in change lines to still show up. For example, if I've accidentally introduced trailing white space or if I'm removing it, that's ok, and I still want that to show up in the
trailing-whitespace face. I just don't want the blank context lines to be treated as trailing white space since they are necessary for the diff format itself.
Here's an example of the current behavior that I get:
And this is what I would like:
Here's another example, but this time, with actual whitespace addition:
However if I disable
show-trailing-whitespace entirely in
diff-mode, then I wouldn't see any dark red at all. Instead, this is what I'm wanting:
Basically, I think this involves making
show-trailing-whitespace aware that diff lines with just a single space are special.