summaryrefslogtreecommitdiff
path: root/lisp/textmodes/conf-mode.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2021-08-25 11:41:38 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2021-08-25 11:41:38 +0200
commit7782ccd6de259c14c3843cfed38d944d91b32c89 (patch)
tree4bc0abf501f5db25af137797a2c8d7c12a001e0b /lisp/textmodes/conf-mode.el
parentefaed29f3dc7af15c9f97d87f9cbe790c73a2ea3 (diff)
downloademacs-7782ccd6de259c14c3843cfed38d944d91b32c89.tar.gz
Fix up previous conf-mode/tex-mode redirection hacks
* lisp/textmodes/conf-mode.el (conf-mode): * lisp/textmodes/tex-mode.el (tex--redirect-to-submode): The previous hack to these redirections would disable all local variables. Try to work around this a bit more.
Diffstat (limited to 'lisp/textmodes/conf-mode.el')
-rw-r--r--lisp/textmodes/conf-mode.el10
1 files changed, 6 insertions, 4 deletions
diff --git a/lisp/textmodes/conf-mode.el b/lisp/textmodes/conf-mode.el
index 949d8cbdab9..57ec8a04289 100644
--- a/lisp/textmodes/conf-mode.el
+++ b/lisp/textmodes/conf-mode.el
@@ -417,16 +417,18 @@ See also `conf-space-mode', `conf-colon-mode', `conf-javaprop-mode',
;; To tell the difference between those two cases where the function
;; might be called, we check `delay-mode-hooks'.
;; (inspired from tex-mode.el)
+(defvar conf-mode--recursing nil)
(advice-add 'conf-mode :around
(lambda (orig-fun)
"Redirect to one of the submodes when called directly."
;; The file may have "mode: conf" in the local variable
;; block, in which case we'll be called recursively
;; infinitely. Inhibit that.
- (let ((enable-local-variables nil))
- (funcall (if delay-mode-hooks orig-fun (conf--guess-mode))))))
-
-
+ (let ((conf-mode--recursing conf-mode--recursing))
+ (funcall (if (or delay-mode-hooks conf-mode--recursing)
+ orig-fun
+ (setq conf-mode--recursing t)
+ (conf--guess-mode))))))
(defun conf-mode-initialize (comment &optional font-lock)
"Initializations for sub-modes of `conf-mode'.