Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

2 Answers

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
add comment

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.