• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.9.5/emacs-92/emacs/lisp/

Lines Matching +defs:help +defs:character +defs:set

0 ;;; help-mode.el --- `help-mode' used by *Help* buffers
7 ;; Keywords: help, internal
28 ;; Defines `help-mode', which is the mode used by *Help* buffers, and
36 (defvar help-mode-map (make-sparse-keymap)
37 "Keymap for help mode.")
39 (set-keymap-parent help-mode-map button-buffer-map)
41 (define-key help-mode-map [mouse-2] 'help-follow-mouse)
42 (define-key help-mode-map "\C-c\C-b" 'help-go-back)
43 (define-key help-mode-map "\C-c\C-c" 'help-follow-symbol)
45 (define-key help-mode-map "\r" 'help-follow)
47 (defvar help-xref-stack nil
48 "A stack of ways by which to return to help buffers after following xrefs.
49 Used by `help-follow' and `help-xref-go-back'.
52 (put 'help-xref-stack 'permanent-local t)
53 (make-variable-buffer-local 'help-xref-stack)
55 (defvar help-xref-stack-item nil
56 "An item for `help-follow' in this buffer to push onto `help-xref-stack'.
58 (put 'help-xref-stack-item 'permanent-local t)
59 (make-variable-buffer-local 'help-xref-stack-item)
61 (setq-default help-xref-stack nil help-xref-stack-item nil)
63 (defcustom help-mode-hook nil
64 "Hook run by `help-mode'."
66 :group 'help)
69 ;; Button types used by help
71 (define-button-type 'help-xref
73 'action #'help-button-action)
75 (defun help-button-action (button)
76 "Call BUTTON's help function."
77 (help-do-xref (button-start button)
78 (button-get button 'help-function)
79 (button-get button 'help-args)))
85 (define-button-type 'help-function
86 :supertype 'help-xref
87 'help-function 'describe-function
88 'help-echo (purecopy "mouse-2, RET: describe this function"))
90 (define-button-type 'help-variable
91 :supertype 'help-xref
92 'help-function 'describe-variable
93 'help-echo (purecopy "mouse-2, RET: describe this variable"))
95 (define-button-type 'help-face
96 :supertype 'help-xref
97 'help-function 'describe-face
98 'help-echo (purecopy "mouse-2, RET: describe this face"))
100 (define-button-type 'help-coding-system
101 :supertype 'help-xref
102 'help-function 'describe-coding-system
103 'help-echo (purecopy "mouse-2, RET: describe this coding system"))
105 (define-button-type 'help-input-method
106 :supertype 'help-xref
107 'help-function 'describe-input-method
108 'help-echo (purecopy "mouse-2, RET: describe this input method"))
110 (define-button-type 'help-character-set
111 :supertype 'help-xref
112 'help-function 'describe-character-set
113 'help-echo (purecopy "mouse-2, RET: describe this character set"))
117 (define-button-type 'help-symbol
118 :supertype 'help-xref
119 'help-function #'help-xref-interned
120 'help-echo (purecopy "mouse-2, RET: describe this symbol"))
122 (define-button-type 'help-back
123 :supertype 'help-xref
124 'help-function #'help-xref-go-back
125 'help-echo (purecopy "mouse-2, RET: go back to previous help buffer"))
127 (define-button-type 'help-info
128 :supertype 'help-xref
129 'help-function #'info
130 'help-echo (purecopy "mouse-2, RET: read this Info node"))
132 (define-button-type 'help-url
133 :supertype 'help-xref
134 'help-function #'browse-url
135 'help-echo (purecopy "mouse-2, RET: view this URL in a browser"))
137 (define-button-type 'help-customize-variable
138 :supertype 'help-xref
139 'help-function (lambda (v)
141 'help-echo (purecopy "mouse-2, RET: customize variable"))
143 (define-button-type 'help-customize-face
144 :supertype 'help-xref
145 'help-function (lambda (v)
147 'help-echo (purecopy "mouse-2, RET: customize face"))
149 (define-button-type 'help-function-def
150 :supertype 'help-xref
151 'help-function (lambda (fun file)
155 (help-C-file-name (indirect-function fun) 'fun)))
164 'help-echo (purecopy "mouse-2, RET: find function's definition"))
166 (define-button-type 'help-variable-def
167 :supertype 'help-xref
168 'help-function (lambda (var &optional file)
170 (setq file (help-C-file-name var 'var)))
176 'help-echo (purecopy "mouse-2, RET: find variable's definition"))
178 (define-button-type 'help-face-def
179 :supertype 'help-xref
180 'help-function (lambda (fun file)
190 'help-echo (purecopy "mouse-2, RET: find face's definition"))
195 (defun help-mode ()
196 "Major mode for viewing help text and navigating references in it.
197 Entry to this mode runs the normal hook `help-mode-hook'.
199 \\{help-mode-map}"
202 (use-local-map help-mode-map)
204 (setq major-mode 'help-mode)
212 (run-mode-hooks 'help-mode-hook))
215 (defun help-mode-setup ()
216 (help-mode)
220 (defun help-mode-finish ()
226 ;; (setcdr entry (cons (selected-window) help-return-method))
229 (cons (cons (selected-window) help-return-method)
231 (when (eq major-mode 'help-mode)
235 (help-make-xrefs (current-buffer))))
245 (defvar help-back-label (purecopy "[back]")
246 "Label to use by `help-make-xrefs' for the go-back reference.")
248 (defconst help-xref-symbol-regexp
255 ;; Note starting with word-syntax character:
262 (defvar help-xref-mule-regexp nil
266 when help commands related to multilingual environment (e.g.,
270 (defconst help-xref-info-regexp
274 (defconst help-xref-url-regexp
279 (defun help-setup-xref (item interactive-p)
282 ITEM is a (FUNCTION . ARGS) pair appropriate for recreating the help
285 items for help buffer \"back\" buttons is cleared.
290 (with-current-buffer (help-buffer)
291 (when help-xref-stack-item
292 (push (cons (point) help-xref-stack-item) help-xref-stack))
294 (let ((tail (nthcdr 10 help-xref-stack)))
297 (setq help-xref-stack-item item)))
299 (defvar help-xref-following nil
300 "Non-nil when following a help cross-reference.")
302 (defun help-buffer ()
304 (if help-xref-following
308 (defvar help-xref-override-view-map
310 (set-keymap-parent map view-mode-map)
313 "Replacement keymap for `view-mode' in help buffers.")
316 (defun help-make-xrefs (&optional buffer)
320 references for selection with `help-follow'. Cross-references have
323 `help-xref-symbol-regexp'. Faces only get cross-referenced if
328 If the variable `help-xref-mule-regexp' is non-nil, find also
331 the type of reference as the same way as `help-xref-symbol-regexp'.
334 help buffers. Variable `help-back-label' specifies the text for
338 (set-buffer (or buffer (current-buffer)))
347 (set-syntax-table emacs-lisp-mode-syntax-table)
353 (while (re-search-forward help-xref-info-regexp nil t)
358 (help-xref-button 2 'help-info data))))
361 (while (re-search-forward help-xref-url-regexp nil t)
363 (help-xref-button 1 'help-url data))))
365 ;; `help-xref-symbol-regexp' because some of Mule
367 (if help-xref-mule-regexp
369 (while (re-search-forward help-xref-mule-regexp nil t)
375 (help-xref-button 6 'help-coding-system sym)))
378 (help-xref-button 7 'help-input-method data)))
381 (help-xref-button 7 'help-character-set sym)))
383 (help-xref-button 7 'help-character-set data))
385 (help-xref-button 7 'help-coding-system sym))
387 (help-xref-button 7 'help-character-set sym)))))))
390 (while (re-search-forward help-xref-symbol-regexp nil t)
399 (help-xref-button 8 'help-variable sym)))
402 (help-xref-button 8 'help-function sym)))
405 (help-xref-button 8 'help-face sym)))
414 (help-xref-button 8 'help-function-def sym))
418 (help-xref-button 8 'help-face sym))
424 (help-xref-button 8 'help-symbol sym))
436 (help-xref-button 8 'help-variable sym))
438 (help-xref-button 8 'help-function sym)))))))
447 (help-xref-button 1 'help-function sym)))))
473 (help-xref-button 0 'help-function sym))))
475 (set-syntax-table stab))
482 (when help-xref-stack
484 (help-insert-xref-button help-back-label 'help-back
488 (set (make-local-variable 'minor-mode-overriding-map-alist)
489 (list (cons 'view-mode help-xref-override-view-map)))
490 (set-buffer-modified-p old-modified))))
493 (defun help-xref-button (match-number type &rest args)
497 passed to the button's help-function when it is invoked.
498 See `help-make-xrefs'."
503 'type type 'help-args args)))
506 (defun help-insert-xref-button (string type &rest args)
509 to the button's help-function when it is invoked.
510 See `help-make-xrefs'."
512 (insert-text-button string 'type type 'help-args args)))
515 (defun help-xref-on-pp (from to)
530 (type (cond ((fboundp sym) 'help-function)
538 'help-variable))))
539 (when type (help-xref-button 1 type sym)))
546 ;; Additional functions for (re-)creating types of help buffers.
547 (defun help-xref-interned (symbol)
550 help buffer."
551 (with-current-buffer (help-buffer)
553 (help-setup-xref nil nil)
556 (setq help-xref-stack-item nil)
560 (setq help-xref-stack-item nil)
565 (setq help-xref-stack-item nil)
569 ;; We now have a help buffer on the variable.
584 (setq help-xref-stack-item nil)
585 (help-setup-xref (list #'help-xref-interned symbol) nil)))
587 ;; We now have a help buffer on the function.
595 (setq help-xref-stack-item nil)
596 (help-setup-xref (list #'help-xref-interned symbol) nil)))))))
602 (defun help-xref-go-back (buffer)
603 "From BUFFER, go back to previous help buffer text using `help-xref-stack'."
606 (when help-xref-stack
607 (setq item (pop help-xref-stack)
611 help-xref-stack-item nil
618 (set-window-point (get-buffer-window buffer) position)
621 (defun help-go-back ()
622 "Go back to previous topic in this help buffer."
624 (if help-xref-stack
625 (help-xref-go-back (current-buffer))
626 (error "No previous help buffer")))
628 (defun help-do-xref (pos function args)
629 "Call the help cross-reference function FUNCTION with args ARGS.
630 Things are set up properly so that the resulting help-buffer has
633 (let ((help-xref-following t))
637 (defun help-follow-mouse ()
643 (defun help-follow ()
646 For the cross-reference format, see `help-make-xrefs'."
650 (defun help-follow-symbol (&optional pos)
651 "In help buffer, show docs for symbol at POS, defaulting to point.
667 (help-do-xref pos #'help-xref-interned (list sym)))))
669 (defun help-insert-string (string)
670 "Insert STRING to the help buffer and install xref info for it.
671 This function can be used to restore the old contents of the help buffer
674 help buffer by other means."
675 (setq help-xref-stack-item (list #'help-insert-string string))
676 (with-output-to-temp-buffer (help-buffer)
679 (provide 'help-mode)
682 ;;; help-mode.el ends here