diff options
| author | Richard M. Stallman | 1996-07-27 02:44:27 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-07-27 02:44:27 +0000 |
| commit | 0e0ee795442b32f677df2bf02e431595f7680281 (patch) | |
| tree | 2110ff4927c7f767a23b5a8ca6562d54b87d1a7d | |
| parent | bcbe4d5724c5e859235fb472d6e1542a80836863 (diff) | |
| download | emacs-0e0ee795442b32f677df2bf02e431595f7680281.tar.gz emacs-0e0ee795442b32f677df2bf02e431595f7680281.zip | |
(help-font-lock-keywords): Use font-lock-function-name-face
for variables, too.
(help-mode): Set font-lock-defaults to provide bindings for
local fontification functions.
(help-fontify-buffer-function): New function.
| -rw-r--r-- | lisp/help.el | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/lisp/help.el b/lisp/help.el index a0e195b3436..67f8bb099ea 100644 --- a/lisp/help.el +++ b/lisp/help.el | |||
| @@ -91,24 +91,30 @@ | |||
| 91 | (define-key help-map "q" 'help-quit) | 91 | (define-key help-map "q" 'help-quit) |
| 92 | 92 | ||
| 93 | (defvar help-font-lock-keywords | 93 | (defvar help-font-lock-keywords |
| 94 | (let ((name-char "[-+a-zA-Z0-9_*]") (sym-char "[-+a-zA-Z0-9_:*]")) | 94 | (eval-when-compile |
| 95 | (list | 95 | (let ((name-char "[-+a-zA-Z0-9_*]") (sym-char "[-+a-zA-Z0-9_:*]")) |
| 96 | ;; | 96 | (list |
| 97 | ;; The symbol itself. | 97 | ;; |
| 98 | (list (concat "\\`\\(" name-char "+\\)\\(:\\)?") | 98 | ;; The symbol itself. |
| 99 | '(1 (if (match-beginning 2) | 99 | (list (concat "\\`\\(" name-char "+\\)\\(\\(:\\)\\|\\('\\)\\)") |
| 100 | font-lock-function-name-face | 100 | '(1 font-lock-function-name-face)) |
| 101 | font-lock-variable-name-face) | 101 | ;; |
| 102 | nil t)) | 102 | ;; Words inside `' which tend to be symbol names. |
| 103 | ;; | 103 | (list (concat "`\\(" sym-char sym-char "+\\)'") |
| 104 | ;; Words inside `' which tend to be symbol names. | 104 | 1 'font-lock-reference-face t) |
| 105 | (list (concat "`\\(" sym-char sym-char "+\\)'") | 105 | ;; |
| 106 | 1 'font-lock-reference-face t) | 106 | ;; CLisp `:' keywords as references. |
| 107 | ;; | 107 | (list (concat "\\<:" sym-char "+\\>") 0 'font-lock-reference-face t)))) |
| 108 | ;; CLisp `:' keywords as references. | ||
| 109 | (list (concat "\\<:" sym-char "+\\>") 0 'font-lock-reference-face t))) | ||
| 110 | "Default expressions to highlight in Help mode.") | 108 | "Default expressions to highlight in Help mode.") |
| 111 | 109 | ||
| 110 | (defun help-fontify-buffer-function () | ||
| 111 | ;; This function's symbol is bound to font-lock-fontify-buffer-function. | ||
| 112 | (let ((font-lock-fontify-region-function 'font-lock-default-fontify-region)) | ||
| 113 | ;; Fontify as normal. | ||
| 114 | (font-lock-default-fontify-buffer) | ||
| 115 | ;; Prevent Font Lock mode from kicking in. | ||
| 116 | (setq font-lock-fontified t))) | ||
| 117 | |||
| 112 | (defun help-mode () | 118 | (defun help-mode () |
| 113 | "Major mode for viewing help text. | 119 | "Major mode for viewing help text. |
| 114 | Entry to this mode runs the normal hook `help-mode-hook'. | 120 | Entry to this mode runs the normal hook `help-mode-hook'. |
| @@ -120,7 +126,11 @@ Commands: | |||
| 120 | (setq mode-name "Help") | 126 | (setq mode-name "Help") |
| 121 | (setq major-mode 'help-mode) | 127 | (setq major-mode 'help-mode) |
| 122 | (make-local-variable 'font-lock-defaults) | 128 | (make-local-variable 'font-lock-defaults) |
| 123 | (setq font-lock-defaults '(help-font-lock-keywords)) | 129 | (setq font-lock-defaults |
| 130 | '(help-font-lock-keywords nil nil nil nil | ||
| 131 | (font-lock-inhibit-thing-lock . (lazy-lock-mode)) | ||
| 132 | (font-lock-fontify-region-function . ignore) | ||
| 133 | (font-lock-fontify-buffer-function . help-fontify-buffer-function))) | ||
| 124 | (view-mode) | 134 | (view-mode) |
| 125 | (run-hooks 'help-mode-hook)) | 135 | (run-hooks 'help-mode-hook)) |
| 126 | 136 | ||