diff options
| author | Richard M. Stallman | 1994-10-07 09:54:58 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-10-07 09:54:58 +0000 |
| commit | b9998c334df527b87e4fc4695a8044d563208625 (patch) | |
| tree | 13448801748c799d2f56675a9318da1a4a5cf46c | |
| parent | 5f56271901eba3fa16e003ba88cbe65afc5bd157 (diff) | |
| download | emacs-b9998c334df527b87e4fc4695a8044d563208625.tar.gz emacs-b9998c334df527b87e4fc4695a8044d563208625.zip | |
(outline-font-lock-keywords): New variable.
(outline-mode): Set font-lock-keywords locally.
| -rw-r--r-- | lisp/textmodes/ooutline.el | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lisp/textmodes/ooutline.el b/lisp/textmodes/ooutline.el index 89ae68847bd..5d337ddd37f 100644 --- a/lisp/textmodes/ooutline.el +++ b/lisp/textmodes/ooutline.el | |||
| @@ -134,6 +134,20 @@ in the file it applies to.") | |||
| 134 | (setq minor-mode-alist (append minor-mode-alist | 134 | (setq minor-mode-alist (append minor-mode-alist |
| 135 | (list '(outline-minor-mode " Outl"))))) | 135 | (list '(outline-minor-mode " Outl"))))) |
| 136 | 136 | ||
| 137 | (defvar outline-font-lock-keywords | ||
| 138 | '(;; Highlight headings according to the level. | ||
| 139 | ("^\\(\\*+\\)[ \t]*\\(.+\\)?[ \t]*$" | ||
| 140 | (1 font-lock-string-face) | ||
| 141 | (2 (let ((len (- (match-end 1) (match-beginning 1)))) | ||
| 142 | (or (cdr (assq len '((1 . font-lock-function-name-face) | ||
| 143 | (2 . font-lock-keyword-face) | ||
| 144 | (3 . font-lock-comment-face)))) | ||
| 145 | font-lock-variable-name-face)) | ||
| 146 | nil t)) | ||
| 147 | ;; Highight citations of the form [1] and [Mar94]. | ||
| 148 | ("\\[\\([A-Z][A-Za-z]+\\)*[0-9]+\\]" . font-lock-type-face)) | ||
| 149 | "Additional expressions to highlight in Outline mode.") | ||
| 150 | |||
| 137 | ;;;###autoload | 151 | ;;;###autoload |
| 138 | (defun outline-mode () | 152 | (defun outline-mode () |
| 139 | "Set major mode for editing outlines with selective display. | 153 | "Set major mode for editing outlines with selective display. |
| @@ -192,6 +206,8 @@ Turning on outline mode calls the value of `text-mode-hook' and then of | |||
| 192 | (make-local-variable 'paragraph-separate) | 206 | (make-local-variable 'paragraph-separate) |
| 193 | (setq paragraph-separate (concat paragraph-separate "\\|^\\(" | 207 | (setq paragraph-separate (concat paragraph-separate "\\|^\\(" |
| 194 | outline-regexp "\\)")) | 208 | outline-regexp "\\)")) |
| 209 | (make-local-variable 'font-lock-keywords) | ||
| 210 | (setq font-lock-keywords outline-font-lock-keywords) | ||
| 195 | (make-local-variable 'change-major-mode-hook) | 211 | (make-local-variable 'change-major-mode-hook) |
| 196 | (add-hook 'change-major-mode-hook 'show-all) | 212 | (add-hook 'change-major-mode-hook 'show-all) |
| 197 | (run-hooks 'text-mode-hook 'outline-mode-hook)) | 213 | (run-hooks 'text-mode-hook 'outline-mode-hook)) |