comparison lisp/help.el @ 31422:2a7aafb126fb

(help-make-xrefs): Adjusted for the change of help-xref-mule-regexp. (help-insert-xref-button): New function.
author Kenichi Handa <handa@m17n.org>
date Thu, 07 Sep 2000 02:37:37 +0000
parents 90250e4999e6
children 080006769824
comparison
equal deleted inserted replaced
31421:7b1f56a27530 31422:2a7aafb126fb
1128 ;; `help-xref-symbol-regexp' because some of Mule 1128 ;; `help-xref-symbol-regexp' because some of Mule
1129 ;; keywords have variable or function definitions. 1129 ;; keywords have variable or function definitions.
1130 (if help-xref-mule-regexp 1130 (if help-xref-mule-regexp
1131 (save-excursion 1131 (save-excursion
1132 (while (re-search-forward help-xref-mule-regexp nil t) 1132 (while (re-search-forward help-xref-mule-regexp nil t)
1133 (let* ((data (match-string 5)) 1133 (let* ((data (match-string 7))
1134 (sym (intern-soft data))) 1134 (sym (intern-soft data)))
1135 (cond 1135 (cond
1136 ((match-string 3) ; coding system 1136 ((match-string 3) ; coding system
1137 (and sym (coding-system-p sym) 1137 (and sym (coding-system-p sym)
1138 (help-xref-button 1138 (help-xref-button
1139 5 #'describe-coding-system sym 1139 7 #'describe-coding-system sym
1140 "mouse-2, RET: describe this coding system"))) 1140 "mouse-2, RET: describe this coding system")))
1141 ((match-string 4) ; input method 1141 ((match-string 4) ; input method
1142 (and (assoc data input-method-alist) 1142 (and (assoc data input-method-alist)
1143 (help-xref-button 1143 (help-xref-button
1144 5 #'describe-input-method data 1144 7 #'describe-input-method data
1145 "mouse-2, RET: describe this input method"))) 1145 "mouse-2, RET: describe this input method")))
1146 ((or (match-string 5) (match-string 6)) ; charset
1147 (and sym (charsetp sym)
1148 (help-xref-button
1149 7 #'describe-character-set sym
1150 "mouse-2, RET: describe this character set")))
1151 ((assoc data input-method-alist)
1152 (help-xref-button
1153 7 #'describe-input-method data
1154 "mouse-2, RET: describe this input method"))
1146 ((and sym (coding-system-p sym)) 1155 ((and sym (coding-system-p sym))
1147 (help-xref-button 1156 (help-xref-button
1148 5 #'describe-coding-system sym 1157 7 #'describe-coding-system sym
1149 "mouse-2, RET: describe this coding system")) 1158 "mouse-2, RET: describe this coding system"))
1150 ((assoc data input-method-alist) 1159 ((and sym (charsetp sym))
1151 (help-xref-button 1160 (help-xref-button
1152 5 #'describe-input-method data 1161 7 #'describe-character-set sym
1153 "mouse-2, RET: describe this input method"))))))) 1162 "mouse-2, RET: describe this character set")))))))
1154 ;; Quoted symbols 1163 ;; Quoted symbols
1155 (save-excursion 1164 (save-excursion
1156 (while (re-search-forward help-xref-symbol-regexp nil t) 1165 (while (re-search-forward help-xref-symbol-regexp nil t)
1157 (let* ((data (match-string 7)) 1166 (let* ((data (match-string 7))
1158 (sym (intern-soft data))) 1167 (sym (intern-soft data)))
1269 (if help-highlight-p 1278 (if help-highlight-p
1270 (put-text-property (match-beginning match-number) 1279 (put-text-property (match-beginning match-number)
1271 (match-end match-number) 1280 (match-end match-number)
1272 'face help-highlight-face)))) 1281 'face help-highlight-face))))
1273 1282
1283 (defun help-insert-xref-button (string function data &optional help-echo)
1284 "Insert STRING and make a hyperlink fro cross-reference text on it.
1285
1286 FUNCTION is a function to invoke when the button is activated, applied
1287 to DATA. DATA may be a single value or a list. See
1288 `help-make-xrefs'.
1289 If optional arg HELP-ECHO is supplied, it is used as a help string."
1290 (let ((pos (point)))
1291 (insert string)
1292 (goto-char pos)
1293 (search-forward string)
1294 (help-xref-button 0 function data help-echo)))
1295
1296
1274 1297
1275 ;; Additional functions for (re-)creating types of help buffers. 1298 ;; Additional functions for (re-)creating types of help buffers.
1276 (defun help-xref-interned (symbol) 1299 (defun help-xref-interned (symbol)
1277 "Follow a hyperlink which appeared to be an arbitrary interned SYMBOL. 1300 "Follow a hyperlink which appeared to be an arbitrary interned SYMBOL.
1278 1301