Hello Ikumi, Apologies for the late reply. I've been somewhat busy these days.
> I don't understand the detail well. Why TeX-region-file is called before > the File Local Variables section is parsed? Could you provide a recipe > to reproduce the issue? I enable TeX-source-correlate-mode in LaTeX-mode-hook. Then I get the following calls when I open a tex file: TeX-source-correlate-mode -> TeX-set-mode-name -> TeX-region-file (Below is the complete call stack starting from `find-file-noselect`). This happens before local variables are hacked (like TeX-master). In my case since `TeX-output-dir` is set to non-nil (globally) then `TeX-region-file` calls `TeX--master-output-dir` which creates an output directory if it does not exist (without the patch I emailed earlier). Since `TeX-master` is not set correctly the output directory might be created in the wrong location, Let me know if you need more info. ,---- | TeX-region-file() | #f(compiled-function (&optional changed local reset) "Build and set the mode name.\nThe base mode name will be concatenated with indicators for\nhelper modes where appropriate.\n\nIf CHANGED is non-nil, it indicates which global mode\nmay have changed so that all corresponding buffers\nwithout a local value might get their name updated.\nA value of t will thus update all buffer names.\n\nIf LOCAL is non-nil and CHANGED is buffer-local, only\na local change has been performed and only the local\nname is to be updated.\n\nIf RESET is non-nil, `TeX-command-next' is reset to\n`TeX-command-default' in updated buffers." #<bytecode 0x1565b29751e9>)(nil nil t) | apply(#f(compiled-function (&optional changed local reset) "Build and set the mode name.\nThe base mode name will be concatenated with indicators for\nhelper modes where appropriate.\n\nIf CHANGED is non-nil, it indicates which global mode\nmay have changed so that all corresponding buffers\nwithout a local value might get their name updated.\nA value of t will thus update all buffer names.\n\nIf LOCAL is non-nil and CHANGED is buffer-local, only\na local change has been performed and only the local\nname is to be updated.\n\nIf RESET is non-nil, `TeX-command-next' is reset to\n`TeX-command-default' in updated buffers." #<bytecode 0x1565b29751e9>) (nil nil t)) | TeX-set-mode-name(nil nil t) | #f(compiled-function (&optional changed local reset) "Build and set the mode name.\nThe base mode name will be concatenated with indicators for\nhelper modes where appropriate.\n\nIf CHANGED is non-nil, it indicates which global mode\nmay have changed so that all corresponding buffers\nwithout a local value might get their name updated.\nA value of t will thus update all buffer names.\n\nIf LOCAL is non-nil and CHANGED is buffer-local, only\na local change has been performed and only the local\nname is to be updated.\n\nIf RESET is non-nil, `TeX-command-next' is reset to\n`TeX-command-default' in updated buffers." #<bytecode 0x1565b29751e9>)(TeX-source-correlate-mode t t) | apply(#f(compiled-function (&optional changed local reset) "Build and set the mode name.\nThe base mode name will be concatenated with indicators for\nhelper modes where appropriate.\n\nIf CHANGED is non-nil, it indicates which global mode\nmay have changed so that all corresponding buffers\nwithout a local value might get their name updated.\nA value of t will thus update all buffer names.\n\nIf LOCAL is non-nil and CHANGED is buffer-local, only\na local change has been performed and only the local\nname is to be updated.\n\nIf RESET is non-nil, `TeX-command-next' is reset to\n`TeX-command-default' in updated buffers." #<bytecode 0x1565b29751e9>) (TeX-source-correlate-mode t t)) | TeX-set-mode-name(TeX-source-correlate-mode t t) | TeX-source-correlate-mode(1) | VirTeX-common-initialization() | LaTeX-common-initialization() | TeX-latex-mode() | apply(TeX-latex-mode nil) | LaTeX-mode() | set-auto-mode-0(LaTeX-mode nil) | set-auto-mode() | normal-mode(t) | after-find-file(nil t) | find-file-noselect-1(#<buffer bm.tex> "...bm.tex" nil nil "...bm.tex" (1857370 2053)) | find-file-noselect("...bm.tex" nil nil nil) `---- Best regards -- Al