2

With a vanilla install of Prelude and with C++-mode as my major mode, M-x whitespace-mode no longer shows whitespace characters. I get a message indicating that I am toggling whitespace-mode on and off but no whitespace is shown.

Has:

enter image description here

M-x whitespace-mode enter image description here

enter image description here

Want:

enter image description here

M-x whitespace-mode enter image description here

enter image description here

The prelude documentation actually says that it enables whitespace-mode.

https://github.com/bbatsov/prelude#disabling-whitespace-mode

How can I fix this or how can I debug this?

Prelude sets a bunch of minor modes. I turned off the ones that I could guess the "...-mode" function for but that didn't help. I don't know how to toggle most of these or even how to figure out how to toggle them.

enter image description here

4
  • Prelude enables Zenburn by default, and Zenburn shows spaces using colours instead of characters (the "." characters are still there, but it is hidden with foreground colour the same as Zenburn's background colour). Maybe you should try another theme or disable to see if it fixes problem, and then if you want to use Zenburn, customize whitespace-space face and set foreground colour to something else.
    – Tu Do
    Commented Feb 25, 2015 at 14:20
  • @TuDo I actually don't use zenburn. I just showed it that way because that's how Prelude comes out of the box. Even with the default theme I don't get any visualization of whitespace. Commented Feb 25, 2015 at 14:25
  • If that's the case with stock Prelude, you should consider submitting an issue.
    – Tu Do
    Commented Feb 25, 2015 at 14:52
  • github.com/bbatsov/prelude/issues/814 Commented Feb 25, 2015 at 15:13

1 Answer 1

1

I've had the same problem with Prelude.

The reason was that whitespace-style has the value (face tabs empty trailing lines-tail). It is set in .emacs.d/core/prelude-editor.el.

What whitespace-mode highlights seems to be governed by the value of whitespace-display-mappings, which was ((space-mark 32 [183] [46]) (space-mark 160 [164] [95]) (newline-mark 10 [36 10]) (tab-mark 9 [187 9] [92 9])) on my machine. The documentation of this variable contains the note:

Used when whitespace-style includes tab-mark, space-mark or newline-mark.

Which is not the case with an out-of-the-box prelude.

To fix it add these line to your configuration:

(add-to-list 'whitespace-style 'space-mark)
(add-to-list 'whitespace-style 'tab-mark)
(add-to-list 'whitespace-style 'newline-mark)

Evaluate it and restart whitespace mode.

(BTW, I assume this is not a bug in Prelude. Their strategy seems to be to highlight only whitespace errors with color. See here.)

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.