;; 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'.
(tex-common-initialization))
(advice-add 'tex-mode :around #'tex--redirect-to-submode)
+(defvar tex-mode--recursing nil)
(defun tex--redirect-to-submode (orig-fun)
"Redirect to one of the submodes when called directly."
;; The file may have "mode: tex" 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
+ (let ((tex-mode--recursing tex-mode--recursing))
+ (funcall (if (or delay-mode-hooks tex-mode--recursing)
;; We're called from one of the children already.
orig-fun
+ (setq tex-mode--recursing t)
(tex--guess-mode)))))
;; The following three autoloaded aliases appear to conflict with