Emacs face mode in local file variables

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?

Anton Tarasenko

Posted 2011-08-29T10:21:16.803

Reputation: 225

Answers

1

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:

Anton Tarasenko

Posted 2011-08-29T10:21:16.803

Reputation: 225

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

StefanQ

Posted 2011-08-29T10:21:16.803

Reputation: 141

Can you please post relevant information from link provided in you answer to avoid link rot – 50-3 – 2013-09-11T07:55:42.120