unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Can we expand the valid location of "Local Variables" ?
@ 2020-03-10 20:56 Dima Kogan
  2020-03-10 21:39 ` Stefan Monnier
                   ` (2 more replies)
  0 siblings, 3 replies; 20+ messages in thread
From: Dima Kogan @ 2020-03-10 20:56 UTC (permalink / raw)
  To: emacs-devel

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!



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

end of thread, other threads:[~2020-03-24  2:20 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-10 20:56 Can we expand the valid location of "Local Variables" ? Dima Kogan
2020-03-10 21:39 ` Stefan Monnier
2020-03-10 23:44   ` Dima Kogan
2020-03-11  2:01     ` Stefan Monnier
2020-03-22 23:08   ` Dima Kogan
2020-03-23  8:25     ` Robert Pluim
2020-03-23 14:17       ` Eli Zaretskii
2020-03-23 15:28         ` Robert Pluim
2020-03-23 15:54           ` Eli Zaretskii
2020-03-23 17:03             ` Dima Kogan
2020-03-23 17:24             ` Stefan Monnier
2020-03-24  2:20           ` Richard Stallman
2020-03-12  2:26 ` Richard Stallman
2020-03-14  5:54   ` Steve Youngs
2020-03-14  7:07     ` Stefan Monnier
2020-03-15  3:08     ` Richard Stallman
2020-03-15  6:41       ` Steve Youngs
2020-03-16  3:36         ` Richard Stallman
2020-03-23 15:56 ` Yuri Khan
2020-03-23 16:55   ` Dima Kogan

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