emacs-devel
[Top][All Lists]
Advanced

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

Can we expand the valid location of "Local Variables" ?


From: Dima Kogan
Subject: Can we expand the valid location of "Local Variables" ?
Date: Tue, 10 Mar 2020 13:56:13 -0700
User-agent: mu4e 1.2.0; emacs 28.0.50

Hi.

Currently we can specify buffer-local variables in a "Local Variables"
stanza at the end of a buffer:

  
https://www.gnu.org/software/emacs/manual/html_node/emacs/Specifying-File-Variables.html#Specifying-File-Variables

For efficiency reasons, emacs doesn't look for this stanza in the entire
buffer, but only scans the last 3000 bytes. This is documented. It looks
like this setting (3000 bytes) was there in the first revision of
files.el back in 1991:

  http://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/files.el?id=b4da00

At the time, extending this limit would presumably result in an
observable performance penalty, but it's not 1991 anymore. Can we bump
this up? The patch would be trivial, so I'm not attaching one yet. The
locations in the source that currently hard-code this are:

  doc/emacs/custom.texi:1129:The start of the local variables list should be no 
more than 3000
  doc/misc/calc.texi:31065:The Local Variables section must be within 3000 
characters of the
  lisp/allout.el:6329:      (search-backward "\n\^L" (max (- (point-max) 3000) 
(point-min)) 'move)
  lisp/calendar/diary-lib.el:2087:                             (max (- 
(point-max) 3000) (point-min))
  lisp/cus-edit.el:4574:          (search-backward "\n\^L" (max (- (point-max) 
3000) (point-min))
  lisp/files-x.el:172:      (search-backward "\n\^L" (max (- (point-max) 3000) 
(point-min)) 'move)
  lisp/files.el:3723:     (search-backward "\n\^L" (max (- (point-max) 3000) 
(point-min))
  lisp/international/latexenc.el:150:         (search-backward "\n\^L" (max (- 
(point-max) 3000) (point-min))
  lisp/org/org-macs.el:189:                                   (max (- (point) 
3000) 1)
  lisp/progmodes/cc-mode.el:862:  (search-backward "\n\^L" (max (- (point-max) 
3000) (point-min)) 'move)
  lisp/progmodes/dcl-mode.el:1752:    (search-backward "\n\^L" (max (- 
(point-max) 3000) (point-min)) 'move)

Probably we'd want to make this into a variable? And the default maybe
should be higher than 3000?

The use case where I hit this was in an .org file that was defining a
presentation where I needed to control the export with an eval: (progn
...) block. Org wasn't doing quite what I needed it to, so the block had
some advice definitions in it, and that pushed the thing over the 3000
byte limit.

I'm not subscribed to emacs-devel at the moment, so please Cc me in
replies.

Thanks!



reply via email to

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