diff options
| author | Richard M. Stallman | 2006-09-10 00:30:52 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2006-09-10 00:30:52 +0000 |
| commit | dd3a63bf1a7b799d25c932fbb6a1bbced7470eee (patch) | |
| tree | 52dc1b6042f0e77740b7bd379b5f9013574e0fb5 | |
| parent | f90660aa86efd77e1c800ad1e2e5028cc8643c68 (diff) | |
| download | emacs-dd3a63bf1a7b799d25c932fbb6a1bbced7470eee.tar.gz emacs-dd3a63bf1a7b799d25c932fbb6a1bbced7470eee.zip | |
(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.
| -rw-r--r-- | lisp/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/textmodes/conf-mode.el | 55 |
2 files changed, 38 insertions, 21 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5f94fa6f83a..c9aa615145e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -3,6 +3,10 @@ | |||
| 3 | * textmodes/conf-mode.el (conf-space-mode): Use | 3 | * textmodes/conf-mode.el (conf-space-mode): Use |
| 4 | hack-local-variables-hook instead of calling hack-local-variables. | 4 | hack-local-variables-hook instead of calling hack-local-variables. |
| 5 | (conf-space-keywords-override): New variable. | 5 | (conf-space-keywords-override): New variable. |
| 6 | (conf-space-mode-internal): New subroutine. Reinit Font Lock mode. | ||
| 7 | (conf-space-mode): Always make conf-space-keywords and | ||
| 8 | conf-space-keywords-override local. | ||
| 9 | Call conf-space-mode-internal directly as well as via hook. | ||
| 6 | 10 | ||
| 7 | 2006-09-09 Slawomir Nowaczyk <slawomir.nowaczyk.847@student.lu.se> (tiny change) | 11 | 2006-09-09 Slawomir Nowaczyk <slawomir.nowaczyk.847@student.lu.se> (tiny change) |
| 8 | 12 | ||
diff --git a/lisp/textmodes/conf-mode.el b/lisp/textmodes/conf-mode.el index a44eeefa56a..a3471f16480 100644 --- a/lisp/textmodes/conf-mode.el +++ b/lisp/textmodes/conf-mode.el | |||
| @@ -470,15 +470,19 @@ add /dev/mixer desktop" | |||
| 470 | (conf-mode-initialize "#" 'conf-space-font-lock-keywords) | 470 | (conf-mode-initialize "#" 'conf-space-font-lock-keywords) |
| 471 | (make-local-variable 'conf-assignment-sign) | 471 | (make-local-variable 'conf-assignment-sign) |
| 472 | (setq conf-assignment-sign nil) | 472 | (setq conf-assignment-sign nil) |
| 473 | (make-local-variable 'conf-space-keywords) | ||
| 474 | (make-local-variable 'conf-space-keywords-override) | ||
| 475 | (setq conf-space-keywords-override nil) | ||
| 473 | (cond (current-prefix-arg | 476 | (cond (current-prefix-arg |
| 474 | (make-local-variable 'conf-space-keywords-override) | ||
| 475 | ;; By setting conf-space-keywords-override | 477 | ;; By setting conf-space-keywords-override |
| 476 | ;; we arrange for the hook function below | 478 | ;; we arrange for conf-space-mode-internal |
| 477 | ;; to override any value of conf-space-keywords | 479 | ;; to override any value of conf-space-keywords |
| 478 | ;; specified in a local variables list. | 480 | ;; specified in a local variables list. |
| 479 | (setq conf-space-keywords-override | 481 | (setq conf-space-keywords-override |
| 480 | (if (> (prefix-numeric-value current-prefix-arg) 0) | 482 | (if (> (prefix-numeric-value current-prefix-arg) 0) |
| 481 | (read-string "Regexp to match keywords: ")))) | 483 | (read-string "Regexp to match keywords: ")))) |
| 484 | ;; If this is already set, don't replace it with the default. | ||
| 485 | (conf-space-keywords) | ||
| 482 | (buffer-file-name | 486 | (buffer-file-name |
| 483 | ;; By setting conf-space-keywords directly, | 487 | ;; By setting conf-space-keywords directly, |
| 484 | ;; we let a value in the local variables list take precedence. | 488 | ;; we let a value in the local variables list take precedence. |
| @@ -486,27 +490,36 @@ add /dev/mixer desktop" | |||
| 486 | (setq conf-space-keywords | 490 | (setq conf-space-keywords |
| 487 | (assoc-default buffer-file-name conf-space-keywords-alist | 491 | (assoc-default buffer-file-name conf-space-keywords-alist |
| 488 | 'string-match)))) | 492 | 'string-match)))) |
| 489 | ;; This is stuff to be done after parsing the local variables, once | 493 | (conf-space-mode-internal) |
| 490 | ;; any local variable spec fo rconf-space-keywords is already in effect. | 494 | ;; In case the local variables list specifies conf-space-keywords, |
| 491 | (push (lambda () | 495 | ;; recompute other things from that afterward. |
| 492 | (when conf-space-keywords-override | 496 | (push 'conf-space-mode-internal |
| 493 | (setq conf-space-keywords | ||
| 494 | conf-space-keywords-override)) | ||
| 495 | (make-local-variable 'conf-assignment-regexp) | ||
| 496 | (setq conf-assignment-regexp | ||
| 497 | (if conf-space-keywords | ||
| 498 | (concat "\\(?:" conf-space-keywords "\\)[ \t]+.+?\\([ \t]+\\|$\\)") | ||
| 499 | ".+?\\([ \t]+\\|$\\)")) | ||
| 500 | (setq imenu-generic-expression | ||
| 501 | `(,@(cdr imenu-generic-expression) | ||
| 502 | ("Parameters" | ||
| 503 | ,(if conf-space-keywords | ||
| 504 | (concat "^[ \t]*\\(?:" conf-space-keywords | ||
| 505 | "\\)[ \t]+\\([^ \t\n]+\\)\\(?:[ \t]\\|$\\)") | ||
| 506 | "^[ \t]*\\([^ \t\n[]+\\)\\(?:[ \t]\\|$\\)") | ||
| 507 | 1)))) | ||
| 508 | hack-local-variables-hook)) | 497 | hack-local-variables-hook)) |
| 509 | 498 | ||
| 499 | (defun conf-space-mode-internal () | ||
| 500 | (when conf-space-keywords-override | ||
| 501 | (setq conf-space-keywords | ||
| 502 | conf-space-keywords-override)) | ||
| 503 | (make-local-variable 'conf-assignment-regexp) | ||
| 504 | (setq conf-assignment-regexp | ||
| 505 | (if conf-space-keywords | ||
| 506 | (concat "\\(?:" conf-space-keywords "\\)[ \t]+.+?\\([ \t]+\\|$\\)") | ||
| 507 | ".+?\\([ \t]+\\|$\\)")) | ||
| 508 | ;; If Font Lock is already enabled, reenable it with new | ||
| 509 | ;; conf-assignment-regexp. | ||
| 510 | (when (and font-lock-mode | ||
| 511 | (boundp 'font-lock-keywords)) ;see `normal-mode' | ||
| 512 | (font-lock-add-keywords nil nil) | ||
| 513 | (font-lock-mode 1)) | ||
| 514 | (setq imenu-generic-expression | ||
| 515 | `(,@(cdr imenu-generic-expression) | ||
| 516 | ("Parameters" | ||
| 517 | ,(if conf-space-keywords | ||
| 518 | (concat "^[ \t]*\\(?:" conf-space-keywords | ||
| 519 | "\\)[ \t]+\\([^ \t\n]+\\)\\(?:[ \t]\\|$\\)") | ||
| 520 | "^[ \t]*\\([^ \t\n[]+\\)\\(?:[ \t]\\|$\\)") | ||
| 521 | 1)))) | ||
| 522 | |||
| 510 | ;;;###autoload | 523 | ;;;###autoload |
| 511 | (define-derived-mode conf-colon-mode conf-unix-mode "Conf[Colon]" | 524 | (define-derived-mode conf-colon-mode conf-unix-mode "Conf[Colon]" |
| 512 | "Conf Mode starter for Colon files. | 525 | "Conf Mode starter for Colon files. |