unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* buffer-local file variables
@ 2004-06-30  6:12 naehring
  0 siblings, 0 replies; 2+ messages in thread
From: naehring @ 2004-06-30  6:12 UTC (permalink / raw)




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.

I would consider that as almost a bug.

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")

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

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.

The only problem left would be some variable setting containing the
string "local variables:". But in most cases those settings can be
done in the first line of the text file with the help of the -*-...-*-
syntax.

Don't know whether this behaviour is special to the Debian version of
gnu emacs.

Specs:
GNU Emacs 21.3.1 (i386-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
of 2004-04-07 on raven, modified by Debian

Best regards,
Tobias Naehring

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: buffer-local file variables
       [not found] <mailman.2744.1088576044.1953.bug-gnu-emacs@gnu.org>
@ 2004-07-01 14:59 ` Kevin Rodgers
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Rodgers @ 2004-07-01 14:59 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-07-01 14:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-30  6:12 buffer-local file variables naehring
     [not found] <mailman.2744.1088576044.1953.bug-gnu-emacs@gnu.org>
2004-07-01 14:59 ` Kevin Rodgers

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).