I have `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 `show-trailing-whitespace` in `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:

![enter image description here](https://i.stack.imgur.com/8bUrS.png)

And this is what I would like:

![enter image description here](https://i.stack.imgur.com/mZxta.png)

Here's another example, but this time, with *actual* whitespace addition:

![enter image description here](https://i.stack.imgur.com/DhRRt.png)

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:

![enter image description here](https://i.stack.imgur.com/jX5Ap.png)

Basically, I think this involves making `show-trailing-whitespace` aware that diff lines with just a single space are special.