summaryrefslogtreecommitdiff
path: root/lisp/help.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1996-07-27 02:44:27 +0000
committerRichard M. Stallman <rms@gnu.org>1996-07-27 02:44:27 +0000
commit0e0ee795442b32f677df2bf02e431595f7680281 (patch)
tree2110ff4927c7f767a23b5a8ca6562d54b87d1a7d /lisp/help.el
parentbcbe4d5724c5e859235fb472d6e1542a80836863 (diff)
downloademacs-0e0ee795442b32f677df2bf02e431595f7680281.tar.gz
(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.
Diffstat (limited to 'lisp/help.el')
-rw-r--r--lisp/help.el44
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 @@
(define-key help-map "q" 'help-quit)
(defvar help-font-lock-keywords
- (let ((name-char "[-+a-zA-Z0-9_*]") (sym-char "[-+a-zA-Z0-9_:*]"))
- (list
- ;;
- ;; The symbol itself.
- (list (concat "\\`\\(" name-char "+\\)\\(:\\)?")
- '(1 (if (match-beginning 2)
- font-lock-function-name-face
- font-lock-variable-name-face)
- nil t))
- ;;
- ;; Words inside `' which tend to be symbol names.
- (list (concat "`\\(" sym-char sym-char "+\\)'")
- 1 'font-lock-reference-face t)
- ;;
- ;; CLisp `:' keywords as references.
- (list (concat "\\<:" sym-char "+\\>") 0 'font-lock-reference-face t)))
+ (eval-when-compile
+ (let ((name-char "[-+a-zA-Z0-9_*]") (sym-char "[-+a-zA-Z0-9_:*]"))
+ (list
+ ;;
+ ;; The symbol itself.
+ (list (concat "\\`\\(" name-char "+\\)\\(\\(:\\)\\|\\('\\)\\)")
+ '(1 font-lock-function-name-face))
+ ;;
+ ;; Words inside `' which tend to be symbol names.
+ (list (concat "`\\(" sym-char sym-char "+\\)'")
+ 1 'font-lock-reference-face t)
+ ;;
+ ;; CLisp `:' keywords as references.
+ (list (concat "\\<:" sym-char "+\\>") 0 'font-lock-reference-face t))))
"Default expressions to highlight in Help mode.")
+(defun help-fontify-buffer-function ()
+ ;; This function's symbol is bound to font-lock-fontify-buffer-function.
+ (let ((font-lock-fontify-region-function 'font-lock-default-fontify-region))
+ ;; Fontify as normal.
+ (font-lock-default-fontify-buffer)
+ ;; Prevent Font Lock mode from kicking in.
+ (setq font-lock-fontified t)))
+
(defun help-mode ()
"Major mode for viewing help text.
Entry to this mode runs the normal hook `help-mode-hook'.
@@ -120,7 +126,11 @@ Commands:
(setq mode-name "Help")
(setq major-mode 'help-mode)
(make-local-variable 'font-lock-defaults)
- (setq font-lock-defaults '(help-font-lock-keywords))
+ (setq font-lock-defaults
+ '(help-font-lock-keywords nil nil nil nil
+ (font-lock-inhibit-thing-lock . (lazy-lock-mode))
+ (font-lock-fontify-region-function . ignore)
+ (font-lock-fontify-buffer-function . help-fontify-buffer-function)))
(view-mode)
(run-hooks 'help-mode-hook))