emacs-devel
[Top][All Lists]
Advanced

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

Re: address@hidden: Emacs very slow opening file]


From: Juri Linkov
Subject: Re: address@hidden: Emacs very slow opening file]
Date: Sun, 02 Oct 2005 23:22:43 +0300
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

>> One idea is to restrict what strings can be used as the "prefix"
>> in a local variables list, so that local variables lists in diff output
>> are not obeyed.
>
> I'm afraid it won't be that easy.  Typical prefix chars in diffs are
> "-", "+" and "!" most (all?) of them are used for comments in some
> languages (eg. Ada, Postscript).  Even worse: context lines aren't
> prefixed at all.

One quite reliable solution is to store the original values of
prefix/suffix strings in the Local Variables section by adding new
variables `local-variables-prefix' and `local-variables-suffix', e.g.:

-/* Local Variables: */
-/* local-variables-prefix:"/* " */
-/* local-variables-suffix:" */" */
-/* mode:c */
-/* eval:(load-library "time-stamp") */
-/* eval:(make-local-variable 'write-file-hooks) */
-/* eval:(add-hook 'write-file-hooks 'time-stamp) */
-/* End: */

That way `hack-local-variables' could treat these variables specially:
by extracting their values from the Local Variables section, and testing
if they match the real prefix and suffix around the `Local Variables:'.

So the Local Variables section in the example above wouldn't be
interpreted, because the value of `local-variables-prefix' ("/* ")
is not the same as the prefix "-/* " in the diff file.

Of course, this wouldn't work with existing Local-Variables sections,
but for new sections adding these special variables would be easy
with a new command (from etc/TODO) that will make a local variables
section and write the values of `local-variables-prefix' and
`local-variables-suffix' automatically.

-- 
Juri Linkov
http://www.jurta.org/emacs/





reply via email to

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