Hi Mosè, The patch looks great, just some minor comments below.
Mosè Giordano <m...@gnu.org> 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? 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! > Comments (from anyone!) welcome. > > Bye, > Mosè > > diff --git a/tex.el b/tex.el > index b85a72a..6e1f977 100644 > --- a/tex.el > +++ b/tex.el > @@ -2513,6 +2513,16 @@ Return nil otherwise." > (search-backward "\n\^L" (max (- (point-max) 3000) (point-min)) 'move) > (re-search-forward "^%+ *TeX-master:" nil t))) > > +(defun TeX-add-document-variables (&rest sym-val) > + "Set first element of SYM-VAL to the next one, and so on. > + > +The variables are set if current file is not the master. This is > +used to store variables shared among the whole document into the > +auto-saved file." > + (unless (equal TeX-master t) > + (while var-val > + (set (pop sym-val) (pop sym-val))))) > + > ;;; Style Paths > > (defcustom TeX-style-global (expand-file-name "style" TeX-data-directory) > @@ -3988,22 +3998,39 @@ If TEX is a directory, generate style files for all > files in the directory." > LaTeX-provided-class-options)) > (pkg-opts (if (boundp 'LaTeX-provided-package-options) > LaTeX-provided-package-options)) > - (tex-cmd-opts TeX-command-extra-options) > (verb-envs (when (boundp 'LaTeX-verbatim-environments-local) > LaTeX-verbatim-environments-local)) > (verb-macros-delims (when (boundp > 'LaTeX-verbatim-macros-with-delims-local) > LaTeX-verbatim-macros-with-delims-local)) > (verb-macros-braces (when (boundp > 'LaTeX-verbatim-macros-with-braces-local) > LaTeX-verbatim-macros-with-braces-local)) > - (dialect TeX-style-hook-dialect)) > + (dialect TeX-style-hook-dialect) > + (master (equal TeX-master t)) > + shared-variables) > + ;; 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..."? Thanks, -- Matt _______________________________________________ auctex-devel mailing list auctex-devel@gnu.org https://lists.gnu.org/mailman/listinfo/auctex-devel