branch: externals/auctex
commit 4a561032c2beec4ea763f83edc17f3a908ea4c79
Author: Ikumi Keita <[email protected]>
Commit: Ikumi Keita <[email protected]>
Reduce unnecessary local variable safety inquiry
* tex.el (TeX-add-local-master): Call major mode function only when
necessary.
---
tex.el | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/tex.el b/tex.el
index de8c6cf..4a28e20 100644
--- a/tex.el
+++ b/tex.el
@@ -2456,11 +2456,12 @@ Get `major-mode' from master file and enable it."
comment-prefix "mode: " mode-string "\n"
comment-prefix "TeX-master: " (prin1-to-string TeX-master) "\n"
comment-prefix "End:\n")
- (funcall mode)
- ;; TeX modes run `VirTeX-common-initialization' which kills all local
- ;; variables, thus `TeX-master' will be forgotten after `(funcall
- ;; mode)'. Reparse local variables in order to bring it back.
- (hack-local-variables)))))
+ (unless (eq mode major-mode)
+ (funcall mode)
+ ;; TeX modes run `VirTeX-common-initialization' which kills all local
+ ;; variables, thus `TeX-master' will be forgotten after `(funcall
+ ;; mode)'. Reparse local variables in order to bring it back.
+ (hack-local-variables))))))
(defun TeX-local-master-p ()
"Return non-nil if there is a `TeX-master' entry in local variables spec.