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 tired to explicitly set a custom face for a file using local file variables:

# Local Variables:
# buffer-face-mode-face:'(:family "DejaVu Sans Mono")
# End:

Emacs catches up these variables, not showing, however, the file with the font that was required.

How can I write down the variables, so Emacs would show files with particular faces?

share|improve this question
up vote 1 down vote accepted

After I found a hint on StackOverflow, that's one of the possible solutions:

# Local Variables:
# eval: (setq buffer-face-mode-face '(:family "DejaVu Sans Mono"))
# eval: (buffer-face-mode t)
# End:

Or this trick:

# Local Variables:
# eval: (setq buffer-face-mode-face (face-font 'fixed-pitch))
# eval: (buffer-face-mode t)
# End:
share|improve this answer

In order to make a local variable list work, don't forget that the Local Variables block has to be appended at the end of the file.
For emacs warnings about "unsave variables" as result of using eval when loading your file see http://www.gnu.org/software/emacs/manual/html_node/emacs/Safe-File-Variables.html#Safe-File-Variables

share|improve this answer
    
Can you please post relevant information from link provided in you answer to avoid link rot – 50-3 Sep 11 '13 at 7:55

You must log in to answer this question.

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