el/dot-emacs.el: Per-major-mode post-local-variables hooks.
[profile] / el / dot-emacs.el
index 4f2df95..32188f9 100644 (file)
@@ -91,6 +91,14 @@ This may be at the expense of cool features.")
                    (concat "(" (buffer-string) ")")))))))
   (cdr (assq sym mdw-config)))
 
+;; Local variables hacking.
+
+(defun run-local-vars-mode-hook ()
+  "Run a hook for the major-mode after local variables have been processed."
+  (run-hooks (intern (concat (symbol-name major-mode)
+                            "-local-variables-hook"))))
+(add-hook 'hack-local-variables-hook 'run-local-vars-mode-hook)
+
 ;; Set up the load path convincingly.
 
 (dolist (dir (append (and (boundp 'debian-emacs-flavor)
@@ -2733,8 +2741,8 @@ that character only to be normal punctuation.")
   (or (booleanp value)
       (every (lambda (v) (memq v '(?\" ?')))
             (if (listp value) value (list value)))))
-(put 'mdw-conf-quote-normal 'safe-local-variable '
-     mdw-conf-quote-normal-acceptable-value-p)
+(put 'mdw-conf-quote-normal 'safe-local-variable
+     'mdw-conf-quote-normal-acceptable-value-p)
 
 (defun mdw-fix-up-quote ()
   "Apply the setting of `mdw-conf-quote-normal'."
@@ -2749,15 +2757,7 @@ that character only to be normal punctuation.")
                   (if (listp flag) flag (list flag)))
             (set-syntax-table table)
             (and font-lock-mode (font-lock-fontify-buffer)))))))
-(defun mdw-fix-up-quote-hack ()
-  "Unpleasant hack to call `mdw-fix-up-quote' at the right time.
-Annoyingly, `hack-local-variables' is done after `set-auto-mode'
-so we wouldn't see a local-variable setting of
-`mdw-conf-quote-normal' in `conf-mode-hook'.  Instead, wire
-ourselves onto `hack-local-variables-hook' here, and check the
-setting once it's actually been made."
-  (add-hook 'hack-local-variables-hook 'mdw-fix-up-quote t t))
-(add-hook 'conf-mode-hook 'mdw-fix-up-quote-hack t)
+(add-hook 'conf-mode-local-variables-hook 'mdw-fix-up-quote t t)
 
 ;;;--------------------------------------------------------------------------
 ;;; Shell scripts.