auctex-devel
[Top][All Lists]
Advanced

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

Re: [AUCTeX-devel] Sharing value of a variable between all files of the


From: Mosè Giordano
Subject: Re: [AUCTeX-devel] Sharing value of a variable between all files of the same document
Date: Thu, 21 Apr 2016 00:21:44 +0200

2016-04-21 0:00 GMT+02:00 Matthew Leach <address@hidden>:
> Hi Mosè,
>
> The patch looks great, just some minor comments below.
>
> Mosè Giordano <address@hidden> writes:
>
> [...]
>
>>> If we are going to be extending this idea for other variables, maybe we
>>> could have a macro that builds the TeX-command-extra-options form to be
>>> written to the auto-save file?  Performing these checks for every
>>> variable may become a little cumbersome.
>>
>> I'm not sure I understand what you mean here.
>
> Not to worry.  Your new patch fixed the issue :-).
>
>> Before you replied, I was about to send the improved patch that you
>> can find attached to this email.  I have only a doubt: whether to run
>> `hack-local-variables' in `TeX-auto-store' or not (it's commented in
>> my patch).  It ensures that a change to a local variable in master
>> file is immediately written to the auto-saved file (otherwise one
>> needs to reparse the file twice), but running that function may also
>> be considered an overhead.
>
> I thought that `TeX-auto-store' was only called when saving an AUCTeX
> buffer?

Not necessarily, for example it's called also by `TeX-auto-generate'
and `TeX-normal-mode'.

> If that's the case, I don't think we'd need to call
> `hack-local-variables' as the major-mode and local-variables would have
> been loaded and at the point where we are saving a file.  Apologies if
> I've misunderstood, though!

Ok, maybe I should explain better why we may need (not really need,
but I think it could be useful) to run `hack-local-variables'.
Imagine in your file you have variable `var', one of shared variables,
with value "a".  You edit the value to "b" and save the buffer, but
the local value of the variable stays "a", so `TeX-auto-store' saves
again the value "a".  Now you want to really apply the change: you can
either revert the buffer or parse it with `TeX-normal-mode'.  The
former doesn't trigger `TeX-auto-store' at all (so `var' has still
value "a" there), the second does trigger `TeX-auto-store' but `var'
would again have value "a".  In any case you need to parse the file
once more to make the change be saved to the auto-save file.

`hack-local-variables' solves for sure this problem by parsing the
local variables right before accessing their values, but I'm not
really persuaded it's a good idea to use it.

>> +     ;; If we are parsing master file, retrieve variables to be shared among
>
> Just a minor note - I don't think `parsing' is the correct word here as,
> AFAICT, we're doing any parsing.  Maybe: "If we are generating the
> auto-save file for the master file..."?

Yes, make sense, `TeX-auto-store' doesn't really read the buffer but
stores information about local variables.  Thank you.

Bye,
Mosè



reply via email to

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