Hi Matt, 2016-04-21 23:21 GMT+02:00 Matthew Leach <matt...@mattleach.net>: > Hi Mosè, > > Thanks for the explanation, I have some further questions below - sorry!
Don't worry, I like this form of discussion to improve patches ;-) > Mosè Giordano <m...@gnu.org> writes: >>> 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? Master file, sorry, I didn't specify it. >> 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? Because saving a file doesn't trigger `hack-local-variables'. You have to reload it in some way (like `revert-buffer', or `TeX-normal-mode') to really apply the change. This is the reason why I mildly suggest to force `hack-local-variables' in `TeX-auto-store'. >> 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. I thought about it, but I can't see why one shouldn't want to have some variables to be document-wide. However, instead of hard-coding the list of variables we can use a variable (maybe a `defvar' rather than a `defcustom', not to really expose it to non-advanced users) with the list of shared variables. Bye, Mosè _______________________________________________ auctex-devel mailing list auctex-devel@gnu.org https://lists.gnu.org/mailman/listinfo/auctex-devel