[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: |
Matthew Leach |
Subject: |
Re: [AUCTeX-devel] Sharing value of a variable between all files of the same document |
Date: |
Thu, 21 Apr 2016 22:21:18 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) |
Hi Mosè,
Thanks for the explanation, I have some further questions below - sorry!
Mosè Giordano <address@hidden> writes:
> 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'.
Ah yes, I missed those, thanks for the info.
>
>
>> 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".
Are we talking about editing a master or non-master TeX file?
> 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".
Could you explain why this would be the case? If we change the variable
inside the master TeX file and save it, wouldn't `TeX-auto-store' be
called and "var" set to "b" in the auto-save file?
> 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.
What about if a user wishes for "var" to no-longer be a document-wide
variable but revert back to being buffer-local? Would they have to edit
(or delete) the auto-store file? I worry that this could get a little
confusing for the users.
--
Matt
- [AUCTeX-devel] Sharing value of a variable between all files of the same document (was: [PATCH] auto-save the value of `TeX-command-extra-options'), Mosè Giordano, 2016/04/16
- Re: [AUCTeX-devel] Sharing value of a variable between all files of the same document, Matthew Leach, 2016/04/16
- Re: [AUCTeX-devel] Sharing value of a variable between all files of the same document, Mosè Giordano, 2016/04/16
- Re: [AUCTeX-devel] Sharing value of a variable between all files of the same document, Matthew Leach, 2016/04/17
- Re: [AUCTeX-devel] Sharing value of a variable between all files of the same document, Mosè Giordano, 2016/04/20
- Re: [AUCTeX-devel] Sharing value of a variable between all files of the same document, Matthew Leach, 2016/04/20
- Re: [AUCTeX-devel] Sharing value of a variable between all files of the same document, Mosè Giordano, 2016/04/20
- Re: [AUCTeX-devel] Sharing value of a variable between all files of the same document, Matthew Leach, 2016/04/20
- Re: [AUCTeX-devel] Sharing value of a variable between all files of the same document, Mosè Giordano, 2016/04/20
- Re: [AUCTeX-devel] Sharing value of a variable between all files of the same document,
Matthew Leach <=
- Re: [AUCTeX-devel] Sharing value of a variable between all files of the same document, Mosè Giordano, 2016/04/24