]> git.eshelyaron.com Git - emacs.git/commitdiff
(conf-space-mode-internal): New subroutine. Reinit Font Lock mode.
authorRichard M. Stallman <rms@gnu.org>
Sun, 10 Sep 2006 00:30:52 +0000 (00:30 +0000)
committerRichard M. Stallman <rms@gnu.org>
Sun, 10 Sep 2006 00:30:52 +0000 (00:30 +0000)
(conf-space-mode): Always make conf-space-keywords and
conf-space-keywords-override local.
Call conf-space-mode-internal directly as well as via hook.

lisp/ChangeLog
lisp/textmodes/conf-mode.el

index 5f94fa6f83adf98760b52bea11df7fa16bf0c688..c9aa615145e07711ee32ccd5195b96f3563d1bae 100644 (file)
@@ -3,6 +3,10 @@
        * textmodes/conf-mode.el (conf-space-mode): Use
        hack-local-variables-hook instead of calling hack-local-variables.
        (conf-space-keywords-override): New variable.
+       (conf-space-mode-internal): New subroutine.  Reinit Font Lock mode.
+       (conf-space-mode): Always make conf-space-keywords and
+       conf-space-keywords-override local.
+       Call conf-space-mode-internal directly as well as via hook.
 
 2006-09-09  Slawomir Nowaczyk  <slawomir.nowaczyk.847@student.lu.se>  (tiny change)
 
index a44eeefa56a15ca7164c5e0effe998e806964b79..a3471f16480969b5b26436fba73e058fd5f607fb 100644 (file)
@@ -470,15 +470,19 @@ add /dev/mixer            desktop"
   (conf-mode-initialize "#" 'conf-space-font-lock-keywords)
   (make-local-variable 'conf-assignment-sign)
   (setq conf-assignment-sign nil)
+  (make-local-variable 'conf-space-keywords)
+  (make-local-variable 'conf-space-keywords-override)
+  (setq conf-space-keywords-override nil)
   (cond (current-prefix-arg
-        (make-local-variable 'conf-space-keywords-override)
         ;; By setting conf-space-keywords-override
-        ;; we arrange for the hook function below
+        ;; we arrange for conf-space-mode-internal
         ;; to override any value of conf-space-keywords
         ;; specified in a local variables list.
          (setq conf-space-keywords-override
               (if (> (prefix-numeric-value current-prefix-arg) 0)
                   (read-string "Regexp to match keywords: "))))
+       ;; If this is already set, don't replace it with the default.
+       (conf-space-keywords)
         (buffer-file-name
         ;; By setting conf-space-keywords directly, 
         ;; we let a value in the local variables list take precedence.
@@ -486,27 +490,36 @@ add /dev/mixer            desktop"
          (setq conf-space-keywords
               (assoc-default buffer-file-name conf-space-keywords-alist
                              'string-match))))
-  ;; This is stuff to be done after parsing the local variables, once
-  ;; any local variable spec fo rconf-space-keywords is already in  effect.
-  (push (lambda ()
-         (when conf-space-keywords-override
-           (setq conf-space-keywords
-                 conf-space-keywords-override))
-         (make-local-variable 'conf-assignment-regexp)
-         (setq conf-assignment-regexp
-               (if conf-space-keywords
-                   (concat "\\(?:" conf-space-keywords "\\)[ \t]+.+?\\([ \t]+\\|$\\)")
-                 ".+?\\([ \t]+\\|$\\)"))
-         (setq imenu-generic-expression
-               `(,@(cdr imenu-generic-expression)
-                 ("Parameters"
-                  ,(if conf-space-keywords
-                       (concat "^[ \t]*\\(?:" conf-space-keywords
-                               "\\)[ \t]+\\([^ \t\n]+\\)\\(?:[ \t]\\|$\\)")
-                     "^[ \t]*\\([^ \t\n[]+\\)\\(?:[ \t]\\|$\\)")
-                  1))))
+  (conf-space-mode-internal)
+  ;; In case the local variables list specifies conf-space-keywords,
+  ;; recompute other things from that afterward.
+  (push 'conf-space-mode-internal
        hack-local-variables-hook))
 
+(defun conf-space-mode-internal ()
+  (when conf-space-keywords-override
+    (setq conf-space-keywords
+         conf-space-keywords-override))
+  (make-local-variable 'conf-assignment-regexp)
+  (setq conf-assignment-regexp
+       (if conf-space-keywords
+           (concat "\\(?:" conf-space-keywords "\\)[ \t]+.+?\\([ \t]+\\|$\\)")
+         ".+?\\([ \t]+\\|$\\)"))
+  ;; If Font Lock is already enabled, reenable it with new
+  ;; conf-assignment-regexp.
+  (when (and font-lock-mode
+            (boundp 'font-lock-keywords)) ;see `normal-mode'
+    (font-lock-add-keywords nil nil)
+    (font-lock-mode 1))
+  (setq imenu-generic-expression
+       `(,@(cdr imenu-generic-expression)
+         ("Parameters"
+          ,(if conf-space-keywords
+               (concat "^[ \t]*\\(?:" conf-space-keywords
+                       "\\)[ \t]+\\([^ \t\n]+\\)\\(?:[ \t]\\|$\\)")
+             "^[ \t]*\\([^ \t\n[]+\\)\\(?:[ \t]\\|$\\)")
+          1))))
+
 ;;;###autoload
 (define-derived-mode conf-colon-mode conf-unix-mode "Conf[Colon]"
   "Conf Mode starter for Colon files.