emacswhitespacelong-lines

how to unset the foreground color of whitespace-mode for Emacs


In programming files, I use whitespace-mode to highlight the tab and long lines. The default highlighting is too garnish for me.I just want to highlight them with a gray background and keep whatever normal color it should be for the font. How could I set that?

The following setup does not work. I'd like the code beyond 80 columns appearing yellowish, as the characters inside 80 columns in the snapshot.

;; face for long lines' tails
(set-face-attribute 'whitespace-line nil
                    :background "#555"
                    :weight 'bold)

;; face for Tabs
(set-face-attribute 'whitespace-tab nil
                    :background "#555"
                    :weight 'bold)

whitespace-mode


Solution

  • set-face-attribute changes only the attributes you specify.

    Set :foreground to nil:

    (set-face-attribute 'whitespace-line nil
                        :foreground nil
                        :background "#555"
                        :weight 'bold)