3

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?

2

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:
1

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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