comparison lisp/help.el @ 15788:e8e74fb6da7d

(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.
author Richard M. Stallman <rms@gnu.org>
date Sat, 27 Jul 1996 02:44:27 +0000
parents e0524a01fc91
children 2a1123f30c73
comparison
equal deleted inserted replaced
15787:d5dd4b891c3e 15788:e8e74fb6da7d
89 (define-key help-map "v" 'describe-variable) 89 (define-key help-map "v" 'describe-variable)
90 90
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.")
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)))
111 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'.
115 Commands: 121 Commands:
118 (kill-all-local-variables) 124 (kill-all-local-variables)
119 (use-local-map help-mode-map) 125 (use-local-map help-mode-map)
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
127 (defun help-quit () 137 (defun help-quit ()
128 (interactive) 138 (interactive)