[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[AUCTeX-devel] not advising hack-one-local-variable

From: Dave Love
Subject: [AUCTeX-devel] not advising hack-one-local-variable
Date: Wed, 19 Oct 2005 17:42:34 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/21.4 (gnu/linux)

tex.el shouldn't use advice on `hack-one-local-variable'.  My session
got into a bad state when this went wrong somehow and all local
variable processing broke.  (I'm not sure how.)

This patch possibly DTRT, but I'm not sure the feature should be
present, since you can specify minor modes in local variables if you
must and this AUCTeX feature doesn't seem to be documented.  (I know
it's a deficiency that `mode:' in local variables actually toggles
minor modes rather than switching them on.)

The patch is against v11.81, though I tested it in Debian's 1.55.  I
haven't tested under XEmacs, but the hook is present there, so I
assume it will work.

[Glancing at the current FAQ, I'm surprised at the advice to use
development Emacs 22.  Most times I try an update of it I find some
new regression, and the response to bug reports is disheartening :-(.
The `less good' Unicode support in Emacs 21 probably won't bother
non-CJK users.]

2005-10-19  Dave Love  <address@hidden>

        * tex.el (hack-one-local-variable): Remove advice.
        (TeX-hack-local-variables): New.
        (hack-local-variables-hook): Use it.

--- tex.el      2005/10/19 10:46:29     1.1
+++ tex.el      2005/10/19 11:19:38
@@ -616,17 +616,14 @@
                          (add-to-list 'Info-file-list-for-emacs
                                       (cons elt "AUCTeX"))))
-(defadvice hack-one-local-variable (after TeX-hack-one-local-variable-after
-                                         activate)
-  "Call minor mode function if minor mode variable is found."
-  (let ((var (ad-get-arg 0))
-       (val (ad-get-arg 1)))
-    ;; Instead of checking for each mode explicitely `minor-mode-list'
-    ;; could be used.  But this may make the byte compiler pop up.
-    (when (memq var '(TeX-PDF-mode
-                     TeX-source-specials-mode TeX-interactive-mode
-                     TeX-Omega-mode TeX-fold-mode LaTeX-math-mode))
-      (if (symbol-value val) (funcall var 1) (funcall var 0)))))
+(defun TeX-hack-local-variables ()
+  (dolist (mode '(TeX-PDF-mode
+                 TeX-source-specials-mode TeX-interactive-mode
+                 TeX-Omega-mode TeX-fold-mode LaTeX-math-mode))
+    (if (local-variable-p mode)
+       (funcall mode (if (symbol-value mode) 1 0)))))
+(add-hook 'hack-local-variables-hook 'TeX-hack-local-variables)
 (defvar TeX-overlay-priority-step 16
   "Numerical difference of priorities between nested overlays.
@@ -4560,6 +4557,7 @@
 (put 'TeX-insert-dollar 'delete-selection t)
 (put 'TeX-insert-quote 'delete-selection t)
+;; Fixme: define unload hook to undo hook-setting.
 (provide 'tex)

Free software, free society   <URL:>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]