I like having non-breaking spaces and a few other characters represented in my buffer as visible characters. The problem I have is that whitespace-mode seems determined to set the background color. In modes where the background color is different (for example, in src blocks in Org), the ordinary space characters are really obtrusive.

I can workaround this by not having those blocks appear in a different background color, but that seems like it shouldn't be necessary.

I've tried a few things that I've found by searching, but none appear to work.

  • Here is a link to an example where I take a few characters such as an en-dash and an em-dash and assign a different arbitrary face to the substituted characters: emacs.stackexchange.com/a/9627/2287 It is not necessary to substitute with different characters. You can take a non-breaking space and assign a face with only a foreground specified. I did not write up an answer to your question because you want a whitespace-mode specific answer, and more would be required such as a recipe to reproduce what it is you are seeing so that a whitespace-mode only answer can be written.
    – lawlist
    Oct 17, 2019 at 19:15
  • FYI: nobreak-space is an Emacs face that can be customized; e.g., M-x customize-face. You can remove or change the background color if so desired ... Here is how one might programmatically set a face with a foreground color of blue and no background color: (face-spec-set 'nobreak-space '((t :foreground "blue"))). There other functions that are more popularly used to set faces; e.g., set-face-attribute, etc.
    – lawlist
    Oct 17, 2019 at 19:31

1 Answer 1


I eventually concluded that this was interaction between whitespace-mode attempting to use faces and Org mode attempting to use faces and the result just being incompatible. I told whitespace-mode to stop using faces and the result...better.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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