Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I wonder if we can set the font in Emacs according to the comments in the file.

E.g.

-*- fond: "my-font"; -*-

share|improve this question
add comment

2 Answers 2

up vote 1 down vote accepted

For full details, see Specifying File Variables

There are two ways to specify file local variable values: in the first line, or with a local variables list. Here's how to specify them in the first line:

 -*- mode: modename; var: value; ... -*-

Here is an example first line that specifies Lisp mode and sets two variables with numeric values:

 ;; -*- mode: Lisp; fill-column: 75; comment-column: 50; -*-

Instead of using a -*- line, you can define file local variables using a local variables list near the end of the file. The start of the local variables list should be no more than 3000 characters from the end of the file, and must be on the last page if the file is divided into pages.

A local variables list starts with a line containing the string ‘Local Variables:’, and ends with a line containing the string ‘End:’. In between come the variable names and values, one set per line, like this:

 /* Local Variables: */
 /* mode:c           */
 /* comment-column:0 */
 /* End:             */

Note that /* */ is only present to mark these lines as comments to the C source code... Emacs looks only for Local Variables: followed on another line by End:

share|improve this answer
add comment

You can use the eval file local variable which can evaluate lisp expressions if you allow it.

share|improve this answer
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.