diff options
| author | Arash Esbati | 2025-07-04 14:31:27 +0200 |
|---|---|---|
| committer | Arash Esbati | 2025-07-04 14:31:27 +0200 |
| commit | 22daed7ce0e3fbe55608a92c81deee24933b266d (patch) | |
| tree | b48ad930bfdf5ceb3e097729b59d77cc841b43b1 | |
| parent | 215fc3a354c36b2294b3dd45e72555bb4b4cb364 (diff) | |
| download | emacs-22daed7ce0e3fbe55608a92c81deee24933b266d.tar.gz emacs-22daed7ce0e3fbe55608a92c81deee24933b266d.zip | |
Consider constant TeX master/main file
* lisp/international/latexenc.el
(latexenc-find-file-coding-system): Search for "Local Variables"
as a comment.
Consider the case where `TeX-master' or `tex-main-file' is
globally set to a string as well. (AUCTeX bug#78841)
| -rw-r--r-- | lisp/international/latexenc.el | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/lisp/international/latexenc.el b/lisp/international/latexenc.el index 1b735810ee4..fea5be6dbd7 100644 --- a/lisp/international/latexenc.el +++ b/lisp/international/latexenc.el | |||
| @@ -144,24 +144,27 @@ coding system names is determined from `latex-inputenc-coding-alist'." | |||
| 144 | (file-name-directory (nth 1 arg-list)) | 144 | (file-name-directory (nth 1 arg-list)) |
| 145 | default-directory)) | 145 | default-directory)) |
| 146 | latexenc-main-file) | 146 | latexenc-main-file) |
| 147 | ;; Is there a TeX-master or tex-main-file in the local variables | 147 | ;; Is there a TeX-master or tex-main-file in the local |
| 148 | ;; section? | 148 | ;; variables section or is it globally set to a constant |
| 149 | ;; string? | ||
| 149 | (unless latexenc-dont-use-TeX-master-flag | 150 | (unless latexenc-dont-use-TeX-master-flag |
| 150 | (goto-char (point-max)) | 151 | (goto-char (point-max)) |
| 151 | (search-backward "\n\^L" (max (- (point-max) 3000) (point-min)) | 152 | (search-backward "\n\^L" (max (- (point-max) 3000) (point-min)) |
| 152 | 'move) | 153 | 'move) |
| 153 | (search-forward "Local Variables:" nil t) | 154 | (re-search-forward "^%+ *Local Variables:" nil t) |
| 154 | (when (re-search-forward | 155 | (let ((file (if (re-search-forward |
| 155 | "^%+ *\\(TeX-master\\|tex-main-file\\): *\"\\(.+\\)\"" | 156 | "^%+ *\\(TeX-master\\|tex-main-file\\): *\"\\(.+\\)\"" |
| 156 | nil t) | 157 | nil t) |
| 157 | (let ((file (match-string 2))) | 158 | (match-string 2) |
| 158 | (dolist (ext `("" ,(if (boundp 'TeX-default-extension) | 159 | (or (bound-and-true-p TeX-master) |
| 159 | (concat "." TeX-default-extension) | 160 | (bound-and-true-p tex-main-file))))) |
| 160 | "") | 161 | (dolist (ext `("" ,(if (boundp 'TeX-default-extension) |
| 161 | ".tex" ".ltx" ".dtx" ".drv")) | 162 | (concat "." TeX-default-extension) |
| 162 | (if (and (null latexenc-main-file) ;Stop at first. | 163 | "") |
| 163 | (file-exists-p (concat file ext))) | 164 | ".tex" ".ltx" ".dtx" ".drv")) |
| 164 | (setq latexenc-main-file (concat file ext))))))) | 165 | (if (and (null latexenc-main-file) ;Stop at first. |
| 166 | (file-exists-p (concat file ext))) | ||
| 167 | (setq latexenc-main-file (concat file ext)))))) | ||
| 165 | ;; try tex-modes tex-guess-main-file | 168 | ;; try tex-modes tex-guess-main-file |
| 166 | (when (and (not latexenc-dont-use-tex-guess-main-file-flag) | 169 | (when (and (not latexenc-dont-use-tex-guess-main-file-flag) |
| 167 | (not latexenc-main-file)) | 170 | (not latexenc-main-file)) |