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've been looking at whitespace-mode, but I'm not sure it can do what I want here. Here is an example:

(defn foo []
..(let [x 1]
....(+ x 2)))

How can I do something like that in Emacs? In words, I'd like it to only visualize the leading (indentation) whitespace, but not all spaces in general. Just the spaces at the beginning of the lines.

share|improve this question

The answer is to customize the whitespace-style variable and to remove the trailing keyword. Check out the wiki for whitespace mode.

share|improve this answer

I don't think it can. If you want it highlighted via font-lock you can add the following to an appropriate place (e.g. a mode hook) changing of course the face from trailing-whitespace to whatever you want.

 nil ;;current buffer instead of a particular mode
 '(("^ +" . 'trailing-whitespace)))

If you want it to be displayed with a visible mark then I don't think that can be done (easily) since whitespace-mode sets buffer-display-table which does a "global replacement" i.e., it doesn't take into account syntax or anything.

share|improve this answer

You must log in to answer this question.

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