I work with a lot of tabular data files and use stripe-buffer.el make them easier to read. But I also work with more than one, so I'd like to make it easier to distinguish among them as well and want to change the stripe colors per buffer.

I can change the face globally using:

(modify-face 'stripe-highlight "black" "#cce7ff")

Is there a way to do this locally to a single buffer?


2 Answers 2


As noted by @phils in the comment below, the Emacs manual suggests not modifying the face-remapping-alist directly due to possible unintended side effects: . . .to avoid trampling on remappings applied elsewhere. Thus, (setq-local face-remapping-alist '((stripe-highlight (:background "white" :foreground "black")))) is not considered to be the preferred method. Instead, the Emacs manual suggests using a function such as face-remap-add-relative:

(face-remap-add-relative 'stripe-highlight '(:foreground "black" :background "yellow"))

Here is a link to additional Emacs documentation on this issue: http://www.gnu.org/software/emacs/manual/html_node/elisp/Face-Remapping.html

  • Nice; the variable docstring even mentions the buffer-local scenario as a use-case for this.
    – phils
    Commented Jan 11, 2015 at 22:40
  • C-h i g (elisp) Face Remapping documents API functions intended for buffer-local modifications, and indicates that they are preferable to manipulating the alist directly. You'll be able to improve your answer that way.
    – phils
    Commented Jan 11, 2015 at 22:53
  • 1
    @phils -- thank you for suggesting the use of face-remap-add-relative as a means of modifying the face-remapping-alist. I have edited the answer accordingly.
    – lawlist
    Commented Jan 11, 2015 at 23:50
  • One more example: (face-remap-add-relative 'default '(:family "Arial")).
    – Adobe
    Commented Jan 12, 2015 at 10:15
  • 1
    @Hi-Angel -- remove the single quote in front of the word bold and try again. :)
    – lawlist
    Commented Sep 7, 2017 at 5:46

(edit: lawlist has a much better answer, but I'll leave this answer in case the information is useful to anyone.)

Face specs are properties in the face symbol's plist -- e.g. (get 'stripe-highlight 'face-defface-spec) -- and I don't believe the notion of buffer-local symbol properties exists. That's a special feature of the value slot (i.e. values of variables).

What some libraries do is assign their faces to variables, and then use the variable everywhere that the face is needed.

You can then create buffer-local values for those variables, which has the same effect that you're looking for.

This requires the code using the face to have been written that way, however.

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.