Mercurial > emacs
annotate lisp/help-mode.el @ 109750:0851022edd4b
* xfns.c (Fx_hide_tip): Check FRAME_LIVE_P (f) before calling xg_hide_tooltip.
author | Jan D <jan.h.d@swipnet.se> |
---|---|
date | Wed, 11 Aug 2010 20:47:34 +0200 |
parents | 858e3e43cfd5 |
children | 280c8ae2476d |
rev | line source |
---|---|
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
1 ;;; help-mode.el --- `help-mode' used by *Help* buffers |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
2 |
64762
41bb365f41c4
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64306
diff
changeset
|
3 ;; Copyright (C) 1985, 1986, 1993, 1994, 1998, 1999, 2000, 2001, 2002, |
106815 | 4 ;; 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
5 |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
6 ;; Maintainer: FSF |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
7 ;; Keywords: help, internal |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
8 |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
9 ;; This file is part of GNU Emacs. |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
10 |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
92210
diff
changeset
|
11 ;; GNU Emacs is free software: you can redistribute it and/or modify |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
12 ;; it under the terms of the GNU General Public License as published by |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
92210
diff
changeset
|
13 ;; the Free Software Foundation, either version 3 of the License, or |
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
92210
diff
changeset
|
14 ;; (at your option) any later version. |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
15 |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
16 ;; GNU Emacs is distributed in the hope that it will be useful, |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
19 ;; GNU General Public License for more details. |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
20 |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
21 ;; You should have received a copy of the GNU General Public License |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
92210
diff
changeset
|
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
23 |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
24 ;;; Commentary: |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
25 |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
26 ;; Defines `help-mode', which is the mode used by *Help* buffers, and |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
27 ;; associated support machinery, such as adding hyperlinks, etc., |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
28 |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
29 ;;; Code: |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
30 |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
31 (require 'button) |
46437
6987a52d9b98
(view): Always require.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45767
diff
changeset
|
32 (require 'view) |
91980
7858437fe6d8
Require easymenu when compiling.
Juanma Barranquero <lekktu@gmail.com>
parents:
91976
diff
changeset
|
33 (eval-when-compile (require 'easymenu)) |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
34 |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
35 (defvar help-mode-map (make-sparse-keymap) |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
36 "Keymap for help mode.") |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
37 |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
38 (set-keymap-parent help-mode-map button-buffer-map) |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
39 |
39787
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
40 (define-key help-mode-map [mouse-2] 'help-follow-mouse) |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
41 (define-key help-mode-map "\C-c\C-b" 'help-go-back) |
81266
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
42 (define-key help-mode-map "\C-c\C-f" 'help-go-forward) |
69587
ddaea7e69d4f
(help-follow-symbol): New function. Essentially identical to the old
Luc Teirlinck <teirllm@auburn.edu>
parents:
68651
diff
changeset
|
43 (define-key help-mode-map "\C-c\C-c" 'help-follow-symbol) |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
44 ;; Documentation only, since we use minor-mode-overriding-map-alist. |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
45 (define-key help-mode-map "\r" 'help-follow) |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
46 |
91976
59b1ca0ea158
(help-mode-menu): New menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87649
diff
changeset
|
47 (easy-menu-define help-mode-menu help-mode-map |
59b1ca0ea158
(help-mode-menu): New menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87649
diff
changeset
|
48 "Menu for Help Mode." |
59b1ca0ea158
(help-mode-menu): New menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87649
diff
changeset
|
49 '("Help-Mode" |
59b1ca0ea158
(help-mode-menu): New menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87649
diff
changeset
|
50 ["Show Help for Symbol" help-follow-symbol |
59b1ca0ea158
(help-mode-menu): New menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87649
diff
changeset
|
51 :help "Show the docs for the symbol at point"] |
59b1ca0ea158
(help-mode-menu): New menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87649
diff
changeset
|
52 ["Previous Topic" help-go-back |
59b1ca0ea158
(help-mode-menu): New menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87649
diff
changeset
|
53 :help "Go back to previous topic in this help buffer"] |
59b1ca0ea158
(help-mode-menu): New menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87649
diff
changeset
|
54 ["Next Topic" help-go-forward |
59b1ca0ea158
(help-mode-menu): New menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87649
diff
changeset
|
55 :help "Go back to next topic in this help buffer"] |
59b1ca0ea158
(help-mode-menu): New menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87649
diff
changeset
|
56 ["Move to Previous Button" backward-button |
59b1ca0ea158
(help-mode-menu): New menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87649
diff
changeset
|
57 :help "Move to the Next Button in the help buffer"] |
59b1ca0ea158
(help-mode-menu): New menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87649
diff
changeset
|
58 ["Move to Next Button" forward-button |
59b1ca0ea158
(help-mode-menu): New menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87649
diff
changeset
|
59 :help "Move to the Next Button in the help buffer"])) |
59b1ca0ea158
(help-mode-menu): New menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87649
diff
changeset
|
60 |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
61 (defvar help-xref-stack nil |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
62 "A stack of ways by which to return to help buffers after following xrefs. |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
63 Used by `help-follow' and `help-xref-go-back'. |
39787
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
64 An element looks like (POSITION FUNCTION ARGS...). |
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
65 To use the element, do (apply FUNCTION ARGS) then goto the point.") |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
66 (put 'help-xref-stack 'permanent-local t) |
39787
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
67 (make-variable-buffer-local 'help-xref-stack) |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
68 |
81266
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
69 (defvar help-xref-forward-stack nil |
98023
a505cea6cc1b
(help-xref-forward-stack): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
94678
diff
changeset
|
70 "A stack used to navigate help forwards after using the back button. |
81266
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
71 Used by `help-follow' and `help-xref-go-forward'. |
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
72 An element looks like (POSITION FUNCTION ARGS...). |
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
73 To use the element, do (apply FUNCTION ARGS) then goto the point.") |
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
74 (put 'help-xref-forward-stack 'permanent-local t) |
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
75 (make-variable-buffer-local 'help-xref-forward-stack) |
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
76 |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
77 (defvar help-xref-stack-item nil |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
78 "An item for `help-follow' in this buffer to push onto `help-xref-stack'. |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
79 The format is (FUNCTION ARGS...).") |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
80 (put 'help-xref-stack-item 'permanent-local t) |
39787
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
81 (make-variable-buffer-local 'help-xref-stack-item) |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
82 |
81266
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
83 (defvar help-xref-stack-forward-item nil |
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
84 "An item for `help-go-back' to push onto `help-xref-forward-stack'. |
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
85 The format is (FUNCTION ARGS...).") |
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
86 (put 'help-xref-stack-forward-item 'permanent-local t) |
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
87 (make-variable-buffer-local 'help-xref-stack-forward-item) |
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
88 |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
89 (setq-default help-xref-stack nil help-xref-stack-item nil) |
81266
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
90 (setq-default help-xref-forward-stack nil help-xref-forward-stack-item nil) |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
91 |
41331
8fa706b1026c
(help-mode): Undo 2001-10-07 change.
Richard M. Stallman <rms@gnu.org>
parents:
40638
diff
changeset
|
92 (defcustom help-mode-hook nil |
8fa706b1026c
(help-mode): Undo 2001-10-07 change.
Richard M. Stallman <rms@gnu.org>
parents:
40638
diff
changeset
|
93 "Hook run by `help-mode'." |
8fa706b1026c
(help-mode): Undo 2001-10-07 change.
Richard M. Stallman <rms@gnu.org>
parents:
40638
diff
changeset
|
94 :type 'hook |
8fa706b1026c
(help-mode): Undo 2001-10-07 change.
Richard M. Stallman <rms@gnu.org>
parents:
40638
diff
changeset
|
95 :group 'help) |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
96 |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
97 ;; Button types used by help |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
98 |
40638
84e66cdcffc5
(help-xref): New button type.
Miles Bader <miles@gnu.org>
parents:
40191
diff
changeset
|
99 (define-button-type 'help-xref |
59020
9916bd512da7
(help-xref): Add follow-link property.
Kim F. Storm <storm@cua.dk>
parents:
56579
diff
changeset
|
100 'follow-link t |
40638
84e66cdcffc5
(help-xref): New button type.
Miles Bader <miles@gnu.org>
parents:
40191
diff
changeset
|
101 'action #'help-button-action) |
84e66cdcffc5
(help-xref): New button type.
Miles Bader <miles@gnu.org>
parents:
40191
diff
changeset
|
102 |
84e66cdcffc5
(help-xref): New button type.
Miles Bader <miles@gnu.org>
parents:
40191
diff
changeset
|
103 (defun help-button-action (button) |
84e66cdcffc5
(help-xref): New button type.
Miles Bader <miles@gnu.org>
parents:
40191
diff
changeset
|
104 "Call BUTTON's help function." |
84e66cdcffc5
(help-xref): New button type.
Miles Bader <miles@gnu.org>
parents:
40191
diff
changeset
|
105 (help-do-xref (button-start button) |
84e66cdcffc5
(help-xref): New button type.
Miles Bader <miles@gnu.org>
parents:
40191
diff
changeset
|
106 (button-get button 'help-function) |
84e66cdcffc5
(help-xref): New button type.
Miles Bader <miles@gnu.org>
parents:
40191
diff
changeset
|
107 (button-get button 'help-args))) |
84e66cdcffc5
(help-xref): New button type.
Miles Bader <miles@gnu.org>
parents:
40191
diff
changeset
|
108 |
41505
77dd7bf4d860
(help-function, help-variable, help-face)
Richard M. Stallman <rms@gnu.org>
parents:
41331
diff
changeset
|
109 ;; These 6 calls to define-button-type were generated in a dolist |
77dd7bf4d860
(help-function, help-variable, help-face)
Richard M. Stallman <rms@gnu.org>
parents:
41331
diff
changeset
|
110 ;; loop, but that is bad because it means these button types don't |
77dd7bf4d860
(help-function, help-variable, help-face)
Richard M. Stallman <rms@gnu.org>
parents:
41331
diff
changeset
|
111 ;; have an easily found definition. |
77dd7bf4d860
(help-function, help-variable, help-face)
Richard M. Stallman <rms@gnu.org>
parents:
41331
diff
changeset
|
112 |
77dd7bf4d860
(help-function, help-variable, help-face)
Richard M. Stallman <rms@gnu.org>
parents:
41331
diff
changeset
|
113 (define-button-type 'help-function |
77dd7bf4d860
(help-function, help-variable, help-face)
Richard M. Stallman <rms@gnu.org>
parents:
41331
diff
changeset
|
114 :supertype 'help-xref |
77dd7bf4d860
(help-function, help-variable, help-face)
Richard M. Stallman <rms@gnu.org>
parents:
41331
diff
changeset
|
115 'help-function 'describe-function |
77dd7bf4d860
(help-function, help-variable, help-face)
Richard M. Stallman <rms@gnu.org>
parents:
41331
diff
changeset
|
116 'help-echo (purecopy "mouse-2, RET: describe this function")) |
77dd7bf4d860
(help-function, help-variable, help-face)
Richard M. Stallman <rms@gnu.org>
parents:
41331
diff
changeset
|
117 |
77dd7bf4d860
(help-function, help-variable, help-face)
Richard M. Stallman <rms@gnu.org>
parents:
41331
diff
changeset
|
118 (define-button-type 'help-variable |
77dd7bf4d860
(help-function, help-variable, help-face)
Richard M. Stallman <rms@gnu.org>
parents:
41331
diff
changeset
|
119 :supertype 'help-xref |
77dd7bf4d860
(help-function, help-variable, help-face)
Richard M. Stallman <rms@gnu.org>
parents:
41331
diff
changeset
|
120 'help-function 'describe-variable |
77dd7bf4d860
(help-function, help-variable, help-face)
Richard M. Stallman <rms@gnu.org>
parents:
41331
diff
changeset
|
121 'help-echo (purecopy "mouse-2, RET: describe this variable")) |
77dd7bf4d860
(help-function, help-variable, help-face)
Richard M. Stallman <rms@gnu.org>
parents:
41331
diff
changeset
|
122 |
77dd7bf4d860
(help-function, help-variable, help-face)
Richard M. Stallman <rms@gnu.org>
parents:
41331
diff
changeset
|
123 (define-button-type 'help-face |
77dd7bf4d860
(help-function, help-variable, help-face)
Richard M. Stallman <rms@gnu.org>
parents:
41331
diff
changeset
|
124 :supertype 'help-xref |
77dd7bf4d860
(help-function, help-variable, help-face)
Richard M. Stallman <rms@gnu.org>
parents:
41331
diff
changeset
|
125 'help-function 'describe-face |
77dd7bf4d860
(help-function, help-variable, help-face)
Richard M. Stallman <rms@gnu.org>
parents:
41331
diff
changeset
|
126 'help-echo (purecopy "mouse-2, RET: describe this face")) |
77dd7bf4d860
(help-function, help-variable, help-face)
Richard M. Stallman <rms@gnu.org>
parents:
41331
diff
changeset
|
127 |
77dd7bf4d860
(help-function, help-variable, help-face)
Richard M. Stallman <rms@gnu.org>
parents:
41331
diff
changeset
|
128 (define-button-type 'help-coding-system |
77dd7bf4d860
(help-function, help-variable, help-face)
Richard M. Stallman <rms@gnu.org>
parents:
41331
diff
changeset
|
129 :supertype 'help-xref |
77dd7bf4d860
(help-function, help-variable, help-face)
Richard M. Stallman <rms@gnu.org>
parents:
41331
diff
changeset
|
130 'help-function 'describe-coding-system |
77dd7bf4d860
(help-function, help-variable, help-face)
Richard M. Stallman <rms@gnu.org>
parents:
41331
diff
changeset
|
131 'help-echo (purecopy "mouse-2, RET: describe this coding system")) |
77dd7bf4d860
(help-function, help-variable, help-face)
Richard M. Stallman <rms@gnu.org>
parents:
41331
diff
changeset
|
132 |
77dd7bf4d860
(help-function, help-variable, help-face)
Richard M. Stallman <rms@gnu.org>
parents:
41331
diff
changeset
|
133 (define-button-type 'help-input-method |
77dd7bf4d860
(help-function, help-variable, help-face)
Richard M. Stallman <rms@gnu.org>
parents:
41331
diff
changeset
|
134 :supertype 'help-xref |
77dd7bf4d860
(help-function, help-variable, help-face)
Richard M. Stallman <rms@gnu.org>
parents:
41331
diff
changeset
|
135 'help-function 'describe-input-method |
77dd7bf4d860
(help-function, help-variable, help-face)
Richard M. Stallman <rms@gnu.org>
parents:
41331
diff
changeset
|
136 'help-echo (purecopy "mouse-2, RET: describe this input method")) |
77dd7bf4d860
(help-function, help-variable, help-face)
Richard M. Stallman <rms@gnu.org>
parents:
41331
diff
changeset
|
137 |
77dd7bf4d860
(help-function, help-variable, help-face)
Richard M. Stallman <rms@gnu.org>
parents:
41331
diff
changeset
|
138 (define-button-type 'help-character-set |
77dd7bf4d860
(help-function, help-variable, help-face)
Richard M. Stallman <rms@gnu.org>
parents:
41331
diff
changeset
|
139 :supertype 'help-xref |
77dd7bf4d860
(help-function, help-variable, help-face)
Richard M. Stallman <rms@gnu.org>
parents:
41331
diff
changeset
|
140 'help-function 'describe-character-set |
77dd7bf4d860
(help-function, help-variable, help-face)
Richard M. Stallman <rms@gnu.org>
parents:
41331
diff
changeset
|
141 'help-echo (purecopy "mouse-2, RET: describe this character set")) |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
142 |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
143 ;; make some more ideosyncratic button types |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
144 |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
145 (define-button-type 'help-symbol |
40638
84e66cdcffc5
(help-xref): New button type.
Miles Bader <miles@gnu.org>
parents:
40191
diff
changeset
|
146 :supertype 'help-xref |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
147 'help-function #'help-xref-interned |
40638
84e66cdcffc5
(help-xref): New button type.
Miles Bader <miles@gnu.org>
parents:
40191
diff
changeset
|
148 'help-echo (purecopy "mouse-2, RET: describe this symbol")) |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
149 |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
150 (define-button-type 'help-back |
40638
84e66cdcffc5
(help-xref): New button type.
Miles Bader <miles@gnu.org>
parents:
40191
diff
changeset
|
151 :supertype 'help-xref |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
152 'help-function #'help-xref-go-back |
40638
84e66cdcffc5
(help-xref): New button type.
Miles Bader <miles@gnu.org>
parents:
40191
diff
changeset
|
153 'help-echo (purecopy "mouse-2, RET: go back to previous help buffer")) |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
154 |
81266
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
155 (define-button-type 'help-forward |
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
156 :supertype 'help-xref |
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
157 'help-function #'help-xref-go-forward |
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
158 'help-echo (purecopy "mouse-2, RET: move forward to next help buffer")) |
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
159 |
92210
692687f5f1ca
(describe-variable): Add phrases about initialization file with and
Robert J. Chassell <bob@rattlesnake.com>
parents:
91980
diff
changeset
|
160 (define-button-type 'help-info-variable |
692687f5f1ca
(describe-variable): Add phrases about initialization file with and
Robert J. Chassell <bob@rattlesnake.com>
parents:
91980
diff
changeset
|
161 :supertype 'help-xref |
692687f5f1ca
(describe-variable): Add phrases about initialization file with and
Robert J. Chassell <bob@rattlesnake.com>
parents:
91980
diff
changeset
|
162 ;; the name of the variable is put before the argument to Info |
692687f5f1ca
(describe-variable): Add phrases about initialization file with and
Robert J. Chassell <bob@rattlesnake.com>
parents:
91980
diff
changeset
|
163 'help-function (lambda (a v) (info v)) |
692687f5f1ca
(describe-variable): Add phrases about initialization file with and
Robert J. Chassell <bob@rattlesnake.com>
parents:
91980
diff
changeset
|
164 'help-echo (purecopy "mouse-2, RET: read this Info node")) |
692687f5f1ca
(describe-variable): Add phrases about initialization file with and
Robert J. Chassell <bob@rattlesnake.com>
parents:
91980
diff
changeset
|
165 |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
166 (define-button-type 'help-info |
40638
84e66cdcffc5
(help-xref): New button type.
Miles Bader <miles@gnu.org>
parents:
40191
diff
changeset
|
167 :supertype 'help-xref |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
168 'help-function #'info |
66513
bfd70a868157
(help-url): New button type. Calls browse-url.
Bill Wohler <wohler@newt.com>
parents:
64762
diff
changeset
|
169 'help-echo (purecopy "mouse-2, RET: read this Info node")) |
bfd70a868157
(help-url): New button type. Calls browse-url.
Bill Wohler <wohler@newt.com>
parents:
64762
diff
changeset
|
170 |
bfd70a868157
(help-url): New button type. Calls browse-url.
Bill Wohler <wohler@newt.com>
parents:
64762
diff
changeset
|
171 (define-button-type 'help-url |
bfd70a868157
(help-url): New button type. Calls browse-url.
Bill Wohler <wohler@newt.com>
parents:
64762
diff
changeset
|
172 :supertype 'help-xref |
bfd70a868157
(help-url): New button type. Calls browse-url.
Bill Wohler <wohler@newt.com>
parents:
64762
diff
changeset
|
173 'help-function #'browse-url |
bfd70a868157
(help-url): New button type. Calls browse-url.
Bill Wohler <wohler@newt.com>
parents:
64762
diff
changeset
|
174 'help-echo (purecopy "mouse-2, RET: view this URL in a browser")) |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
175 |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
176 (define-button-type 'help-customize-variable |
40638
84e66cdcffc5
(help-xref): New button type.
Miles Bader <miles@gnu.org>
parents:
40191
diff
changeset
|
177 :supertype 'help-xref |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
178 'help-function (lambda (v) |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
179 (customize-variable v)) |
40638
84e66cdcffc5
(help-xref): New button type.
Miles Bader <miles@gnu.org>
parents:
40191
diff
changeset
|
180 'help-echo (purecopy "mouse-2, RET: customize variable")) |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
181 |
39800
8f2810b5b5e8
(help-customize-face): New button-type.
Miles Bader <miles@gnu.org>
parents:
39787
diff
changeset
|
182 (define-button-type 'help-customize-face |
40638
84e66cdcffc5
(help-xref): New button type.
Miles Bader <miles@gnu.org>
parents:
40191
diff
changeset
|
183 :supertype 'help-xref |
39800
8f2810b5b5e8
(help-customize-face): New button-type.
Miles Bader <miles@gnu.org>
parents:
39787
diff
changeset
|
184 'help-function (lambda (v) |
8f2810b5b5e8
(help-customize-face): New button-type.
Miles Bader <miles@gnu.org>
parents:
39787
diff
changeset
|
185 (customize-face v)) |
40638
84e66cdcffc5
(help-xref): New button type.
Miles Bader <miles@gnu.org>
parents:
40191
diff
changeset
|
186 'help-echo (purecopy "mouse-2, RET: customize face")) |
39800
8f2810b5b5e8
(help-customize-face): New button-type.
Miles Bader <miles@gnu.org>
parents:
39787
diff
changeset
|
187 |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
188 (define-button-type 'help-function-def |
40638
84e66cdcffc5
(help-xref): New button type.
Miles Bader <miles@gnu.org>
parents:
40191
diff
changeset
|
189 :supertype 'help-xref |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
190 'help-function (lambda (fun file) |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
191 (require 'find-func) |
55233
038fab289258
(help-function-def, help-variable-def):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55010
diff
changeset
|
192 (when (eq file 'C-source) |
038fab289258
(help-function-def, help-variable-def):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55010
diff
changeset
|
193 (setq file |
038fab289258
(help-function-def, help-variable-def):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55010
diff
changeset
|
194 (help-C-file-name (indirect-function fun) 'fun))) |
46437
6987a52d9b98
(view): Always require.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45767
diff
changeset
|
195 ;; Don't use find-function-noselect because it follows |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
196 ;; aliases (which fails for built-in functions). |
46437
6987a52d9b98
(view): Always require.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45767
diff
changeset
|
197 (let ((location |
55233
038fab289258
(help-function-def, help-variable-def):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55010
diff
changeset
|
198 (find-function-search-for-symbol fun nil file))) |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
199 (pop-to-buffer (car location)) |
72063
52eeda6a8959
(help-function-def, help-variable-def)
Nick Roberts <nickrob@snap.net.nz>
parents:
71850
diff
changeset
|
200 (if (cdr location) |
52eeda6a8959
(help-function-def, help-variable-def)
Nick Roberts <nickrob@snap.net.nz>
parents:
71850
diff
changeset
|
201 (goto-char (cdr location)) |
52eeda6a8959
(help-function-def, help-variable-def)
Nick Roberts <nickrob@snap.net.nz>
parents:
71850
diff
changeset
|
202 (message "Unable to find location in file")))) |
40638
84e66cdcffc5
(help-xref): New button type.
Miles Bader <miles@gnu.org>
parents:
40191
diff
changeset
|
203 'help-echo (purecopy "mouse-2, RET: find function's definition")) |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
204 |
104930
61a2a632090d
(help-function-cmacro): New button.
Glenn Morris <rgm@gnu.org>
parents:
102785
diff
changeset
|
205 (define-button-type 'help-function-cmacro |
61a2a632090d
(help-function-cmacro): New button.
Glenn Morris <rgm@gnu.org>
parents:
102785
diff
changeset
|
206 :supertype 'help-xref |
61a2a632090d
(help-function-cmacro): New button.
Glenn Morris <rgm@gnu.org>
parents:
102785
diff
changeset
|
207 'help-function (lambda (fun file) |
61a2a632090d
(help-function-cmacro): New button.
Glenn Morris <rgm@gnu.org>
parents:
102785
diff
changeset
|
208 (setq file (locate-library file t)) |
61a2a632090d
(help-function-cmacro): New button.
Glenn Morris <rgm@gnu.org>
parents:
102785
diff
changeset
|
209 (if (and file (file-readable-p file)) |
61a2a632090d
(help-function-cmacro): New button.
Glenn Morris <rgm@gnu.org>
parents:
102785
diff
changeset
|
210 (progn |
61a2a632090d
(help-function-cmacro): New button.
Glenn Morris <rgm@gnu.org>
parents:
102785
diff
changeset
|
211 (pop-to-buffer (find-file-noselect file)) |
61a2a632090d
(help-function-cmacro): New button.
Glenn Morris <rgm@gnu.org>
parents:
102785
diff
changeset
|
212 (goto-char (point-min)) |
61a2a632090d
(help-function-cmacro): New button.
Glenn Morris <rgm@gnu.org>
parents:
102785
diff
changeset
|
213 (if (re-search-forward |
61a2a632090d
(help-function-cmacro): New button.
Glenn Morris <rgm@gnu.org>
parents:
102785
diff
changeset
|
214 (format "^[ \t]*(define-compiler-macro[ \t]+%s" |
61a2a632090d
(help-function-cmacro): New button.
Glenn Morris <rgm@gnu.org>
parents:
102785
diff
changeset
|
215 (regexp-quote (symbol-name fun))) nil t) |
61a2a632090d
(help-function-cmacro): New button.
Glenn Morris <rgm@gnu.org>
parents:
102785
diff
changeset
|
216 (forward-line 0) |
61a2a632090d
(help-function-cmacro): New button.
Glenn Morris <rgm@gnu.org>
parents:
102785
diff
changeset
|
217 (message "Unable to find location in file"))) |
61a2a632090d
(help-function-cmacro): New button.
Glenn Morris <rgm@gnu.org>
parents:
102785
diff
changeset
|
218 (message "Unable to find file"))) |
61a2a632090d
(help-function-cmacro): New button.
Glenn Morris <rgm@gnu.org>
parents:
102785
diff
changeset
|
219 'help-echo (purecopy "mouse-2, RET: find function's compiler macro")) |
61a2a632090d
(help-function-cmacro): New button.
Glenn Morris <rgm@gnu.org>
parents:
102785
diff
changeset
|
220 |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
221 (define-button-type 'help-variable-def |
40638
84e66cdcffc5
(help-xref): New button type.
Miles Bader <miles@gnu.org>
parents:
40191
diff
changeset
|
222 :supertype 'help-xref |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
223 'help-function (lambda (var &optional file) |
55233
038fab289258
(help-function-def, help-variable-def):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55010
diff
changeset
|
224 (when (eq file 'C-source) |
038fab289258
(help-function-def, help-variable-def):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55010
diff
changeset
|
225 (setq file (help-C-file-name var 'var))) |
038fab289258
(help-function-def, help-variable-def):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55010
diff
changeset
|
226 (let ((location (find-variable-noselect var file))) |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
227 (pop-to-buffer (car location)) |
72063
52eeda6a8959
(help-function-def, help-variable-def)
Nick Roberts <nickrob@snap.net.nz>
parents:
71850
diff
changeset
|
228 (if (cdr location) |
52eeda6a8959
(help-function-def, help-variable-def)
Nick Roberts <nickrob@snap.net.nz>
parents:
71850
diff
changeset
|
229 (goto-char (cdr location)) |
52eeda6a8959
(help-function-def, help-variable-def)
Nick Roberts <nickrob@snap.net.nz>
parents:
71850
diff
changeset
|
230 (message "Unable to find location in file")))) |
71801 | 231 'help-echo (purecopy "mouse-2, RET: find variable's definition")) |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
232 |
62387
c051115aeb95
(help-face-def): New button type.
Richard M. Stallman <rms@gnu.org>
parents:
60462
diff
changeset
|
233 (define-button-type 'help-face-def |
c051115aeb95
(help-face-def): New button type.
Richard M. Stallman <rms@gnu.org>
parents:
60462
diff
changeset
|
234 :supertype 'help-xref |
c051115aeb95
(help-face-def): New button type.
Richard M. Stallman <rms@gnu.org>
parents:
60462
diff
changeset
|
235 'help-function (lambda (fun file) |
c051115aeb95
(help-face-def): New button type.
Richard M. Stallman <rms@gnu.org>
parents:
60462
diff
changeset
|
236 (require 'find-func) |
c051115aeb95
(help-face-def): New button type.
Richard M. Stallman <rms@gnu.org>
parents:
60462
diff
changeset
|
237 ;; Don't use find-function-noselect because it follows |
c051115aeb95
(help-face-def): New button type.
Richard M. Stallman <rms@gnu.org>
parents:
60462
diff
changeset
|
238 ;; aliases (which fails for built-in functions). |
c051115aeb95
(help-face-def): New button type.
Richard M. Stallman <rms@gnu.org>
parents:
60462
diff
changeset
|
239 (let ((location |
c051115aeb95
(help-face-def): New button type.
Richard M. Stallman <rms@gnu.org>
parents:
60462
diff
changeset
|
240 (find-function-search-for-symbol fun 'defface file))) |
c051115aeb95
(help-face-def): New button type.
Richard M. Stallman <rms@gnu.org>
parents:
60462
diff
changeset
|
241 (pop-to-buffer (car location)) |
72063
52eeda6a8959
(help-function-def, help-variable-def)
Nick Roberts <nickrob@snap.net.nz>
parents:
71850
diff
changeset
|
242 (if (cdr location) |
52eeda6a8959
(help-function-def, help-variable-def)
Nick Roberts <nickrob@snap.net.nz>
parents:
71850
diff
changeset
|
243 (goto-char (cdr location)) |
52eeda6a8959
(help-function-def, help-variable-def)
Nick Roberts <nickrob@snap.net.nz>
parents:
71850
diff
changeset
|
244 (message "Unable to find location in file")))) |
62387
c051115aeb95
(help-face-def): New button type.
Richard M. Stallman <rms@gnu.org>
parents:
60462
diff
changeset
|
245 'help-echo (purecopy "mouse-2, RET: find face's definition")) |
c051115aeb95
(help-face-def): New button type.
Richard M. Stallman <rms@gnu.org>
parents:
60462
diff
changeset
|
246 |
109027
858e3e43cfd5
Tweaks to package list UI.
Chong Yidong <cyd@stupidchicken.com>
parents:
109026
diff
changeset
|
247 (define-button-type 'help-package |
858e3e43cfd5
Tweaks to package list UI.
Chong Yidong <cyd@stupidchicken.com>
parents:
109026
diff
changeset
|
248 :supertype 'help-xref |
858e3e43cfd5
Tweaks to package list UI.
Chong Yidong <cyd@stupidchicken.com>
parents:
109026
diff
changeset
|
249 'help-function 'describe-package |
858e3e43cfd5
Tweaks to package list UI.
Chong Yidong <cyd@stupidchicken.com>
parents:
109026
diff
changeset
|
250 'help-echo (purecopy "mouse-2, RET: Describe package")) |
858e3e43cfd5
Tweaks to package list UI.
Chong Yidong <cyd@stupidchicken.com>
parents:
109026
diff
changeset
|
251 |
109026
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109021
diff
changeset
|
252 (define-button-type 'help-package-def |
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109021
diff
changeset
|
253 :supertype 'help-xref |
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109021
diff
changeset
|
254 'help-function (lambda (file) (dired file)) |
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109021
diff
changeset
|
255 'help-echo (purecopy "mouse-2, RET: visit package directory")) |
c138aa96dae8
Add preliminary describe-package functionality, and some cleanup.
Chong Yidong <cyd@stupidchicken.com>
parents:
109021
diff
changeset
|
256 |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
257 |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
258 ;;;###autoload |
41331
8fa706b1026c
(help-mode): Undo 2001-10-07 change.
Richard M. Stallman <rms@gnu.org>
parents:
40638
diff
changeset
|
259 (defun help-mode () |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
260 "Major mode for viewing help text and navigating references in it. |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
261 Entry to this mode runs the normal hook `help-mode-hook'. |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
262 Commands: |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
263 \\{help-mode-map}" |
41331
8fa706b1026c
(help-mode): Undo 2001-10-07 change.
Richard M. Stallman <rms@gnu.org>
parents:
40638
diff
changeset
|
264 (interactive) |
8fa706b1026c
(help-mode): Undo 2001-10-07 change.
Richard M. Stallman <rms@gnu.org>
parents:
40638
diff
changeset
|
265 (kill-all-local-variables) |
8fa706b1026c
(help-mode): Undo 2001-10-07 change.
Richard M. Stallman <rms@gnu.org>
parents:
40638
diff
changeset
|
266 (use-local-map help-mode-map) |
8fa706b1026c
(help-mode): Undo 2001-10-07 change.
Richard M. Stallman <rms@gnu.org>
parents:
40638
diff
changeset
|
267 (setq mode-name "Help") |
8fa706b1026c
(help-mode): Undo 2001-10-07 change.
Richard M. Stallman <rms@gnu.org>
parents:
40638
diff
changeset
|
268 (setq major-mode 'help-mode) |
86006
4077065d3026
(help-mode): Set view-exit-action to bury the
Martin Rudalics <rudalics@gmx.at>
parents:
82334
diff
changeset
|
269 |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
270 (view-mode) |
86006
4077065d3026
(help-mode): Set view-exit-action to bury the
Martin Rudalics <rudalics@gmx.at>
parents:
82334
diff
changeset
|
271 (set (make-local-variable 'view-no-disable-on-exit) t) |
4077065d3026
(help-mode): Set view-exit-action to bury the
Martin Rudalics <rudalics@gmx.at>
parents:
82334
diff
changeset
|
272 ;; With Emacs 22 `view-exit-action' could delete the selected window |
4077065d3026
(help-mode): Set view-exit-action to bury the
Martin Rudalics <rudalics@gmx.at>
parents:
82334
diff
changeset
|
273 ;; disregarding whether the help buffer was shown in that window at |
4077065d3026
(help-mode): Set view-exit-action to bury the
Martin Rudalics <rudalics@gmx.at>
parents:
82334
diff
changeset
|
274 ;; all. Since `view-exit-action' is called with the help buffer as |
4077065d3026
(help-mode): Set view-exit-action to bury the
Martin Rudalics <rudalics@gmx.at>
parents:
82334
diff
changeset
|
275 ;; argument it seems more appropriate to have it work on the buffer |
4077065d3026
(help-mode): Set view-exit-action to bury the
Martin Rudalics <rudalics@gmx.at>
parents:
82334
diff
changeset
|
276 ;; only and leave it to `view-mode-exit' to delete any associated |
4077065d3026
(help-mode): Set view-exit-action to bury the
Martin Rudalics <rudalics@gmx.at>
parents:
82334
diff
changeset
|
277 ;; window(s). |
4077065d3026
(help-mode): Set view-exit-action to bury the
Martin Rudalics <rudalics@gmx.at>
parents:
82334
diff
changeset
|
278 (setq view-exit-action |
4077065d3026
(help-mode): Set view-exit-action to bury the
Martin Rudalics <rudalics@gmx.at>
parents:
82334
diff
changeset
|
279 (lambda (buffer) |
4077065d3026
(help-mode): Set view-exit-action to bury the
Martin Rudalics <rudalics@gmx.at>
parents:
82334
diff
changeset
|
280 ;; Use `with-current-buffer' to make sure that `bury-buffer' |
4077065d3026
(help-mode): Set view-exit-action to bury the
Martin Rudalics <rudalics@gmx.at>
parents:
82334
diff
changeset
|
281 ;; also removes BUFFER from the selected window. |
4077065d3026
(help-mode): Set view-exit-action to bury the
Martin Rudalics <rudalics@gmx.at>
parents:
82334
diff
changeset
|
282 (with-current-buffer buffer |
4077065d3026
(help-mode): Set view-exit-action to bury the
Martin Rudalics <rudalics@gmx.at>
parents:
82334
diff
changeset
|
283 (bury-buffer)))) |
4077065d3026
(help-mode): Set view-exit-action to bury the
Martin Rudalics <rudalics@gmx.at>
parents:
82334
diff
changeset
|
284 |
109021
35894ae393bb
Fix revert-buffer functionality of Help mode and Info.
Juri Linkov <juri@jurta.org>
parents:
108725
diff
changeset
|
285 (set (make-local-variable 'revert-buffer-function) |
35894ae393bb
Fix revert-buffer functionality of Help mode and Info.
Juri Linkov <juri@jurta.org>
parents:
108725
diff
changeset
|
286 'help-mode-revert-buffer) |
35894ae393bb
Fix revert-buffer functionality of Help mode and Info.
Juri Linkov <juri@jurta.org>
parents:
108725
diff
changeset
|
287 |
62729
40c5f688942a
(help-mode): Use run-mode-hooks.
Lute Kamstra <lute@gnu.org>
parents:
62387
diff
changeset
|
288 (run-mode-hooks 'help-mode-hook)) |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
289 |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
290 ;;;###autoload |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
291 (defun help-mode-setup () |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
292 (help-mode) |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
293 (setq buffer-read-only nil)) |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
294 |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
295 ;;;###autoload |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
296 (defun help-mode-finish () |
86006
4077065d3026
(help-mode): Set view-exit-action to bury the
Martin Rudalics <rudalics@gmx.at>
parents:
82334
diff
changeset
|
297 (if (eq help-window t) |
4077065d3026
(help-mode): Set view-exit-action to bury the
Martin Rudalics <rudalics@gmx.at>
parents:
82334
diff
changeset
|
298 ;; If `help-window' is t, `view-return-to-alist' is handled by |
4077065d3026
(help-mode): Set view-exit-action to bury the
Martin Rudalics <rudalics@gmx.at>
parents:
82334
diff
changeset
|
299 ;; `with-help-window'. In this case set `help-window' to the |
4077065d3026
(help-mode): Set view-exit-action to bury the
Martin Rudalics <rudalics@gmx.at>
parents:
82334
diff
changeset
|
300 ;; selected window since now is the only moment where we can |
4077065d3026
(help-mode): Set view-exit-action to bury the
Martin Rudalics <rudalics@gmx.at>
parents:
82334
diff
changeset
|
301 ;; unambiguously identify it. |
4077065d3026
(help-mode): Set view-exit-action to bury the
Martin Rudalics <rudalics@gmx.at>
parents:
82334
diff
changeset
|
302 (setq help-window (selected-window)) |
4077065d3026
(help-mode): Set view-exit-action to bury the
Martin Rudalics <rudalics@gmx.at>
parents:
82334
diff
changeset
|
303 (let ((entry (assq (selected-window) view-return-to-alist))) |
4077065d3026
(help-mode): Set view-exit-action to bury the
Martin Rudalics <rudalics@gmx.at>
parents:
82334
diff
changeset
|
304 (if entry |
4077065d3026
(help-mode): Set view-exit-action to bury the
Martin Rudalics <rudalics@gmx.at>
parents:
82334
diff
changeset
|
305 ;; When entering Help mode from the Help window, |
4077065d3026
(help-mode): Set view-exit-action to bury the
Martin Rudalics <rudalics@gmx.at>
parents:
82334
diff
changeset
|
306 ;; such as by following a link, preserve the same |
4077065d3026
(help-mode): Set view-exit-action to bury the
Martin Rudalics <rudalics@gmx.at>
parents:
82334
diff
changeset
|
307 ;; meaning for the q command. |
4077065d3026
(help-mode): Set view-exit-action to bury the
Martin Rudalics <rudalics@gmx.at>
parents:
82334
diff
changeset
|
308 ;; (setcdr entry (cons (selected-window) help-return-method)) |
4077065d3026
(help-mode): Set view-exit-action to bury the
Martin Rudalics <rudalics@gmx.at>
parents:
82334
diff
changeset
|
309 nil |
4077065d3026
(help-mode): Set view-exit-action to bury the
Martin Rudalics <rudalics@gmx.at>
parents:
82334
diff
changeset
|
310 (setq view-return-to-alist |
4077065d3026
(help-mode): Set view-exit-action to bury the
Martin Rudalics <rudalics@gmx.at>
parents:
82334
diff
changeset
|
311 (cons (cons (selected-window) help-return-method) |
4077065d3026
(help-mode): Set view-exit-action to bury the
Martin Rudalics <rudalics@gmx.at>
parents:
82334
diff
changeset
|
312 view-return-to-alist))))) |
4077065d3026
(help-mode): Set view-exit-action to bury the
Martin Rudalics <rudalics@gmx.at>
parents:
82334
diff
changeset
|
313 |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
314 (when (eq major-mode 'help-mode) |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
315 ;; View mode's read-only status of existing *Help* buffer is lost |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
316 ;; by with-output-to-temp-buffer. |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
317 (toggle-read-only 1) |
55010
734c2a20e3ec
(help-mode-finish): Set help-return-alist first
Richard M. Stallman <rms@gnu.org>
parents:
54781
diff
changeset
|
318 (help-make-xrefs (current-buffer)))) |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
319 |
46437
6987a52d9b98
(view): Always require.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45767
diff
changeset
|
320 ;; Grokking cross-reference information in doc strings and |
6987a52d9b98
(view): Always require.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45767
diff
changeset
|
321 ;; hyperlinking it. |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
322 |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
323 ;; This may have some scope for extension and the same or something |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
324 ;; similar should be done for widget doc strings, which currently use |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
325 ;; another mechanism. |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
326 |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
327 (defvar help-back-label (purecopy "[back]") |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
328 "Label to use by `help-make-xrefs' for the go-back reference.") |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
329 |
81266
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
330 (defvar help-forward-label (purecopy "[forward]") |
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
331 "Label to use by `help-make-xrefs' for the go-forward reference.") |
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
332 |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
333 (defconst help-xref-symbol-regexp |
69587
ddaea7e69d4f
(help-follow-symbol): New function. Essentially identical to the old
Luc Teirlinck <teirllm@auburn.edu>
parents:
68651
diff
changeset
|
334 (purecopy (concat "\\(\\<\\(\\(variable\\|option\\)\\|" ; Link to var |
71522
d530d0a35e81
(help-xref-symbol-regexp): Add property as a keyword for ignoring links.
Nick Roberts <nickrob@snap.net.nz>
parents:
70326
diff
changeset
|
335 "\\(function\\|command\\)\\|" ; Link to function |
d530d0a35e81
(help-xref-symbol-regexp): Add property as a keyword for ignoring links.
Nick Roberts <nickrob@snap.net.nz>
parents:
70326
diff
changeset
|
336 "\\(face\\)\\|" ; Link to face |
d530d0a35e81
(help-xref-symbol-regexp): Add property as a keyword for ignoring links.
Nick Roberts <nickrob@snap.net.nz>
parents:
70326
diff
changeset
|
337 "\\(symbol\\|program\\|property\\)\\|" ; Don't link |
52876
64833a41c107
(help-xref-symbol-regexp): Treat newlines as whitespace.
Luc Teirlinck <teirllm@auburn.edu>
parents:
52401
diff
changeset
|
338 "\\(source \\(?:code \\)?\\(?:of\\|for\\)\\)\\)" |
64833a41c107
(help-xref-symbol-regexp): Treat newlines as whitespace.
Luc Teirlinck <teirllm@auburn.edu>
parents:
52401
diff
changeset
|
339 "[ \t\n]+\\)?" |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
340 ;; Note starting with word-syntax character: |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
341 "`\\(\\sw\\(\\sw\\|\\s_\\)+\\)'")) |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
342 "Regexp matching doc string references to symbols. |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
343 |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
344 The words preceding the quoted symbol can be used in doc strings to |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
345 distinguish references to variables, functions and symbols.") |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
346 |
46437
6987a52d9b98
(view): Always require.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45767
diff
changeset
|
347 (defvar help-xref-mule-regexp nil |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
348 "Regexp matching doc string references to MULE-related keywords. |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
349 |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
350 It is usually nil, and is temporarily bound to an appropriate regexp |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
351 when help commands related to multilingual environment (e.g., |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
352 `describe-coding-system') are invoked.") |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
353 |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
354 |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
355 (defconst help-xref-info-regexp |
53455
0e3e62b0f4f2
(help-xref-info-regexp): Make hyperlinks to Info documentation if the
Luc Teirlinck <teirllm@auburn.edu>
parents:
52885
diff
changeset
|
356 (purecopy "\\<[Ii]nfo[ \t\n]+\\(node\\|anchor\\)[ \t\n]+`\\([^']+\\)'") |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
357 "Regexp matching doc string references to an Info node.") |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
358 |
66513
bfd70a868157
(help-url): New button type. Calls browse-url.
Bill Wohler <wohler@newt.com>
parents:
64762
diff
changeset
|
359 (defconst help-xref-url-regexp |
bfd70a868157
(help-url): New button type. Calls browse-url.
Bill Wohler <wohler@newt.com>
parents:
64762
diff
changeset
|
360 (purecopy "\\<[Uu][Rr][Ll][ \t\n]+`\\([^']+\\)'") |
bfd70a868157
(help-url): New button type. Calls browse-url.
Bill Wohler <wohler@newt.com>
parents:
64762
diff
changeset
|
361 "Regexp matching doc string references to a URL.") |
bfd70a868157
(help-url): New button type. Calls browse-url.
Bill Wohler <wohler@newt.com>
parents:
64762
diff
changeset
|
362 |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
363 ;;;###autoload |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
364 (defun help-setup-xref (item interactive-p) |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
365 "Invoked from commands using the \"*Help*\" buffer to install some xref info. |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
366 |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
367 ITEM is a (FUNCTION . ARGS) pair appropriate for recreating the help |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
368 buffer after following a reference. INTERACTIVE-P is non-nil if the |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
369 calling command was invoked interactively. In this case the stack of |
39787
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
370 items for help buffer \"back\" buttons is cleared. |
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
371 |
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
372 This should be called very early, before the output buffer is cleared, |
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
373 because we want to record the \"previous\" position of point so we can |
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
374 restore it properly when going back." |
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
375 (with-current-buffer (help-buffer) |
46437
6987a52d9b98
(view): Always require.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45767
diff
changeset
|
376 (when help-xref-stack-item |
81266
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
377 (push (cons (point) help-xref-stack-item) help-xref-stack) |
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
378 (setq help-xref-forward-stack nil)) |
46437
6987a52d9b98
(view): Always require.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45767
diff
changeset
|
379 (when interactive-p |
6987a52d9b98
(view): Always require.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45767
diff
changeset
|
380 (let ((tail (nthcdr 10 help-xref-stack))) |
6987a52d9b98
(view): Always require.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45767
diff
changeset
|
381 ;; Truncate the stack. |
6987a52d9b98
(view): Always require.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45767
diff
changeset
|
382 (if tail (setcdr tail nil)))) |
39787
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
383 (setq help-xref-stack-item item))) |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
384 |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
385 (defvar help-xref-following nil |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
386 "Non-nil when following a help cross-reference.") |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
387 |
86006
4077065d3026
(help-mode): Set view-exit-action to bury the
Martin Rudalics <rudalics@gmx.at>
parents:
82334
diff
changeset
|
388 ;;;###autoload |
39787
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
389 (defun help-buffer () |
102785 | 390 "Return the name of a buffer for inserting help. |
391 If `help-xref-following' is non-nil, this is the name of the | |
392 current buffer. | |
393 Otherwise, it is *Help*; if no buffer with that name currently | |
394 exists, it is created." | |
39787
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
395 (buffer-name ;for with-output-to-temp-buffer |
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
396 (if help-xref-following |
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
397 (current-buffer) |
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
398 (get-buffer-create "*Help*")))) |
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
399 |
46437
6987a52d9b98
(view): Always require.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45767
diff
changeset
|
400 (defvar help-xref-override-view-map |
6987a52d9b98
(view): Always require.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45767
diff
changeset
|
401 (let ((map (make-sparse-keymap))) |
6987a52d9b98
(view): Always require.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45767
diff
changeset
|
402 (set-keymap-parent map view-mode-map) |
6987a52d9b98
(view): Always require.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45767
diff
changeset
|
403 (define-key map "\r" nil) |
6987a52d9b98
(view): Always require.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45767
diff
changeset
|
404 map) |
6987a52d9b98
(view): Always require.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45767
diff
changeset
|
405 "Replacement keymap for `view-mode' in help buffers.") |
6987a52d9b98
(view): Always require.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45767
diff
changeset
|
406 |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
407 ;;;###autoload |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
408 (defun help-make-xrefs (&optional buffer) |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
409 "Parse and hyperlink documentation cross-references in the given BUFFER. |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
410 |
45763
6499a200d5d5
(help-mode): Don't set `font-lock-defaults'.
Colin Walters <walters@gnu.org>
parents:
42680
diff
changeset
|
411 Find cross-reference information in a buffer and activate such cross |
6499a200d5d5
(help-mode): Don't set `font-lock-defaults'.
Colin Walters <walters@gnu.org>
parents:
42680
diff
changeset
|
412 references for selection with `help-follow'. Cross-references have |
6499a200d5d5
(help-mode): Don't set `font-lock-defaults'.
Colin Walters <walters@gnu.org>
parents:
42680
diff
changeset
|
413 the canonical form `...' and the type of reference may be |
6499a200d5d5
(help-mode): Don't set `font-lock-defaults'.
Colin Walters <walters@gnu.org>
parents:
42680
diff
changeset
|
414 disambiguated by the preceding word(s) used in |
52876
64833a41c107
(help-xref-symbol-regexp): Treat newlines as whitespace.
Luc Teirlinck <teirllm@auburn.edu>
parents:
52401
diff
changeset
|
415 `help-xref-symbol-regexp'. Faces only get cross-referenced if |
64833a41c107
(help-xref-symbol-regexp): Treat newlines as whitespace.
Luc Teirlinck <teirllm@auburn.edu>
parents:
52401
diff
changeset
|
416 preceded or followed by the word `face'. Variables without |
64833a41c107
(help-xref-symbol-regexp): Treat newlines as whitespace.
Luc Teirlinck <teirllm@auburn.edu>
parents:
52401
diff
changeset
|
417 variable documentation do not get cross-referenced, unless |
52878
80f69b7f19c1
(help-make-xrefs): Slight correction to previous change.
Luc Teirlinck <teirllm@auburn.edu>
parents:
52876
diff
changeset
|
418 preceded by the word `variable' or `option'. |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
419 |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
420 If the variable `help-xref-mule-regexp' is non-nil, find also |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
421 cross-reference information related to multilingual environment |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
422 \(e.g., coding-systems). This variable is also used to disambiguate |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
423 the type of reference as the same way as `help-xref-symbol-regexp'. |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
424 |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
425 A special reference `back' is made to return back through a stack of |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
426 help buffers. Variable `help-back-label' specifies the text for |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
427 that." |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
428 (interactive "b") |
106021
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
429 (with-current-buffer (or buffer (current-buffer)) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
430 (save-excursion |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
431 (goto-char (point-min)) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
432 ;; Skip the header-type info, though it might be useful to parse |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
433 ;; it at some stage (e.g. "function in `library'"). |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
434 (forward-paragraph) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
435 (let ((old-modified (buffer-modified-p))) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
436 (let ((stab (syntax-table)) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
437 (case-fold-search t) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
438 (inhibit-read-only t)) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
439 (set-syntax-table emacs-lisp-mode-syntax-table) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
440 ;; The following should probably be abstracted out. |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
441 (unwind-protect |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
442 (progn |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
443 ;; Info references |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
444 (save-excursion |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
445 (while (re-search-forward help-xref-info-regexp nil t) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
446 (let ((data (match-string 2))) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
447 (save-match-data |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
448 (unless (string-match "^([^)]+)" data) |
108725
57f3f40827c1
* help-mode.el (help-make-xrefs): For Info node links turn
Juri Linkov <juri@jurta.org>
parents:
106815
diff
changeset
|
449 (setq data (concat "(emacs)" data))) |
57f3f40827c1
* help-mode.el (help-make-xrefs): For Info node links turn
Juri Linkov <juri@jurta.org>
parents:
106815
diff
changeset
|
450 (setq data ;; possible newlines if para filled |
57f3f40827c1
* help-mode.el (help-make-xrefs): For Info node links turn
Juri Linkov <juri@jurta.org>
parents:
106815
diff
changeset
|
451 (replace-regexp-in-string "[ \t\n]+" " " data t t))) |
106021
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
452 (help-xref-button 2 'help-info data)))) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
453 ;; URLs |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
454 (save-excursion |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
455 (while (re-search-forward help-xref-url-regexp nil t) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
456 (let ((data (match-string 1))) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
457 (help-xref-button 1 'help-url data)))) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
458 ;; Mule related keywords. Do this before trying |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
459 ;; `help-xref-symbol-regexp' because some of Mule |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
460 ;; keywords have variable or function definitions. |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
461 (if help-xref-mule-regexp |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
462 (save-excursion |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
463 (while (re-search-forward help-xref-mule-regexp nil t) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
464 (let* ((data (match-string 7)) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
465 (sym (intern-soft data))) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
466 (cond |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
467 ((match-string 3) ; coding system |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
468 (and sym (coding-system-p sym) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
469 (help-xref-button 6 'help-coding-system sym))) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
470 ((match-string 4) ; input method |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
471 (and (assoc data input-method-alist) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
472 (help-xref-button 7 'help-input-method data))) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
473 ((or (match-string 5) (match-string 6)) ; charset |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
474 (and sym (charsetp sym) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
475 (help-xref-button 7 'help-character-set sym))) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
476 ((assoc data input-method-alist) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
477 (help-xref-button 7 'help-character-set data)) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
478 ((and sym (coding-system-p sym)) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
479 (help-xref-button 7 'help-coding-system sym)) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
480 ((and sym (charsetp sym)) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
481 (help-xref-button 7 'help-character-set sym))))))) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
482 ;; Quoted symbols |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
483 (save-excursion |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
484 (while (re-search-forward help-xref-symbol-regexp nil t) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
485 (let* ((data (match-string 8)) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
486 (sym (intern-soft data))) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
487 (if sym |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
488 (cond |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
489 ((match-string 3) ; `variable' &c |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
490 (and (or (boundp sym) ; `variable' doesn't ensure |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
491 ; it's actually bound |
106021
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
492 (get sym 'variable-documentation)) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
493 (help-xref-button 8 'help-variable sym))) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
494 ((match-string 4) ; `function' &c |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
495 (and (fboundp sym) ; similarly |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
496 (help-xref-button 8 'help-function sym))) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
497 ((match-string 5) ; `face' |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
498 (and (facep sym) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
499 (help-xref-button 8 'help-face sym))) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
500 ((match-string 6)) ; nothing for `symbol' |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
501 ((match-string 7) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
502 ;; this used: |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
503 ;; #'(lambda (arg) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
504 ;; (let ((location |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
505 ;; (find-function-noselect arg))) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
506 ;; (pop-to-buffer (car location)) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
507 ;; (goto-char (cdr location)))) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
508 (help-xref-button 8 'help-function-def sym)) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
509 ((and |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
510 (facep sym) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
511 (save-match-data (looking-at "[ \t\n]+face\\W"))) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
512 (help-xref-button 8 'help-face sym)) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
513 ((and (or (boundp sym) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
514 (get sym 'variable-documentation)) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
515 (fboundp sym)) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
516 ;; We can't intuit whether to use the |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
517 ;; variable or function doc -- supply both. |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
518 (help-xref-button 8 'help-symbol sym)) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
519 ((and |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
520 (or (boundp sym) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
521 (get sym 'variable-documentation)) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
522 (or |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
523 (documentation-property |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
524 sym 'variable-documentation) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
525 (condition-case nil |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
526 (documentation-property |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
527 (indirect-variable sym) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
528 'variable-documentation) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
529 (cyclic-variable-indirection nil)))) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
530 (help-xref-button 8 'help-variable sym)) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
531 ((fboundp sym) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
532 (help-xref-button 8 'help-function sym))))))) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
533 ;; An obvious case of a key substitution: |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
534 (save-excursion |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
535 (while (re-search-forward |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
536 ;; Assume command name is only word and symbol |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
537 ;; characters to get things like `use M-x foo->bar'. |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
538 ;; Command required to end with word constituent |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
539 ;; to avoid `.' at end of a sentence. |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
540 "\\<M-x\\s-+\\(\\sw\\(\\sw\\|\\s_\\)*\\sw\\)" nil t) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
541 (let ((sym (intern-soft (match-string 1)))) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
542 (if (fboundp sym) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
543 (help-xref-button 1 'help-function sym))))) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
544 ;; Look for commands in whole keymap substitutions: |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
545 (save-excursion |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
546 ;; Make sure to find the first keymap. |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
547 (goto-char (point-min)) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
548 ;; Find a header and the column at which the command |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
549 ;; name will be found. |
50684
21af30889a41
(help-make-xrefs): Clean up the loop that scans
Richard M. Stallman <rms@gnu.org>
parents:
49690
diff
changeset
|
550 |
106021
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
551 ;; If the keymap substitution isn't the last thing in |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
552 ;; the doc string, and if there is anything on the same |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
553 ;; line after it, this code won't recognize the end of it. |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
554 (while (re-search-forward "^key +binding\n\\(-+ +\\)-+\n\n" |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
555 nil t) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
556 (let ((col (- (match-end 1) (match-beginning 1)))) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
557 (while |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
558 (and (not (eobp)) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
559 ;; Stop at a pair of blank lines. |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
560 (not (looking-at "\n\\s-*\n"))) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
561 ;; Skip a single blank line. |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
562 (and (eolp) (forward-line)) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
563 (end-of-line) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
564 (skip-chars-backward "^ \t\n") |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
565 (if (and (>= (current-column) col) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
566 (looking-at "\\(\\sw\\|\\s_\\)+$")) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
567 (let ((sym (intern-soft (match-string 0)))) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
568 (if (fboundp sym) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
569 (help-xref-button 0 'help-function sym)))) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
570 (forward-line)))))) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
571 (set-syntax-table stab)) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
572 ;; Delete extraneous newlines at the end of the docstring |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
573 (goto-char (point-max)) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
574 (while (and (not (bobp)) (bolp)) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
575 (delete-char -1)) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
576 (insert "\n") |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
577 (when (or help-xref-stack help-xref-forward-stack) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
578 (insert "\n")) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
579 ;; Make a back-reference in this buffer if appropriate. |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
580 (when help-xref-stack |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
581 (help-insert-xref-button help-back-label 'help-back |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
582 (current-buffer))) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
583 ;; Make a forward-reference in this buffer if appropriate. |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
584 (when help-xref-forward-stack |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
585 (when help-xref-stack |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
586 (insert "\t")) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
587 (help-insert-xref-button help-forward-label 'help-forward |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
588 (current-buffer))) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
589 (when (or help-xref-stack help-xref-forward-stack) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
590 (insert "\n"))) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
591 ;; View mode steals RET from us. |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
592 (set (make-local-variable 'minor-mode-overriding-map-alist) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
593 (list (cons 'view-mode help-xref-override-view-map))) |
1db0581a94d9
(help-make-xrefs): Undo the last revert, and replace it with a real fix.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106010
diff
changeset
|
594 (set-buffer-modified-p old-modified))))) |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
595 |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
596 ;;;###autoload |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
597 (defun help-xref-button (match-number type &rest args) |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
598 "Make a hyperlink for cross-reference text previously matched. |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
599 MATCH-NUMBER is the subexpression of interest in the last matched |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
600 regexp. TYPE is the type of button to use. Any remaining arguments are |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
601 passed to the button's help-function when it is invoked. |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
602 See `help-make-xrefs'." |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
603 ;; Don't mung properties we've added specially in some instances. |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
604 (unless (button-at (match-beginning match-number)) |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
605 (make-text-button (match-beginning match-number) |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
606 (match-end match-number) |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
607 'type type 'help-args args))) |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
608 |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
609 ;;;###autoload |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
610 (defun help-insert-xref-button (string type &rest args) |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
611 "Insert STRING and make a hyperlink from cross-reference text on it. |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
612 TYPE is the type of button to use. Any remaining arguments are passed |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
613 to the button's help-function when it is invoked. |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
614 See `help-make-xrefs'." |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
615 (unless (button-at (point)) |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
616 (insert-text-button string 'type type 'help-args args))) |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
617 |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
618 ;;;###autoload |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
619 (defun help-xref-on-pp (from to) |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
620 "Add xrefs for symbols in `pp's output between FROM and TO." |
49690
e2f33e589249
(help-xref-on-pp): Only add xref if the text is less than 5K.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46437
diff
changeset
|
621 (if (> (- to from) 5000) nil |
e2f33e589249
(help-xref-on-pp): Only add xref if the text is less than 5K.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46437
diff
changeset
|
622 (with-syntax-table emacs-lisp-mode-syntax-table |
e2f33e589249
(help-xref-on-pp): Only add xref if the text is less than 5K.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46437
diff
changeset
|
623 (save-excursion |
e2f33e589249
(help-xref-on-pp): Only add xref if the text is less than 5K.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46437
diff
changeset
|
624 (save-restriction |
e2f33e589249
(help-xref-on-pp): Only add xref if the text is less than 5K.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46437
diff
changeset
|
625 (narrow-to-region from to) |
e2f33e589249
(help-xref-on-pp): Only add xref if the text is less than 5K.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46437
diff
changeset
|
626 (goto-char (point-min)) |
e2f33e589249
(help-xref-on-pp): Only add xref if the text is less than 5K.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46437
diff
changeset
|
627 (condition-case nil |
e2f33e589249
(help-xref-on-pp): Only add xref if the text is less than 5K.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46437
diff
changeset
|
628 (while (not (eobp)) |
e2f33e589249
(help-xref-on-pp): Only add xref if the text is less than 5K.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46437
diff
changeset
|
629 (cond |
e2f33e589249
(help-xref-on-pp): Only add xref if the text is less than 5K.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46437
diff
changeset
|
630 ((looking-at "\"") (forward-sexp 1)) |
e2f33e589249
(help-xref-on-pp): Only add xref if the text is less than 5K.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46437
diff
changeset
|
631 ((looking-at "#<") (search-forward ">" nil 'move)) |
e2f33e589249
(help-xref-on-pp): Only add xref if the text is less than 5K.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46437
diff
changeset
|
632 ((looking-at "\\(\\(\\sw\\|\\s_\\)+\\)") |
e2f33e589249
(help-xref-on-pp): Only add xref if the text is less than 5K.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46437
diff
changeset
|
633 (let* ((sym (intern-soft (match-string 1))) |
e2f33e589249
(help-xref-on-pp): Only add xref if the text is less than 5K.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46437
diff
changeset
|
634 (type (cond ((fboundp sym) 'help-function) |
e2f33e589249
(help-xref-on-pp): Only add xref if the text is less than 5K.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46437
diff
changeset
|
635 ((or (memq sym '(t nil)) |
e2f33e589249
(help-xref-on-pp): Only add xref if the text is less than 5K.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46437
diff
changeset
|
636 (keywordp sym)) |
e2f33e589249
(help-xref-on-pp): Only add xref if the text is less than 5K.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46437
diff
changeset
|
637 nil) |
66874
2f22c8af038b
(help-make-xrefs, help-xref-on-pp, help-xref-interned, help-follow):
Luc Teirlinck <teirllm@auburn.edu>
parents:
66513
diff
changeset
|
638 ((and sym |
2f22c8af038b
(help-make-xrefs, help-xref-on-pp, help-xref-interned, help-follow):
Luc Teirlinck <teirllm@auburn.edu>
parents:
66513
diff
changeset
|
639 (or (boundp sym) |
2f22c8af038b
(help-make-xrefs, help-xref-on-pp, help-xref-interned, help-follow):
Luc Teirlinck <teirllm@auburn.edu>
parents:
66513
diff
changeset
|
640 (get sym |
2f22c8af038b
(help-make-xrefs, help-xref-on-pp, help-xref-interned, help-follow):
Luc Teirlinck <teirllm@auburn.edu>
parents:
66513
diff
changeset
|
641 'variable-documentation))) |
49690
e2f33e589249
(help-xref-on-pp): Only add xref if the text is less than 5K.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46437
diff
changeset
|
642 'help-variable)))) |
e2f33e589249
(help-xref-on-pp): Only add xref if the text is less than 5K.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46437
diff
changeset
|
643 (when type (help-xref-button 1 type sym))) |
e2f33e589249
(help-xref-on-pp): Only add xref if the text is less than 5K.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46437
diff
changeset
|
644 (goto-char (match-end 1))) |
e2f33e589249
(help-xref-on-pp): Only add xref if the text is less than 5K.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46437
diff
changeset
|
645 (t (forward-char 1)))) |
e2f33e589249
(help-xref-on-pp): Only add xref if the text is less than 5K.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46437
diff
changeset
|
646 (error nil))))))) |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
647 |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
648 |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
649 ;; Additional functions for (re-)creating types of help buffers. |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
650 (defun help-xref-interned (symbol) |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
651 "Follow a hyperlink which appeared to be an arbitrary interned SYMBOL. |
39787
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
652 Both variable, function and face documentation are extracted into a single |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
653 help buffer." |
39787
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
654 (with-current-buffer (help-buffer) |
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
655 ;; Push the previous item on the stack before clobbering the output buffer. |
64306
c7d6013c38b6
(help-xref-interned): Undo last mistaken change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64305
diff
changeset
|
656 (help-setup-xref nil nil) |
39787
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
657 (let ((facedoc (when (facep symbol) |
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
658 ;; Don't record the current entry in the stack. |
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
659 (setq help-xref-stack-item nil) |
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
660 (describe-face symbol))) |
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
661 (fdoc (when (fboundp symbol) |
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
662 ;; Don't record the current entry in the stack. |
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
663 (setq help-xref-stack-item nil) |
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
664 (describe-function symbol))) |
66874
2f22c8af038b
(help-make-xrefs, help-xref-on-pp, help-xref-interned, help-follow):
Luc Teirlinck <teirllm@auburn.edu>
parents:
66513
diff
changeset
|
665 (sdoc (when (or (boundp symbol) |
2f22c8af038b
(help-make-xrefs, help-xref-on-pp, help-xref-interned, help-follow):
Luc Teirlinck <teirllm@auburn.edu>
parents:
66513
diff
changeset
|
666 (get symbol 'variable-documentation)) |
39787
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
667 ;; Don't record the current entry in the stack. |
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
668 (setq help-xref-stack-item nil) |
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
669 (describe-variable symbol)))) |
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
670 (cond |
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
671 (sdoc |
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
672 ;; We now have a help buffer on the variable. |
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
673 ;; Insert the function and face text before it. |
42593 | 674 (when (or fdoc facedoc) |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
675 (goto-char (point-min)) |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
676 (let ((inhibit-read-only t)) |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
677 (when fdoc |
39787
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
678 (insert fdoc "\n\n") |
42593 | 679 (when facedoc |
680 (insert (make-string 30 ?-) "\n\n" (symbol-name symbol) | |
39787
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
681 " is also a " "face." "\n\n"))) |
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
682 (when facedoc |
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
683 (insert facedoc "\n\n")) |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
684 (insert (make-string 30 ?-) "\n\n" (symbol-name symbol) |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
685 " is also a " "variable." "\n\n")) |
39787
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
686 ;; Don't record the `describe-variable' item in the stack. |
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
687 (setq help-xref-stack-item nil) |
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
688 (help-setup-xref (list #'help-xref-interned symbol) nil))) |
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
689 (fdoc |
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
690 ;; We now have a help buffer on the function. |
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
691 ;; Insert face text before it. |
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
692 (when facedoc |
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
693 (goto-char (point-max)) |
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
694 (let ((inhibit-read-only t)) |
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
695 (insert "\n\n" (make-string 30 ?-) "\n\n" (symbol-name symbol) |
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
696 " is also a " "face." "\n\n" facedoc)) |
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
697 ;; Don't record the `describe-function' item in the stack. |
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
698 (setq help-xref-stack-item nil) |
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
699 (help-setup-xref (list #'help-xref-interned symbol) nil))))))) |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
700 |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
701 |
46437
6987a52d9b98
(view): Always require.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45767
diff
changeset
|
702 ;; Navigation/hyperlinking with xrefs |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
703 |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
704 (defun help-xref-go-back (buffer) |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
705 "From BUFFER, go back to previous help buffer text using `help-xref-stack'." |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
706 (let (item position method args) |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
707 (with-current-buffer buffer |
81266
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
708 (push (cons (point) help-xref-stack-item) help-xref-forward-stack) |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
709 (when help-xref-stack |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
710 (setq item (pop help-xref-stack) |
39787
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
711 ;; Clear the current item so that it won't get pushed |
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
712 ;; by the function we're about to call. TODO: We could also |
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
713 ;; push it onto a "forward" stack and add a `forw' button. |
b44e34df3fa2
(help-buffer): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39727
diff
changeset
|
714 help-xref-stack-item nil |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
715 position (car item) |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
716 method (cadr item) |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
717 args (cddr item)))) |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
718 (apply method args) |
42680
3814cb15269e
(help-xref-go-back): Restore POSITION in proper buffer and proper window.
Richard M. Stallman <rms@gnu.org>
parents:
42593
diff
changeset
|
719 (with-current-buffer buffer |
3814cb15269e
(help-xref-go-back): Restore POSITION in proper buffer and proper window.
Richard M. Stallman <rms@gnu.org>
parents:
42593
diff
changeset
|
720 (if (get-buffer-window buffer) |
3814cb15269e
(help-xref-go-back): Restore POSITION in proper buffer and proper window.
Richard M. Stallman <rms@gnu.org>
parents:
42593
diff
changeset
|
721 (set-window-point (get-buffer-window buffer) position) |
3814cb15269e
(help-xref-go-back): Restore POSITION in proper buffer and proper window.
Richard M. Stallman <rms@gnu.org>
parents:
42593
diff
changeset
|
722 (goto-char position))))) |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
723 |
81266
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
724 (defun help-xref-go-forward (buffer) |
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
725 "From BUFFER, go forward to next help buffer." |
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
726 (let (item position method args) |
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
727 (with-current-buffer buffer |
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
728 (push (cons (point) help-xref-stack-item) help-xref-stack) |
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
729 (when help-xref-forward-stack |
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
730 (setq item (pop help-xref-forward-stack) |
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
731 ;; Clear the current item so that it won't get pushed |
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
732 ;; by the function we're about to call. TODO: We could also |
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
733 ;; push it onto a "forward" stack and add a `forw' button. |
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
734 help-xref-stack-item nil |
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
735 position (car item) |
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
736 method (cadr item) |
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
737 args (cddr item)))) |
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
738 (apply method args) |
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
739 (with-current-buffer buffer |
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
740 (if (get-buffer-window buffer) |
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
741 (set-window-point (get-buffer-window buffer) position) |
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
742 (goto-char position))))) |
86006
4077065d3026
(help-mode): Set view-exit-action to bury the
Martin Rudalics <rudalics@gmx.at>
parents:
82334
diff
changeset
|
743 |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
744 (defun help-go-back () |
55679
839ccd7aaee0
(help-go-back): Don't depend on position of back button.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55233
diff
changeset
|
745 "Go back to previous topic in this help buffer." |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
746 (interactive) |
55679
839ccd7aaee0
(help-go-back): Don't depend on position of back button.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55233
diff
changeset
|
747 (if help-xref-stack |
839ccd7aaee0
(help-go-back): Don't depend on position of back button.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55233
diff
changeset
|
748 (help-xref-go-back (current-buffer)) |
56579
6a5acd0aae39
(help-go-back): Delete period from end of error message.
John Paul Wallington <jpw@pobox.com>
parents:
55679
diff
changeset
|
749 (error "No previous help buffer"))) |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
750 |
81266
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
751 (defun help-go-forward () |
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
752 "Go back to next topic in this help buffer." |
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
753 (interactive) |
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
754 (if help-xref-forward-stack |
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
755 (help-xref-go-forward (current-buffer)) |
3b6f2f7b68f2
(help-xref-forward-stack)
Nick Roberts <nickrob@snap.net.nz>
parents:
75347
diff
changeset
|
756 (error "No next help buffer"))) |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
757 |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
758 (defun help-do-xref (pos function args) |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
759 "Call the help cross-reference function FUNCTION with args ARGS. |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
760 Things are set up properly so that the resulting help-buffer has |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
761 a proper [back] button." |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
762 ;; There is a reference at point. Follow it. |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
763 (let ((help-xref-following t)) |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
764 (apply function args))) |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
765 |
69587
ddaea7e69d4f
(help-follow-symbol): New function. Essentially identical to the old
Luc Teirlinck <teirllm@auburn.edu>
parents:
68651
diff
changeset
|
766 ;; The doc string is meant to explain what buttons do. |
ddaea7e69d4f
(help-follow-symbol): New function. Essentially identical to the old
Luc Teirlinck <teirllm@auburn.edu>
parents:
68651
diff
changeset
|
767 (defun help-follow-mouse () |
ddaea7e69d4f
(help-follow-symbol): New function. Essentially identical to the old
Luc Teirlinck <teirllm@auburn.edu>
parents:
68651
diff
changeset
|
768 "Follow the cross-reference that you click on." |
ddaea7e69d4f
(help-follow-symbol): New function. Essentially identical to the old
Luc Teirlinck <teirllm@auburn.edu>
parents:
68651
diff
changeset
|
769 (interactive) |
ddaea7e69d4f
(help-follow-symbol): New function. Essentially identical to the old
Luc Teirlinck <teirllm@auburn.edu>
parents:
68651
diff
changeset
|
770 (error "No cross-reference here")) |
ddaea7e69d4f
(help-follow-symbol): New function. Essentially identical to the old
Luc Teirlinck <teirllm@auburn.edu>
parents:
68651
diff
changeset
|
771 |
ddaea7e69d4f
(help-follow-symbol): New function. Essentially identical to the old
Luc Teirlinck <teirllm@auburn.edu>
parents:
68651
diff
changeset
|
772 ;; The doc string is meant to explain what buttons do. |
ddaea7e69d4f
(help-follow-symbol): New function. Essentially identical to the old
Luc Teirlinck <teirllm@auburn.edu>
parents:
68651
diff
changeset
|
773 (defun help-follow () |
ddaea7e69d4f
(help-follow-symbol): New function. Essentially identical to the old
Luc Teirlinck <teirllm@auburn.edu>
parents:
68651
diff
changeset
|
774 "Follow cross-reference at point. |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
775 |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
776 For the cross-reference format, see `help-make-xrefs'." |
69587
ddaea7e69d4f
(help-follow-symbol): New function. Essentially identical to the old
Luc Teirlinck <teirllm@auburn.edu>
parents:
68651
diff
changeset
|
777 (interactive) |
ddaea7e69d4f
(help-follow-symbol): New function. Essentially identical to the old
Luc Teirlinck <teirllm@auburn.edu>
parents:
68651
diff
changeset
|
778 (error "No cross-reference here")) |
ddaea7e69d4f
(help-follow-symbol): New function. Essentially identical to the old
Luc Teirlinck <teirllm@auburn.edu>
parents:
68651
diff
changeset
|
779 |
ddaea7e69d4f
(help-follow-symbol): New function. Essentially identical to the old
Luc Teirlinck <teirllm@auburn.edu>
parents:
68651
diff
changeset
|
780 (defun help-follow-symbol (&optional pos) |
ddaea7e69d4f
(help-follow-symbol): New function. Essentially identical to the old
Luc Teirlinck <teirllm@auburn.edu>
parents:
68651
diff
changeset
|
781 "In help buffer, show docs for symbol at POS, defaulting to point. |
ddaea7e69d4f
(help-follow-symbol): New function. Essentially identical to the old
Luc Teirlinck <teirllm@auburn.edu>
parents:
68651
diff
changeset
|
782 Show all docs for that symbol as either a variable, function or face." |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
783 (interactive "d") |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
784 (unless pos |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
785 (setq pos (point))) |
69587
ddaea7e69d4f
(help-follow-symbol): New function. Essentially identical to the old
Luc Teirlinck <teirllm@auburn.edu>
parents:
68651
diff
changeset
|
786 ;; check if the symbol under point is a function, variable or face |
ddaea7e69d4f
(help-follow-symbol): New function. Essentially identical to the old
Luc Teirlinck <teirllm@auburn.edu>
parents:
68651
diff
changeset
|
787 (let ((sym |
ddaea7e69d4f
(help-follow-symbol): New function. Essentially identical to the old
Luc Teirlinck <teirllm@auburn.edu>
parents:
68651
diff
changeset
|
788 (intern |
ddaea7e69d4f
(help-follow-symbol): New function. Essentially identical to the old
Luc Teirlinck <teirllm@auburn.edu>
parents:
68651
diff
changeset
|
789 (save-excursion |
ddaea7e69d4f
(help-follow-symbol): New function. Essentially identical to the old
Luc Teirlinck <teirllm@auburn.edu>
parents:
68651
diff
changeset
|
790 (goto-char pos) (skip-syntax-backward "w_") |
ddaea7e69d4f
(help-follow-symbol): New function. Essentially identical to the old
Luc Teirlinck <teirllm@auburn.edu>
parents:
68651
diff
changeset
|
791 (buffer-substring (point) |
ddaea7e69d4f
(help-follow-symbol): New function. Essentially identical to the old
Luc Teirlinck <teirllm@auburn.edu>
parents:
68651
diff
changeset
|
792 (progn (skip-syntax-forward "w_") |
ddaea7e69d4f
(help-follow-symbol): New function. Essentially identical to the old
Luc Teirlinck <teirllm@auburn.edu>
parents:
68651
diff
changeset
|
793 (point))))))) |
ddaea7e69d4f
(help-follow-symbol): New function. Essentially identical to the old
Luc Teirlinck <teirllm@auburn.edu>
parents:
68651
diff
changeset
|
794 (when (or (boundp sym) |
ddaea7e69d4f
(help-follow-symbol): New function. Essentially identical to the old
Luc Teirlinck <teirllm@auburn.edu>
parents:
68651
diff
changeset
|
795 (get sym 'variable-documentation) |
ddaea7e69d4f
(help-follow-symbol): New function. Essentially identical to the old
Luc Teirlinck <teirllm@auburn.edu>
parents:
68651
diff
changeset
|
796 (fboundp sym) (facep sym)) |
ddaea7e69d4f
(help-follow-symbol): New function. Essentially identical to the old
Luc Teirlinck <teirllm@auburn.edu>
parents:
68651
diff
changeset
|
797 (help-do-xref pos #'help-xref-interned (list sym))))) |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
798 |
109021
35894ae393bb
Fix revert-buffer functionality of Help mode and Info.
Juri Linkov <juri@jurta.org>
parents:
108725
diff
changeset
|
799 (defun help-mode-revert-buffer (ignore-auto noconfirm) |
35894ae393bb
Fix revert-buffer functionality of Help mode and Info.
Juri Linkov <juri@jurta.org>
parents:
108725
diff
changeset
|
800 (when (or noconfirm (yes-or-no-p "Revert help buffer? ")) |
35894ae393bb
Fix revert-buffer functionality of Help mode and Info.
Juri Linkov <juri@jurta.org>
parents:
108725
diff
changeset
|
801 (let ((pos (point)) |
35894ae393bb
Fix revert-buffer functionality of Help mode and Info.
Juri Linkov <juri@jurta.org>
parents:
108725
diff
changeset
|
802 (item help-xref-stack-item) |
35894ae393bb
Fix revert-buffer functionality of Help mode and Info.
Juri Linkov <juri@jurta.org>
parents:
108725
diff
changeset
|
803 ;; Pretend there is no current item to add to the history. |
35894ae393bb
Fix revert-buffer functionality of Help mode and Info.
Juri Linkov <juri@jurta.org>
parents:
108725
diff
changeset
|
804 (help-xref-stack-item nil) |
35894ae393bb
Fix revert-buffer functionality of Help mode and Info.
Juri Linkov <juri@jurta.org>
parents:
108725
diff
changeset
|
805 ;; Use the current buffer. |
35894ae393bb
Fix revert-buffer functionality of Help mode and Info.
Juri Linkov <juri@jurta.org>
parents:
108725
diff
changeset
|
806 (help-xref-following t)) |
35894ae393bb
Fix revert-buffer functionality of Help mode and Info.
Juri Linkov <juri@jurta.org>
parents:
108725
diff
changeset
|
807 (apply (car item) (cdr item)) |
35894ae393bb
Fix revert-buffer functionality of Help mode and Info.
Juri Linkov <juri@jurta.org>
parents:
108725
diff
changeset
|
808 (goto-char pos)))) |
35894ae393bb
Fix revert-buffer functionality of Help mode and Info.
Juri Linkov <juri@jurta.org>
parents:
108725
diff
changeset
|
809 |
67854
eb33196c14d7
(help-insert-string): New function. Save buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
67697
diff
changeset
|
810 (defun help-insert-string (string) |
eb33196c14d7
(help-insert-string): New function. Save buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
67697
diff
changeset
|
811 "Insert STRING to the help buffer and install xref info for it. |
eb33196c14d7
(help-insert-string): New function. Save buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
67697
diff
changeset
|
812 This function can be used to restore the old contents of the help buffer |
eb33196c14d7
(help-insert-string): New function. Save buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
67697
diff
changeset
|
813 when going back to the previous topic in the xref stack. It is needed |
eb33196c14d7
(help-insert-string): New function. Save buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
67697
diff
changeset
|
814 in case when it is impossible to recompute the old contents of the |
eb33196c14d7
(help-insert-string): New function. Save buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
67697
diff
changeset
|
815 help buffer by other means." |
eb33196c14d7
(help-insert-string): New function. Save buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
67697
diff
changeset
|
816 (setq help-xref-stack-item (list #'help-insert-string string)) |
eb33196c14d7
(help-insert-string): New function. Save buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
67697
diff
changeset
|
817 (with-output-to-temp-buffer (help-buffer) |
eb33196c14d7
(help-insert-string): New function. Save buffer
Nick Roberts <nickrob@snap.net.nz>
parents:
67697
diff
changeset
|
818 (insert string))) |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
819 |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
820 (provide 'help-mode) |
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
821 |
64305
d533a2de8243
(help-xref-interned): Properly setup xref info.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64091
diff
changeset
|
822 ;; arch-tag: 850954ae-3725-4cb4-8e91-0bf6d52d6b0b |
39727
3806fe844742
New file, contents mostly from `help.el'.
Miles Bader <miles@gnu.org>
parents:
diff
changeset
|
823 ;;; help-mode.el ends here |