bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: buffer-local file variables


From: Kevin Rodgers
Subject: Re: buffer-local file variables
Date: Thu, 01 Jul 2004 08:59:16 -0600
User-agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2

naehring@iee.et.tu-dresden.de wrote:
> If `enable-local-variables is set to `t then appearently a newly
> loaded text file is searched for the string "local variables:" from
> top to bottom.

That's not true.  Emacs only searches the last (formfeed-separated) page
of the buffer for the local variables section.  If there are no page
separators, it only searches the final 3000 characters.  See
hack-local-variables in lisp/files.el.

> I would consider that as almost a bug.

Almost  :-)  I suggest that the 3000 character limit is too generous,
and that 1024 ought to be plenty.

> If the main text contains the string "local variables:" (which might
> be in a comment of some computer program) then emacs misinterprets
> this as the beginning of the in-file declaration of the buffer-local
> variables. This, almost certainly induces the error
>
> File local-variables error: (error "Local variables entry is missing the 
prefix")

If that occurs, you can avoid it by introducing a final empty page.  But
this workaround is only available if the program (or data) file format
allows it.

> There are some cries for help about this error in the WWW. Maybe,
> those are due to this buggy behaviour.

References?

> I think text files should be searched for "local variables:" from
> bottom up. Then, one can avoid the above error message by inserting an
> empty local-variables block at the end of the text file.

A "\n\f" (newline-formfeed) sequence is all that is needed -- or 3000
whitespace characters :-)

> The only problem left would be some variable setting containing the
> string "local variables:".

It's only a problem if that string occurs near the end of the buffer,
which can usually be worked around.

> But in most cases those settings can be done in the first line of the
> text file with the help of the -*-...-*- syntax.

I thought you were talking about occurrences of "local variables:" in
the buffer that should not be parsed by Emacs?

--
Kevin Rodgers





reply via email to

[Prev in Thread] Current Thread [Next in Thread]