Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using emacs prelude, and want to have whitespace-cleanup at saving, but prefer not showing trailing white space, 'cus the color is nasty with my color theme however, it seems i cannot customize the face of the whitespace using customize-faces, it just does not work even i disabled the faces. is there any other settings/functions to change the whitespace face? or how can i just disable whitespace highlighting, but still keep the cleanup at saving

share|improve this question
up vote 2 down vote accepted

Here are my own .emacs (aka user customization) settings. Directly above whitespace-style are additional options that can be activated by adding them into the definition of whitespace-style. Rather than using global-whitespace-mode, I prefer to use (whitespace-mode t) with certain major mode hooks.   whitespace-cleanup is a function that is not dependent upon highlighting of trailing white space.

;;  (global-whitespace-mode t)

(setq whitespace-display-mappings '(
  (space-mark   ?\     [?\u00B7]     [?.])
  (space-mark   ?\xA0  [?\u00A4]     [?_])
  (newline-mark ?\n    [?¶ ?\n])
  (tab-mark     ?\t    [?\u00BB ?\t] [?\\ ?\t])

;; lines lines-tail newline trailing space-before-tab space-afte-tab empty
;; indentation-space indentation indentation-tab tabs spaces
(setq whitespace-style '(face space-mark tab-mark newline-mark) )

(setq whitespace-line-column 85)

  '(whitespace-space ((t (:bold t :foreground "gray75"))))
  '(whitespace-empty ((t (:foreground "firebrick" :background "SlateGray1"))))
  '(whitespace-hspace ((t (:foreground "lightgray" :background "LemonChiffon3"))))
  '(whitespace-indentation ((t (:foreground "firebrick" :background "beige"))))
  '(whitespace-line ((t (:foreground "black" :background "red"))))
  '(whitespace-newline ((t (:foreground "orange" :background "blue"))))
  '(whitespace-space-after-tab ((t (:foreground "black" :background "green"))))
  '(whitespace-space-before-tab ((t (:foreground "black" :background "DarkOrange"))))
  '(whitespace-tab ((t (:foreground "blue" :background "white"))))
  '(whitespace-trailing ((t (:foreground "red" :background "yellow"))))
share|improve this answer

I don't use Prelude myself; in general I recommend against Emacs "starter packs". They tend to heavily customize the editor in ways that aren't always obvious or well documented, and then you have problems with things like customizing whitespace-face that should be very simple. Better to start out by learning Emacs proper, and then assemble your own customizations to taste.

That said, looking at the source of prelude/core/prelude-editor.el, I find this:

(defcustom prelude-whitespace t
  "Non-nil values enable Prelude's whitespace visualization."
  :type 'boolean
  :group 'prelude)

which strongly suggests that M-x customize-variable RET prelude-whitespace RET, then setting the value to nil and applying the change, should produce the behavior you desire. (The trimming behavior is controlled by a separate customization variable, prelude-clean-whitespace-on-save.)

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .