annotate lisp/packages/hyper-apropos.el @ 185:3d6bfa290dbd r20-3b19

Import from CVS: tag r20-3b19
author cvs
date Mon, 13 Aug 2007 09:55:28 +0200
parents 9ad43877534d
children e45d5e7c476e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; hyper-apropos.el --- Hypertext emacs lisp documentation interface.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;; Copyright (C) 1994, 1995 Tinker Systems and INS Engineering Corp.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;; Copyright (C) 1995 Sun Microsystems.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; Copyright (C) 1996 Ben Wing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;; Maintainer: Jonathan Stigelman <Stig@hackvan.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;; Keywords: lisp, tools, help, docs, matching
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;; This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; XEmacs is free software; you can redistribute it and/or modify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;; the Free Software Foundation; either version 2 of the License, or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;; (at your option) any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; XEmacs is distributed in the hope that it will be useful,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;; GNU General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 ;; along with XEmacs; if not, write to the Free Software
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 ;;; Synched up with: Not in FSF.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 ;;; Commentary:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ;; based upon emacs-apropos.el by Frank C. Guida <fcg@philabs.philips.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 ;; Rather than run apropos and print all the documentation at once,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 ;; I find it easier to view a "table of contents" first, then
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 ;; get the details for symbols as you need them.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 ;; This version of apropos prints two lists of symbols matching the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 ;; given regexp: functions/macros and variables/constants.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 ;; The user can then do the following:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 ;; - add an additional regexp to narrow the search
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 ;; - display documentation for the current symbol
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 ;; - find the tag for the current symbol
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 ;; - show any keybindings if the current symbol is a command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 ;; - invoke functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 ;; - set variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 ;; An additional feature is the ability to search the current tags
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 ;; table, allowing you to interrogate functions not yet loaded (this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 ;; isn't available with the standard package).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 ;; Mouse bindings and menus are provided for XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 ;; additions by Ben Wing <wing@666.com> July 1995:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 ;; added support for function aliases, made programmer's apropos be the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 ;; default, various other hacking.
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
57 ;; Massive changes by Christoph Wedler <wedler@fmi.uni-passau.de>
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
58 ;; Some changes for XEmacs 20.3 by hniksic
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
60 ;; ### The maintainer is supposed to be stig, but I haven't seen him
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
61 ;; around for ages. The real maintainer for the moment is Hrvoje
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
62 ;; Niksic <hniksic@srce.hr>.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
63
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 ;;; Code:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
66 (require 'pp)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
68 (defgroup hyper-apropos nil
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
69 "Hypertext emacs lisp documentation interface."
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
70 :group 'docs
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
71 :group 'lisp
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
72 :group 'tools
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
73 :group 'help
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
74 :group 'matching)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
76 (defcustom hyper-apropos-show-brief-docs t
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
77 "*If non-nil, display some documentation in the \"*Hyper Apropos*\" buffer.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
78 Setting this to nil will speed up searches."
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
79 :type 'boolean
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
80 :group 'hyper-apropos)
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
81 (define-obsolete-variable-alias
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
82 'hypropos-show-brief-docs 'hyper-apropos-show-brief-docs)
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
83 ;; I changed this to true because I think it's more useful this way. --ben
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
84
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
85 (defcustom hyper-apropos-programming-apropos t
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
86 "*If non-nil, list all the functions and variables.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
87 This will cause more output to be generated, and take a longer time.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
88
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
89 Otherwise, only the interactive functions and user variables will be listed."
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
90 :type 'boolean
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
91 :group 'hyper-apropos)
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
92 (define-obsolete-variable-alias
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
93 'hypropos-programming-apropos 'hyper-apropos-programming-apropos)
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
94
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
95 (defcustom hyper-apropos-shrink-window nil
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
96 "*If non-nil, shrink *Hyper Help* buffer if possible."
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
97 :type 'boolean
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
98 :group 'hyper-apropos)
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
99 (define-obsolete-variable-alias
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
100 'hypropos-shrink-window 'hyper-apropos-shrink-window)
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
101
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
102 (defcustom hyper-apropos-prettyprint-long-values t
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
103 "*If non-nil, then try to beautify the printing of very long values."
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
104 :type 'boolean
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
105 :group 'hyper-apropos)
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
106 (define-obsolete-variable-alias
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
107 'hypropos-prettyprint-long-values 'hyper-apropos-prettyprint-long-values)
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
108
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
109 (defgroup hyper-apropos-faces nil
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
110 "Faces defined by hyper-apropos."
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
111 :prefix "hyper-apropos-"
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
112 :group 'faces)
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
113
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
114 (defface hyper-apropos-documentation
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
115 '((((class color) (background light))
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
116 (:foreground "darkred"))
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
117 (((class color) (background dark))
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
118 (:foreground "gray90")))
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
119 "Hyper-apropos documentation."
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
120 :group 'hyper-apropos-faces)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
122 (defface hyper-apropos-hyperlink
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
123 '((((class color) (background light))
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
124 (:foreground "blue4"))
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
125 (((class color) (background dark))
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
126 (:foreground "lightseagreen"))
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
127 (t
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
128 (:bold t)))
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
129 "Hyper-apropos hyperlinks."
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
130 :group 'hyper-apropos-faces)
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
131
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
132 (defface hyper-apropos-major-heading '((t (:bold t)))
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
133 "Hyper-apropos major heading."
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
134 :group 'hyper-apropos-faces)
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
135
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
136 (defface hyper-apropos-section-heading '((t (:bold t :italic t)))
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
137 "Hyper-apropos section heading."
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
138 :group 'hyper-apropos-faces)
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
139
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
140 (defface hyper-apropos-heading '((t (:bold t)))
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
141 "Hyper-apropos heading."
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
142 :group 'hyper-apropos-faces)
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
143
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
144 (defface hyper-apropos-warning '((t (:bold t :foreground "red")))
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
145 "Hyper-apropos warning."
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
146 :group 'hyper-apropos-faces)
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
147
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
148 ;;; Internal variables below this point
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
150 (defvar hyper-apropos-ref-buffer)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
151 (defvar hyper-apropos-prev-wconfig)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
153 (defvar hyper-apropos-help-map
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
154 (let ((map (make-sparse-keymap)))
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
155 (suppress-keymap map)
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
156 (set-keymap-name map 'hyper-apropos-help-map)
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
157 ;; movement
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
158 (define-key map " " 'scroll-up)
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
159 (define-key map "b" 'scroll-down)
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
160 (define-key map [delete] 'scroll-down)
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
161 (define-key map [backspace] 'scroll-down)
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
162 (define-key map "/" 'isearch-forward)
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
163 (define-key map "?" 'isearch-backward)
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
164 ;; follow links
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
165 (define-key map [return] 'hyper-apropos-get-doc)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
166 (define-key map "s" 'hyper-apropos-set-variable)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
167 (define-key map "t" 'hyper-apropos-find-tag)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
168 (define-key map "l" 'hyper-apropos-last-help)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
169 (define-key map "c" 'hyper-apropos-customize-variable)
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 179
diff changeset
170 (define-key map "f" 'hyper-apropos-find-function)
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
171 (define-key map [button2] 'hyper-apropos-mouse-get-doc)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
172 (define-key map [button3] 'hyper-apropos-popup-menu)
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
173 ;; for the totally hardcore...
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
174 (define-key map "D" 'hyper-apropos-disassemble)
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
175 ;; administrativa
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
176 (define-key map "a" 'hyper-apropos)
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
177 (define-key map "n" 'hyper-apropos)
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
178 (define-key map "q" 'hyper-apropos-quit)
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
179 map)
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
180 "Keybindings for the *Hyper Help* buffer and the *Hyper Apropos* buffer")
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
181 (define-obsolete-variable-alias
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
182 'hypropos-help-map 'hyper-apropos-help-map)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
184 (defvar hyper-apropos-map
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
185 (let ((map (make-sparse-keymap)))
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
186 (set-keymap-name map 'hyper-apropos-map)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
187 (set-keymap-parents map (list hyper-apropos-help-map))
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
188 ;; slightly different scrolling...
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
189 (define-key map " " 'hyper-apropos-scroll-up)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
190 (define-key map "b" 'hyper-apropos-scroll-down)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
191 (define-key map [delete] 'hyper-apropos-scroll-down)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
192 (define-key map [backspace] 'hyper-apropos-scroll-down)
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
193 ;; act on the current line...
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
194 (define-key map "w" 'hyper-apropos-where-is)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
195 (define-key map "i" 'hyper-apropos-invoke-fn)
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 179
diff changeset
196 ;; this is already defined in the parent-keymap above, isn't it?
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 179
diff changeset
197 ;; (define-key map "s" 'hyper-apropos-set-variable)
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
198 ;; more administrativa...
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
199 (define-key map "P" 'hyper-apropos-toggle-programming-flag)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
200 (define-key map "k" 'hyper-apropos-add-keyword)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
201 (define-key map "e" 'hyper-apropos-eliminate-keyword)
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
202 map)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 "Keybindings for the *Hyper Apropos* buffer.
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
204 This map inherits from `hyper-apropos-help-map.'")
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
205 (define-obsolete-variable-alias
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
206 'hypropos-map 'hyper-apropos-map)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
208 ;;(defvar hyper-apropos-mousable-keymap
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
209 ;; (let ((map (make-sparse-keymap)))
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
210 ;; (define-key map [button2] 'hyper-apropos-mouse-get-doc)
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
211 ;; map))
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
212
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 (defvar hyper-apropos-mode-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 "*User function run after hyper-apropos mode initialization. Usage:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 \(setq hyper-apropos-mode-hook '(lambda () ... your init forms ...)).")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 ;; ---------------------------------------------------------------------- ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
219 (defconst hyper-apropos-junk-regexp
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
220 "^Apropos\\|^Functions\\|^Variables\\|^$")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
222 (defvar hyper-apropos-currently-showing nil) ; symbol documented in
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
223 ; help buffer now
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
224 (defvar hyper-apropos-help-history nil) ; chain of symbols followed as links in
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 ; help buffer
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
226 (defvar hyper-apropos-face-history nil)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
227 ;;;(defvar hyper-apropos-variable-history nil)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
228 ;;;(defvar hyper-apropos-function-history nil)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
229 (defvar hyper-apropos-regexp-history nil)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
230 (defvar hyper-apropos-last-regexp nil) ; regex used for last apropos
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
231 (defconst hyper-apropos-apropos-buf "*Hyper Apropos*")
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
232 (defconst hyper-apropos-help-buf "*Hyper Help*")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 (defun hyper-apropos (regexp toggle-apropos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 "Display lists of functions and variables matching REGEXP
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
237 in buffer \"*Hyper Apropos*\". If optional prefix arg is given, then the
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
238 value of `hyper-apropos-programming-apropos' is toggled for this search.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 See also `hyper-apropos-mode'."
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
240 (interactive (list (read-from-minibuffer "List symbols matching regexp: "
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
241 nil nil nil 'hyper-apropos-regexp-history)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
242 current-prefix-arg))
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
243 (or (memq major-mode '(hyper-apropos-mode hyper-apropos-help-mode))
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
244 (setq hyper-apropos-prev-wconfig (current-window-configuration)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 (if (string= "" regexp)
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
246 (if (get-buffer hyper-apropos-apropos-buf)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 (if toggle-apropos
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
248 (hyper-apropos-toggle-programming-flag)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 (message "Using last search results"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 (error "Be more specific..."))
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
251 (set-buffer (get-buffer-create hyper-apropos-apropos-buf))
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
252 (setq buffer-read-only nil)
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
253 (erase-buffer)
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
254 (if toggle-apropos
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
255 (set (make-local-variable 'hyper-apropos-programming-apropos)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
256 (not (default-value 'hyper-apropos-programming-apropos))))
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
257 (let ((flist (apropos-internal regexp
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
258 (if hyper-apropos-programming-apropos
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
259 #'fboundp
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
260 #'commandp)))
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
261 (vlist (apropos-internal regexp
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
262 (if hyper-apropos-programming-apropos
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
263 #'boundp
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
264 #'user-variable-p))))
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
265 (insert-face (format "Apropos search for: %S\n\n" regexp)
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
266 'hyper-apropos-major-heading)
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
267 (insert-face "* = command (M-x) or user-variable.\n"
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
268 'hyper-apropos-documentation)
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
269 (insert-face "\
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
270 a = autoloaded, b = byte-compiled, i = internal, l = lambda, m = macro.\n\n"
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
271 'hyper-apropos-documentation)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
272 (insert-face "Functions and Macros:\n\n" 'hyper-apropos-major-heading)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
273 (hyper-apropos-grok-functions flist)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
274 (insert-face "\n\nVariables and Constants:\n\n"
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
275 'hyper-apropos-major-heading)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
276 (hyper-apropos-grok-variables vlist)
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
277 (goto-char (point-min))))
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
278 (switch-to-buffer hyper-apropos-apropos-buf)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 (hyper-apropos-mode regexp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
281 (defun hyper-apropos-toggle-programming-flag ()
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 (interactive)
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
283 (with-current-buffer hyper-apropos-apropos-buf
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
284 (set (make-local-variable 'hyper-apropos-programming-apropos)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
285 (not hyper-apropos-programming-apropos)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 (message "Re-running apropos...")
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
287 (hyper-apropos hyper-apropos-last-regexp nil))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
289 (defun hyper-apropos-grok-functions (fns)
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
290 (let (bind doc type)
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
291 (dolist (fn fns)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 (setq bind (symbol-function fn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 type (cond ((subrp bind) ?i)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 ((compiled-function-p bind) ?b)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 ((consp bind) (or (cdr
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 (assq (car bind) '((autoload . ?a)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 (lambda . ?l)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 (macro . ?m))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 ??))
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
300 (t ?\ )))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 (insert type (if (commandp fn) "* " " "))
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
302 (let ((e (insert-face (format "%S" fn) 'hyper-apropos-hyperlink)))
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
303 (set-extent-property e 'mouse-face 'highlight))
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
304 (insert-char ?\ (let ((l (- 30 (length (format "%S" fn)))))
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
305 (if (natnump l) l 0)))
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
306 (and hyper-apropos-show-brief-docs
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
307 (setq doc (documentation fn))
179
9ad43877534d Import from CVS: tag r20-3b16
cvs
parents: 173
diff changeset
308 (if (string-match
9ad43877534d Import from CVS: tag r20-3b16
cvs
parents: 173
diff changeset
309 "^([^\n\t )]+[\t ]*\\([^\n)]+\\)?)\\(:[\t ]*\\|\n?\\'\\)"
9ad43877534d Import from CVS: tag r20-3b16
cvs
parents: 173
diff changeset
310 doc)
9ad43877534d Import from CVS: tag r20-3b16
cvs
parents: 173
diff changeset
311 (setq doc (substring doc (match-end 0) (string-match "\n" doc)))
9ad43877534d Import from CVS: tag r20-3b16
cvs
parents: 173
diff changeset
312 t)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
313 (insert-face (if doc
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
314 (concat " - "
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
315 (substring doc 0 (string-match "\n" doc)))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
316 " Not documented.")
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
317 'hyper-apropos-documentation))
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
318 (insert ?\n))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
320 (defun hyper-apropos-grok-variables (vars)
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
321 (let (doc userp)
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
322 (dolist (var vars)
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
323 (setq userp (user-variable-p var))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 (insert (if userp " * " " "))
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
325 (let ((e (insert-face (format "%S" var) 'hyper-apropos-hyperlink)))
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
326 (set-extent-property e 'mouse-face 'highlight))
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
327 (insert-char ?\ (let ((l (- 30 (length (format "%S" var)))))
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
328 (if (natnump l) l 0)))
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
329 (and hyper-apropos-show-brief-docs
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
330 (setq doc (documentation-property var 'variable-documentation))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
331 (insert-face (if doc
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
332 (concat " - " (substring doc (if userp 1 0)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
333 (string-match "\n" doc)))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
334 " - Not documented.")
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
335 'hyper-apropos-documentation))
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
336 (insert ?\n))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 ;; ---------------------------------------------------------------------- ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 (defun hyper-apropos-mode (regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 "Improved apropos mode for displaying Emacs documentation. Function and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 variable names are displayed in the buffer \"*Hyper Apropos*\".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 Functions are preceded by a single character to indicates their types:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 a = autoloaded, b = byte-compiled, i = internal, l = lambda, m = macro.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 Interactive functions are also preceded by an asterisk.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 Variables are preceded by an asterisk if they are user variables.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 General Commands:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 SPC - scroll documentation or apropos window forward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 b - scroll documentation or apropos window backward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 k - eliminate all hits that don't contain keyword
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 n - new search
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 / - isearch-forward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 q - quit and restore previous window configuration
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 Operations for Symbol on Current Line:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 RET - toggle display of symbol's documentation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 (also on button2 in xemacs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 w - show the keybinding if symbol is a command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 i - invoke function on current line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 s - set value of variable on current line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 t - display the C or lisp source (find-tag)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 (delete-other-windows)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 (setq mode-name "Hyper-Apropos"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 major-mode 'hyper-apropos-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 buffer-read-only t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 truncate-lines t
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
371 hyper-apropos-last-regexp regexp
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
372 modeline-buffer-identification
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
373 (list (cons modeline-buffer-id-left-extent "Hyper Apropos: ")
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
374 (cons modeline-buffer-id-right-extent (concat "\"" regexp "\""))))
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
375 (use-local-map hyper-apropos-map)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 (run-hooks 'hyper-apropos-mode-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 ;; ---------------------------------------------------------------------- ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
380 ;; similar to `describe-key-briefly', copied from prim/help.el by CW
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
381
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 ;;;###autoload
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
383 (defun hyper-describe-key (key)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
384 (interactive "kDescribe key: ")
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
385 (hyper-describe-key-briefly key t))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
386
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
387 ;;;###autoload
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
388 (defun hyper-describe-key-briefly (key &optional show)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
389 (interactive "kDescribe key briefly: \nP")
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
390 (let (menup defn interm final msg)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
391 (setq defn (key-or-menu-binding key 'menup))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
392 (if (or (null defn) (integerp defn))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
393 (or (numberp show) (message "%s is undefined" (key-description key)))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
394 (cond ((stringp defn)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
395 (setq interm defn
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
396 final (key-binding defn)))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
397 ((vectorp defn)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
398 (setq interm (append defn nil))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
399 (while (and interm
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
400 (member (key-binding (vector (car interm)))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
401 '(universal-argument digit-argument)))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
402 (setq interm (cdr interm)))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
403 (while (and interm
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
404 (not (setq final (key-binding (vconcat interm)))))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
405 (setq interm (butlast interm)))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
406 (if final
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
407 (setq interm (vconcat interm))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
408 (setq interm defn
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
409 final (key-binding defn)))))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
410 (setq msg (format
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
411 "%s runs %s%s%s"
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
412 ;; This used to say 'This menu item' but it could also
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
413 ;; be a scrollbar event. We can't distinguish at the
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
414 ;; moment.
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
415 (if menup "This item" (key-description key))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
416 ;;(if (symbolp defn) defn (key-description defn))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
417 (if (symbolp defn) defn (prin1-to-string defn))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
418 (if final (concat ", " (key-description interm) " runs ") "")
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
419 (if final
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
420 (if (symbolp final) final (prin1-to-string final))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
421 "")))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
422 (if (numberp show)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
423 (or (not (symbolp defn))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
424 (memq (symbol-function defn)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
425 '(zkey-init-kbd-macro zkey-init-kbd-fn))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
426 (progn (princ msg) (princ "\n")))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
427 (message "%s" msg)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
428 (if final (setq defn final))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
429 (if (and (or (symbolp defn) (symbolp (setq defn (car-safe defn))))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
430 defn
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
431 show)
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
432 (hyper-apropos-get-doc defn t))))))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
433
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
434 ;;;###autoload
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
435 (defun hyper-describe-face (symbol &optional this-ref-buffer)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
436 "Describe face..
30
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 16
diff changeset
437 See also `hyper-apropos' and `hyper-describe-function'."
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 16
diff changeset
438 ;; #### - perhaps a prefix arg should suppress the prompt...
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
439 (interactive
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
440 (let (v val)
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
441 (setq v (hyper-apropos-this-symbol)) ; symbol under point
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
442 (or (find-face v)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
443 (setq v (variable-at-point)))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
444 (setq val (let ((enable-recursive-minibuffers t))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
445 (completing-read
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
446 (concat (if (hyper-apropos-follow-ref-buffer current-prefix-arg)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
447 "Follow face"
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
448 "Describe face")
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
449 (if v
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
450 (format " (default %s): " v)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
451 ": "))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
452 (mapcar (function (lambda (x) (list (symbol-name x))))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
453 (face-list))
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
454 nil t nil 'hyper-apropos-face-history)))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
455 (list (if (string= val "")
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
456 (progn (push (symbol-name v) hyper-apropos-face-history) v)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
457 (intern-soft val))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
458 current-prefix-arg)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 (if (null symbol)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 (message "Sorry, nothing to describe.")
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
461 (or (memq major-mode '(hyper-apropos-mode hyper-apropos-help-mode))
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
462 (setq hyper-apropos-prev-wconfig (current-window-configuration)))
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
463 (hyper-apropos-get-doc symbol t nil this-ref-buffer)))
30
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 16
diff changeset
464
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 16
diff changeset
465 ;;;###autoload
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
466 (defun hyper-describe-variable (symbol &optional this-ref-buffer)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
467 "Hypertext drop-in replacement for `describe-variable'.
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
468 See also `hyper-apropos' and `hyper-describe-function'."
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
469 ;; #### - perhaps a prefix arg should suppress the prompt...
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
470 (interactive (list (hyper-apropos-read-variable-symbol
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
471 (if (hyper-apropos-follow-ref-buffer current-prefix-arg)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
472 "Follow variable"
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
473 "Describe variable"))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
474 current-prefix-arg))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
475 (if (null symbol)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
476 (message "Sorry, nothing to describe.")
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
477 (or (memq major-mode '(hyper-apropos-mode hyper-apropos-help-mode))
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
478 (setq hyper-apropos-prev-wconfig (current-window-configuration)))
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
479 (hyper-apropos-get-doc symbol t nil this-ref-buffer)))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
480
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
481 (defun hyper-where-is (symbol)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
482 "Print message listing key sequences that invoke specified command."
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
483 (interactive (list (hyper-apropos-read-function-symbol "Where is function")))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
484 (if (null symbol)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
485 (message "Sorry, nothing to describe.")
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
486 (where-is symbol)))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
487
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
488 ;;;###autoload
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
489 (defun hyper-describe-function (symbol &optional this-ref-buffer)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
490 "Hypertext replacement for `describe-function'. Unlike `describe-function'
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
491 in that the symbol under the cursor is the default if it is a function.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
492 See also `hyper-apropos' and `hyper-describe-variable'."
30
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 16
diff changeset
493 ;; #### - perhaps a prefix arg should suppress the prompt...
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
494 (interactive (list (hyper-apropos-read-function-symbol
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
495 (if (hyper-apropos-follow-ref-buffer current-prefix-arg)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
496 "Follow function"
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
497 "Describe function"))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
498 current-prefix-arg))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
499 (if (null symbol)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
500 (message "Sorry, nothing to describe.")
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
501 (or (memq major-mode '(hyper-apropos-mode hyper-apropos-help-mode))
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
502 (setq hyper-apropos-prev-wconfig (current-window-configuration)))
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
503 (hyper-apropos-get-doc symbol t nil this-ref-buffer)))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
504
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
505 ;;;###autoload
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
506 (defun hyper-apropos-read-variable-symbol (prompt &optional predicate)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
507 "Hypertext drop-in replacement for `describe-variable'.
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
508 See also `hyper-apropos' and `hyper-describe-function'."
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
509 ;; #### - perhaps a prefix arg should suppress the prompt...
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
510 (or predicate (setq predicate 'boundp))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
511 (let (v val)
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
512 (setq v (hyper-apropos-this-symbol)) ; symbol under point
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
513 (or (funcall predicate v)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
514 (setq v (variable-at-point)))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
515 (or (funcall predicate v)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
516 (setq v nil))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
517 (setq val (let ((enable-recursive-minibuffers t))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
518 (completing-read
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
519 (concat prompt
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
520 (if v
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
521 (format " (default %s): " v)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
522 ": "))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
523 obarray predicate t nil 'variable-history)))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
524 (if (string= val "")
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
525 (progn (push (symbol-name v) variable-history) v)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
526 (intern-soft val))))
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
527 ;;;###autoload
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
528 (define-obsolete-function-alias
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
529 'hypropos-read-variable-symbol 'hyper-apropos-read-variable-symbol)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
530
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
531 (defun hyper-apropos-read-function-symbol (prompt)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
532 "Read function symbol from minibuffer."
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
533 (let ((fn (hyper-apropos-this-symbol))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
534 val)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
535 (or (fboundp fn)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
536 (setq fn (function-called-at-point)))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
537 (setq val (let ((enable-recursive-minibuffers t))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
538 (completing-read (if fn
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
539 (format "%s (default %s): " prompt fn)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
540 (format "%s: " prompt))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
541 obarray 'fboundp t nil
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
542 'function-history)))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
543 (if (equal val "")
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
544 (progn (push (symbol-name fn) function-history) fn)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
545 (intern-soft val))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
547 (defun hyper-apropos-last-help (arg)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 "Go back to the last symbol documented in the *Hyper Help* buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 (interactive "P")
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
550 (let ((win (get-buffer-window hyper-apropos-help-buf)))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
551 (or arg (setq arg (if win 1 0)))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
552 (cond ((= arg 0))
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
553 ((<= (length hyper-apropos-help-history) arg)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 ;; go back as far as we can...
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
555 (setcdr (nreverse hyper-apropos-help-history) nil))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 (t
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
557 (setq hyper-apropos-help-history
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
558 (nthcdr arg hyper-apropos-help-history))))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
559 (if (or win (> arg 0))
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
560 (hyper-apropos-get-doc (car hyper-apropos-help-history) t)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
561 (display-buffer hyper-apropos-help-buf))))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
562
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
563 (defun hyper-apropos-insert-face (string &optional face)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
564 "Insert STRING and fontify some parts with face `hyper-apropos-hyperlink'."
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
565 (let ((beg (point)) end)
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
566 (insert-face string (or face 'hyper-apropos-documentation))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
567 (setq end (point))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
568 (goto-char beg)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
569 (while (re-search-forward
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
570 "`\\([-a-zA-Z0-9_][-a-zA-Z0-9_][-a-zA-Z0-9_.]+\\)'"
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
571 end 'limit)
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
572 (let ((e (make-extent (match-beginning 1) (match-end 1))))
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
573 (set-extent-face e 'hyper-apropos-hyperlink)
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
574 (set-extent-property e 'mouse-face 'highlight))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
575 (goto-char beg)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
576 (while (re-search-forward
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
577 "M-x \\([-a-zA-Z0-9_][-a-zA-Z0-9_][-a-zA-Z0-9_.]+\\)"
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
578 end 'limit)
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
579 (let ((e (make-extent (match-beginning 1) (match-end 1))))
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
580 (set-extent-face e 'hyper-apropos-hyperlink)
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
581 (set-extent-property e 'mouse-face 'highlight))))))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
582
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
583 (defun hyper-apropos-insert-keybinding (keys string)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
584 (if keys
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
585 (insert " (" string " bound to \""
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
586 (mapconcat 'key-description
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
587 (sort* keys #'< :key #'length)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
588 "\", \"")
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
589 "\")\n")))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
591 (defun hyper-apropos-insert-section-heading (alias-desc &optional desc)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
592 (or desc (setq desc alias-desc
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
593 alias-desc nil))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
594 (if alias-desc
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
595 (setq desc (concat alias-desc
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
596 (if (memq (aref desc 0)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
597 '(?a ?e ?i ?o ?u))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
598 ", an " ", a ")
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
599 desc)))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
600 (aset desc 0 (upcase (aref desc 0))) ; capitalize
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
601 (goto-char (point-max))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
602 (newline 3) (delete-blank-lines) (newline 2)
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
603 (hyper-apropos-insert-face desc 'hyper-apropos-section-heading))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
604
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
605 (defun hyper-apropos-insert-value (string symbol val)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
606 (insert-face string 'hyper-apropos-heading)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
607 (insert (if (symbol-value symbol)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
608 (if (or (null val) (eq val t) (integerp val))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
609 (prog1
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
610 (symbol-value symbol)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
611 (set symbol nil))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
612 "see below")
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
613 "is void")))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
614
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
615 (defun hyper-apropos-follow-ref-buffer (this-ref-buffer)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
616 (and (not this-ref-buffer)
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
617 (eq major-mode 'hyper-apropos-help-mode)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
618 hyper-apropos-ref-buffer
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
619 (buffer-live-p hyper-apropos-ref-buffer)))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
620
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
621 (defun hyper-apropos-get-alias (symbol alias-p next-symbol &optional use)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
622 "Return (TERMINAL-SYMBOL . ALIAS-DESC)."
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
623 (let (aliases)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
624 (while (funcall alias-p symbol)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
625 (setq aliases (cons (if use (funcall use symbol) symbol) aliases))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
626 (setq symbol (funcall next-symbol symbol)))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
627 (cons symbol
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
628 (and aliases
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
629 (concat "an alias for `"
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
630 (mapconcat 'symbol-name
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
631 (nreverse aliases)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
632 "',\nwhich is an alias for `")
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
633 "'")))))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
634
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
635 (defun hyper-apropos-get-doc (&optional symbol force type this-ref-buffer)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 ;; #### - update this docstring
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 "Toggle display of documentation for the symbol on the current line."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 ;; SYMBOL is the symbol to document. FORCE, if non-nil, means to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 ;; regenerate the documentation even if it already seems to be there. And
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 ;; TYPE, if present, forces the generation of only variable documentation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 ;; or only function documentation. Normally, if both are present, then
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 ;; both will be generated.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 ;; TYPES TO IMPLEMENT: obsolete face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 (or symbol
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
648 (setq symbol (hyper-apropos-this-symbol)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 (or type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650 (setq type '(function variable face)))
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
651 (if (and (eq hyper-apropos-currently-showing symbol)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
652 (get-buffer hyper-apropos-help-buf)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
653 (get-buffer-window hyper-apropos-help-buf)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 (not force))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 ;; we're already displaying this help, so toggle its display.
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
656 (delete-windows-on hyper-apropos-help-buf)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 ;; OK, we've got to refresh and display it...
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
658 (or (eq symbol (car hyper-apropos-help-history))
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
659 (setq hyper-apropos-help-history
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
660 (if (eq major-mode 'hyper-apropos-help-mode)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 ;; if we're following a link in the help buffer, then
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 ;; record that in the help history.
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
663 (cons symbol hyper-apropos-help-history)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664 ;; otherwise clear the history because it's a new search.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 (list symbol))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 (save-excursion
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
667 (if (hyper-apropos-follow-ref-buffer this-ref-buffer)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
668 (set-buffer hyper-apropos-ref-buffer)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
669 (setq hyper-apropos-ref-buffer (current-buffer)))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
670 (let (standard-output
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
671 ok beg
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
672 newsym symtype doc obsolete
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
673 (local mode-name)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
674 global local-str global-str
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
675 font fore back undl
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
676 aliases alias-desc desc)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
677 (save-excursion
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
678 (set-buffer (get-buffer-create hyper-apropos-help-buf))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
679 ;;(setq standard-output (current-buffer))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
680 (setq buffer-read-only nil)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
681 (erase-buffer)
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
682 (insert-face (format "`%s'" symbol) 'hyper-apropos-major-heading)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
683 (insert (format " (buffer: %s, mode: %s)\n"
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
684 (buffer-name hyper-apropos-ref-buffer)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
685 local)))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
686 ;; function ----------------------------------------------------------
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 (and (memq 'function type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 (fboundp symbol)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
689 (progn
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
690 (setq ok t)
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
691 (setq aliases (hyper-apropos-get-alias (symbol-function symbol)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
692 'symbolp
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
693 'symbol-function)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
694 newsym (car aliases)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
695 alias-desc (cdr aliases))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
696 (if (eq 'macro (car-safe newsym))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
697 (setq desc "macro"
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
698 newsym (cdr newsym))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
699 (setq desc "function"))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
700 (setq symtype (cond ((subrp newsym) 'subr)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
701 ((compiled-function-p newsym) 'bytecode)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
702 ((eq (car-safe newsym) 'autoload) 'autoload)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
703 ((eq (car-safe newsym) 'lambda) 'lambda))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704 desc (concat (if (commandp symbol) "interactive ")
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
705 (cdr (assq symtype
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706 '((subr . "built-in ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707 (bytecode . "compiled Lisp ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708 (autoload . "autoloaded Lisp ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709 (lambda . "Lisp "))))
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
710 desc
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
711 (if (eq symtype 'autoload)
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
712 (format ", (autoloaded from \"%s\")"
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
713 (nth 1 newsym))))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
714 local (current-local-map)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
715 global (current-global-map)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
716 obsolete (get symbol 'byte-obsolete-info)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 doc (or (documentation symbol) "function not documented"))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
718 (save-excursion
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
719 (set-buffer hyper-apropos-help-buf)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
720 (goto-char (point-max))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
721 (setq standard-output (current-buffer))
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
722 (hyper-apropos-insert-section-heading alias-desc desc)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
723 (insert ":\n")
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
724 (if local
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
725 (hyper-apropos-insert-keybinding
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
726 (where-is-internal symbol (list local) nil nil nil)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
727 "locally"))
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
728 (hyper-apropos-insert-keybinding
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
729 (where-is-internal symbol (list global) nil nil nil)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
730 "globally")
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
731 (insert "\n")
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
732 (if obsolete
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
733 (hyper-apropos-insert-face
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
734 (format "%s is an obsolete function; %s\n\n" symbol
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
735 (if (stringp (car obsolete))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
736 (car obsolete)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
737 (format "use `%s' instead." (car obsolete))))
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
738 'hyper-apropos-warning))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
739 (setq beg (point))
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
740 (insert-face "arguments: " 'hyper-apropos-heading)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
741 (cond ((eq symtype 'lambda)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
742 (princ (or (nth 1 newsym) "()")))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
743 ((eq symtype 'bytecode)
171
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
744 (princ (or (compiled-function-arglist newsym)
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 167
diff changeset
745 "()")))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
746 ((and (eq symtype 'subr)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
747 (string-match
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
748 "[\n\t ]*\narguments: ?\\((.*)\\)\n?\\'"
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
749 doc))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
750 (insert (substring doc
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
751 (match-beginning 1)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
752 (match-end 1)))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
753 (setq doc (substring doc 0 (match-beginning 0))))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
754 ((and (eq symtype 'subr)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
755 (string-match
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
756 "\
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
757 \[\n\t ]*([^\n\t )]+[\t ]*\\([^\n)]+\\)?)\\(:[\t ]*\\|\n?\\'\\)"
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
758 doc))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
759 (insert "("
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
760 (if (match-end 1)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
761 (substring doc
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
762 (match-beginning 1)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
763 (match-end 1)))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
764 ")")
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
765 (setq doc (substring doc (match-end 0))))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
766 (t (princ "[not available]")))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
767 (insert "\n\n")
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
768 (hyper-apropos-insert-face doc)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
769 (insert "\n")
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
770 (indent-rigidly beg (point) 2))))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
771 ;; variable ----------------------------------------------------------
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
772 (and (memq 'variable type)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
773 (or (boundp symbol) (default-boundp symbol))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
774 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
775 (setq ok t)
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
776 (setq aliases (hyper-apropos-get-alias symbol
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
777 'variable-alias
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
778 'variable-alias
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
779 'variable-alias)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
780 newsym (car aliases)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
781 alias-desc (cdr aliases))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
782 (setq symtype (or (local-variable-p newsym (current-buffer))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
783 (and (local-variable-p newsym
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
784 (current-buffer) t)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
785 'auto-local))
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
786 desc (concat (and (get newsym 'custom-type)
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
787 "customizable ")
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
788 (if (user-variable-p newsym)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
789 "user variable"
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
790 "variable")
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
791 (cond ((eq symtype t) ", buffer-local")
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
792 ((eq symtype 'auto-local)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
793 ", local when set")))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
794 local (and (boundp newsym)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
795 (symbol-value newsym))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
796 local-str (and (boundp newsym)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
797 (prin1-to-string local))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
798 global (and (eq symtype t)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
799 (default-boundp newsym)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
800 (default-value newsym))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
801 global-str (and (eq symtype t)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
802 (default-boundp newsym)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
803 (prin1-to-string global))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
804 obsolete (get symbol 'byte-obsolete-variable)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
805 doc (or (documentation-property symbol
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
806 'variable-documentation)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
807 "variable not documented"))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
808 (save-excursion
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
809 (set-buffer hyper-apropos-help-buf)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
810 (goto-char (point-max))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
811 (setq standard-output (current-buffer))
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
812 (hyper-apropos-insert-section-heading alias-desc desc)
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
813 (when (and (user-variable-p newsym)
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
814 (get newsym 'custom-type))
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
815 (let ((e (make-extent (point-at-bol) (point))))
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
816 (set-extent-property e 'mouse-face 'highlight)
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
817 (set-extent-property e 'help-echo
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
818 (format "Customize %s" newsym))
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
819 (set-extent-property
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
820 e 'hyper-apropos-custom
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
821 `(lambda () (customize-variable (quote ,newsym))))))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
822 (insert ":\n\n")
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
823 (setq beg (point))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
824 (if obsolete
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
825 (hyper-apropos-insert-face
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
826 (format "%s is an obsolete function; %s\n\n" symbol
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
827 (if (stringp obsolete)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
828 obsolete
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
829 (format "use `%s' instead." obsolete)))
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
830 'hyper-apropos-warning))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
831 ;; generally, the value of the variable is short and the
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
832 ;; documentation of the variable long, so it's desirable
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
833 ;; to see all of the value and the start of the
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
834 ;; documentation. Some variables, though, have huge and
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
835 ;; nearly meaningless values that force you to page
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
836 ;; forward just to find the doc string. That is
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
837 ;; undesirable.
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
838 (if (and (or (null local-str) (< (length local-str) 69))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
839 (or (null global-str) (< (length global-str) 69)))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
840 ; 80 cols. docstrings assume this.
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
841 (progn (insert-face "value: " 'hyper-apropos-heading)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
842 (insert (or local-str "is void"))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
843 (if (eq symtype t)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
844 (progn
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
845 (insert "\n")
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
846 (insert-face "default value: " 'hyper-apropos-heading)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
847 (insert (or global-str "is void"))))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
848 (insert "\n\n")
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
849 (hyper-apropos-insert-face doc))
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
850 (hyper-apropos-insert-value "value: " 'local-str local)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
851 (if (eq symtype t)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
852 (progn
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
853 (insert ", ")
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
854 (hyper-apropos-insert-value "default-value: "
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
855 'global-str global)))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
856 (insert "\n\n")
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
857 (hyper-apropos-insert-face doc)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
858 (if local-str
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
859 (progn
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
860 (newline 3) (delete-blank-lines) (newline 1)
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
861 (insert-face "value: " 'hyper-apropos-heading)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
862 (if hyper-apropos-prettyprint-long-values
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
863 (condition-case nil
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
864 (let ((pp-print-readably nil)) (pprint local))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
865 (error (insert local-str)))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
866 (insert local-str))))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
867 (if global-str
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
868 (progn
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
869 (newline 3) (delete-blank-lines) (newline 1)
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
870 (insert-face "default value: " 'hyper-apropos-heading)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
871 (if hyper-apropos-prettyprint-long-values
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
872 (condition-case nil
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
873 (let ((pp-print-readably nil)) (pprint global))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
874 (error (insert global-str)))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
875 (insert global-str)))))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
876 (indent-rigidly beg (point) 2))))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
877 ;; face --------------------------------------------------------------
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878 (and (memq 'face type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879 (find-face symbol)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881 (setq ok t)
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
882 (copy-face symbol 'hyper-apropos-temp-face 'global)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
883 (mapcar (function
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
884 (lambda (property)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
885 (setq symtype (face-property-instance symbol
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
886 property))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
887 (if symtype
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
888 (set-face-property 'hyper-apropos-temp-face
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
889 property
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
890 symtype))))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
891 built-in-face-specifiers)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
892 (setq font (cons (face-property-instance symbol 'font nil 0 t)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
893 (face-property-instance symbol 'font))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
894 fore (cons (face-foreground-instance symbol nil 0 t)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
895 (face-foreground-instance symbol))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
896 back (cons (face-background-instance symbol nil 0 t)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
897 (face-background-instance symbol))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
898 undl (cons (face-underline-p symbol nil 0 t)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
899 (face-underline-p symbol))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
900 doc (face-doc-string symbol))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901 ;; #### - add some code here
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
902 (save-excursion
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
903 (set-buffer hyper-apropos-help-buf)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
904 (setq standard-output (current-buffer))
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
905 (hyper-apropos-insert-section-heading
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
906 (concat "Face"
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
907 (when (get symbol 'face-defface-spec)
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
908 (let* ((str " (customizable)")
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
909 (e (make-extent 1 (length str) str)))
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
910 (set-extent-property e 'mouse-face 'highlight)
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
911 (set-extent-property e 'help-echo
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
912 (format "Customize %s" symbol))
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
913 (set-extent-property e 'unique t)
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
914 (set-extent-property e 'duplicable t)
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
915 (set-extent-property
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
916 e 'hyper-apropos-custom
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
917 `(lambda () (customize-face (quote ,symbol))))
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
918 str))
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
919 ":\n\n "))
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
920 (insert-face "\
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
921 ABCDEFHIJKLMNOPQRSTUVWXYZ abcdefhijklmnopqrstuvwxyz 0123456789"
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
922 'hyper-apropos-temp-face)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
923 (newline 2)
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
924 (insert-face " Font: " 'hyper-apropos-heading)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
925 (insert (format (if (numberp (car font)) "(%s)\n" "%s\n")
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
926 (and (cdr font)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
927 (font-instance-name (cdr font)))))
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
928 (insert-face " Foreground: " 'hyper-apropos-heading)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
929 (insert (format (if (numberp (car fore)) "(%s)\n" "%s\n")
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
930 (and (cdr fore)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
931 (color-instance-name (cdr fore)))))
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
932 (insert-face " Background: " 'hyper-apropos-heading)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
933 (insert (format (if (numberp (car back)) "(%s)\n" "%s\n")
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
934 (and (cdr back)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
935 (color-instance-name (cdr back)))))
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
936 (insert-face " Underline: " 'hyper-apropos-heading)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
937 (insert (format (if (numberp (car undl)) "(%s)\n" "%s\n")
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
938 (cdr undl)))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
939 (if doc
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
940 (progn
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
941 (newline)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
942 (setq beg (point))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
943 (insert doc)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
944 (indent-rigidly beg (point) 2))))))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
945 ;; not bound & property list -----------------------------------------
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
946 (or ok
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
947 (save-excursion
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
948 (set-buffer hyper-apropos-help-buf)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
949 (hyper-apropos-insert-section-heading
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
950 "symbol is not currently bound\n")))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
951 (if (and (setq symtype (symbol-plist symbol))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
952 (or (> (length symtype) 2)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
953 (not (memq 'variable-documentation symtype))))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
954 (save-excursion
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
955 (set-buffer hyper-apropos-help-buf)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
956 (goto-char (point-max))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
957 (setq standard-output (current-buffer))
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
958 (hyper-apropos-insert-section-heading "property-list:\n\n")
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
959 (while symtype
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
960 (if (memq (car symtype)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
961 '(variable-documentation byte-obsolete-info))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
962 (setq symtype (cdr symtype))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
963 (insert-face (concat " " (symbol-name (car symtype))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
964 ": ")
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
965 'hyper-apropos-heading)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
966 (setq symtype (cdr symtype))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
967 (indent-to 32)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
968 (insert (prin1-to-string (car symtype)) "\n"))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
969 (setq symtype (cdr symtype)))))))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
970 (save-excursion
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
971 (set-buffer hyper-apropos-help-buf)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
972 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
973 ;; pop up window and shrink it if it's wasting space
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
974 (if hyper-apropos-shrink-window
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
975 (shrink-window-if-larger-than-buffer
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
976 (display-buffer (current-buffer)))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
977 (display-buffer (current-buffer)))
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
978 (hyper-apropos-help-mode))
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
979 (setq hyper-apropos-currently-showing symbol)))
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
980 ;;;###autoload
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
981 (define-obsolete-function-alias
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
982 'hypropos-get-doc 'hyper-apropos-get-doc)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
983
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
984 ; -----------------------------------------------------------------------------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
985
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
986 (defun hyper-apropos-help-mode ()
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
987 "Major mode for hypertext XEmacs help. In this mode, you can quickly
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
988 follow links between back and forth between the documentation strings for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
989 different variables and functions. Common commands:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
990
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
991 \\{hyper-apropos-help-map}"
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
992 (setq buffer-read-only t
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
993 major-mode 'hyper-apropos-help-mode
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
994 mode-name "Hyper-Help")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
995 (set-syntax-table emacs-lisp-mode-syntax-table)
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
996 (hyper-apropos-highlightify)
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
997 (use-local-map hyper-apropos-help-map))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
998
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
999 ;; ---------------------------------------------------------------------- ;;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1000
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1001 (defun hyper-apropos-highlightify ()
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
1002 (save-excursion
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
1003 (goto-char (point-min))
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
1004 (let ((st (point-min))
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
1005 sym)
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
1006 (while (not (eobp))
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
1007 (if (zerop (skip-syntax-forward "w_"))
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
1008 (forward-char 1)
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
1009 (and (> (- (point) st) 3)
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
1010 (setq sym (intern-soft (buffer-substring st (point))))
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
1011 (or (boundp sym)
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
1012 (fboundp sym))
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
1013 (set-extent-property (make-extent st (point))
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
1014 'mouse-face 'highlight)))
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
1015 (setq st (point))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1016
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1017 ;; ---------------------------------------------------------------------- ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1018
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1019 (defun hyper-apropos-scroll-up ()
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1020 "Scroll up the \"*Hyper Help*\" buffer if it's visible.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1021 Otherwise, scroll the selected window up."
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1022 (interactive)
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1023 (let ((win (get-buffer-window hyper-apropos-help-buf))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1024 (owin (selected-window)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1025 (if win
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1026 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1027 (select-window win)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1028 (condition-case nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1029 (scroll-up nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1030 (error (goto-char (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1031 (select-window owin))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1032 (scroll-up nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1033
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1034 (defun hyper-apropos-scroll-down ()
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1035 "Scroll down the \"*Hyper Help*\" buffer if it's visible.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1036 Otherwise, scroll the selected window down."
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1037 (interactive)
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1038 (let ((win (get-buffer-window hyper-apropos-help-buf))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1039 (owin (selected-window)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1040 (if win
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1041 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1042 (select-window win)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1043 (condition-case nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1044 (scroll-down nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1045 (error (goto-char (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1046 (select-window owin))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1047 (scroll-down nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1048
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1049 ;; ---------------------------------------------------------------------- ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1050
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1051 (defun hyper-apropos-mouse-get-doc (event)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1052 "Get the documentation for the symbol the mouse is on."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1053 (interactive "e")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1054 (mouse-set-point event)
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1055 (let ((e (extent-at (point) nil 'hyper-apropos-custom)))
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
1056 (if e
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1057 (funcall (extent-property e 'hyper-apropos-custom))
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
1058 (save-excursion
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1059 (let ((symbol (hyper-apropos-this-symbol)))
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
1060 (if symbol
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1061 (hyper-apropos-get-doc symbol)
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
1062 (error "Click on a symbol")))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1063
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1064 ;; ---------------------------------------------------------------------- ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1065
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1066 (defun hyper-apropos-add-keyword (pattern)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1067 "Use additional keyword to narrow regexp match.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1068 Deletes lines which don't match PATTERN."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1069 (interactive "sAdditional Keyword: ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1070 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1071 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1072 (let (buffer-read-only)
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1073 (keep-lines (concat pattern "\\|" hyper-apropos-junk-regexp))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1074 )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1075
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1076 (defun hyper-apropos-eliminate-keyword (pattern)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1077 "Use additional keyword to eliminate uninteresting matches.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1078 Deletes lines which match PATTERN."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1079 (interactive "sKeyword to eliminate: ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1080 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1081 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1082 (let (buffer-read-only)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1083 (flush-lines pattern))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1084 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1085
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1086 ;; ---------------------------------------------------------------------- ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1087
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1088 (defun hyper-apropos-this-symbol ()
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1089 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1090 (cond ((eq major-mode 'hyper-apropos-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1091 (beginning-of-line)
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1092 (if (looking-at hyper-apropos-junk-regexp)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1093 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1094 (forward-char 3)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1095 (read (point-marker))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1096 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1097 (let* ((st (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1098 (skip-syntax-backward "w_")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1099 ;; !@(*$^%%# stupid backquote implementation!!!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1100 (skip-chars-forward "`")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1101 (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1102 (en (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1103 (skip-syntax-forward "w_")
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1104 (skip-chars-backward ".':") ; : for Local Variables
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1105 (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1106 (and (not (eq st en))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1107 (intern-soft (buffer-substring st en))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1108
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1109 (defun hyper-apropos-where-is (symbol)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1110 "Find keybinding for symbol on current line."
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1111 (interactive (list (hyper-apropos-this-symbol)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1112 (where-is symbol))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1113
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1114 (defun hyper-apropos-invoke-fn (fn)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1115 "Interactively invoke the function on the current line."
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1116 (interactive (list (hyper-apropos-this-symbol)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1117 (cond ((not (fboundp fn))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1118 (error "%S is not a function" fn))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1119 (t (call-interactively fn))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1120
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1121 ;;;###autoload
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1122 (defun hyper-set-variable (var val &optional this-ref-buffer)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1123 (interactive
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1124 (let ((var (hyper-apropos-read-variable-symbol
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1125 (if (hyper-apropos-follow-ref-buffer current-prefix-arg)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1126 "In ref buffer, set user option"
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1127 "Set user option")
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1128 'user-variable-p)))
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1129 (list var (hyper-apropos-read-variable-value var) current-prefix-arg)))
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1130 (hyper-apropos-set-variable var val this-ref-buffer))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1131
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1132 ;;;###autoload
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1133 (defun hyper-apropos-set-variable (var val &optional this-ref-buffer)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1134 "Interactively set the variable on the current line."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1135 (interactive
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1136 (let ((var (hyper-apropos-this-symbol)))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1137 (or (and var (boundp var))
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1138 (and (setq var (and (eq major-mode 'hyper-apropos-help-mode)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1139 (save-excursion
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1140 (goto-char (point-min))
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1141 (hyper-apropos-this-symbol))))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1142 (boundp var))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1143 (setq var nil))
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1144 (list var (hyper-apropos-read-variable-value var))))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1145 (and var
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1146 (boundp var)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1147 (progn
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1148 (if (hyper-apropos-follow-ref-buffer this-ref-buffer)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1149 (save-excursion
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1150 (set-buffer hyper-apropos-ref-buffer)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1151 (set var val))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1152 (set var val))
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1153 (hyper-apropos-get-doc var t '(variable) this-ref-buffer))))
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1154 ;;;###autoload
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1155 (define-obsolete-function-alias
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1156 'hypropos-set-variable 'hyper-apropos-set-variable)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1157
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1158 (defun hyper-apropos-read-variable-value (var &optional this-ref-buffer)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1159 (and var
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1160 (boundp var)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1161 (let ((prop (get var 'variable-interactive))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1162 (print-readably t)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1163 val str)
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1164 (hyper-apropos-get-doc var t '(variable) current-prefix-arg)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1165 (if prop
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1166 (call-interactively (list 'lambda '(arg)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1167 (list 'interactive prop)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1168 'arg))
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1169 (setq val (if (hyper-apropos-follow-ref-buffer this-ref-buffer)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1170 (save-excursion
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1171 (set-buffer hyper-apropos-ref-buffer)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1172 (symbol-value var))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1173 (symbol-value var))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1174 str (prin1-to-string val))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1175 (eval-minibuffer
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1176 (format "Set %s `%s' to value (evaluated): "
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1177 (if (user-variable-p var) "user option" "Variable")
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1178 var)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1179 (condition-case nil
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1180 (progn
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1181 (read str)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1182 (format (if (or (consp val)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1183 (and (symbolp val)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1184 (not (memq val '(t nil)))))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1185 "'%s" "%s")
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1186 str))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 82
diff changeset
1187 (error nil)))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1188
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1189 (defun hyper-apropos-customize-variable ()
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
1190 (interactive)
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1191 (let ((var (hyper-apropos-this-symbol)))
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
1192 (customize-variable var)))
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
1193
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1194 ;; ---------------------------------------------------------------------- ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1195
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1196 (defun hyper-apropos-find-tag (&optional tag-name)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1197 "Find the tag for the symbol on the current line in other window. In
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1198 order for this to work properly, the variable `tag-table-alist' or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1199 `tags-file-name' must be set so that a TAGS file with tags for the emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1200 source is found for the \"*Hyper Apropos*\" buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1201 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1202 ;; there ought to be a default tags file for this...
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1203 (or tag-name (setq tag-name (symbol-name (hyper-apropos-this-symbol))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1204 (find-tag-other-window (list tag-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1205
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1206 ;; ---------------------------------------------------------------------- ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1207
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 179
diff changeset
1208 (defun hyper-apropos-find-function (fn)
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 179
diff changeset
1209 "Find the function for the symbol on the current line in other
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 179
diff changeset
1210 window. (See also `find-function'.)"
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 179
diff changeset
1211 (interactive
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 179
diff changeset
1212 (let ((fn (hyper-apropos-this-symbol)))
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 179
diff changeset
1213 (or (fboundp fn)
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 179
diff changeset
1214 (and (setq fn (and (eq major-mode 'hyper-apropos-help-mode)
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 179
diff changeset
1215 (save-excursion
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 179
diff changeset
1216 (goto-char (point-min))
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 179
diff changeset
1217 (hyper-apropos-this-symbol))))
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 179
diff changeset
1218 (fboundp fn))
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 179
diff changeset
1219 (setq fn nil))
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 179
diff changeset
1220 (list fn)))
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 179
diff changeset
1221 (if fn
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 179
diff changeset
1222 (find-function-other-window fn)))
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 179
diff changeset
1223
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 179
diff changeset
1224 ;; ---------------------------------------------------------------------- ;;
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 179
diff changeset
1225
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1226 (defun hyper-apropos-disassemble (sym)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1227 "Disassemble FUN if it is byte-coded. If it's a lambda, prettyprint it."
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1228 (interactive (list (hyper-apropos-this-symbol)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1229 (let ((fun sym) (trail nil) macrop)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1230 (while (and (symbolp fun) (not (memq fun trail)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1231 (setq trail (cons fun trail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1232 fun (symbol-function fun)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1233 (and (symbolp fun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1234 (error "Loop detected in function binding of `%s'" fun))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1235 (setq macrop (and (consp fun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1236 (eq 'macro (car fun))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1237 (cond ((compiled-function-p (if macrop (cdr fun) fun))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1238 (disassemble fun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1239 (set-buffer "*Disassemble*")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1240 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1241 (forward-sexp 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1242 (insert (format " for function `%S'" sym))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1243 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1244 ((consp fun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1245 (with-output-to-temp-buffer "*Disassemble*"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1246 (pprint (if macrop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1247 (cons 'defmacro (cons sym (cdr (cdr fun))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1248 (cons 'defun (cons sym (cdr fun))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1249 (set-buffer "*Disassemble*")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1250 (emacs-lisp-mode))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1251 ((or (vectorp fun) (stringp fun))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1252 ;; #### - do something fancy here
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1253 (with-output-to-temp-buffer "*Disassemble*"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1254 (princ (format "%s is a keyboard macro:\n\n\t" sym))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1255 (prin1 fun)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1256 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1257 (error "Sorry, cannot disassemble `%s'" sym)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1258
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1259 ;; ---------------------------------------------------------------------- ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1260
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1261 (defun hyper-apropos-quit ()
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1262 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1263 "Quit Hyper Apropos and restore original window config."
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1264 (let ((buf (get-buffer hyper-apropos-apropos-buf)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1265 (and buf (bury-buffer buf)))
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1266 (set-window-configuration hyper-apropos-prev-wconfig))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1267
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1268 ;; ---------------------------------------------------------------------- ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1269
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1270 ;;;###autoload
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1271 (defun hyper-apropos-popup-menu (event)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1272 (interactive "e")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1273 (mouse-set-point event)
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 179
diff changeset
1274 (let* ((sym (or (hyper-apropos-this-symbol)
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 179
diff changeset
1275 (and (eq major-mode 'hyper-apropos-help-mode)
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 179
diff changeset
1276 (save-excursion
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 179
diff changeset
1277 (goto-char (point-min))
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 179
diff changeset
1278 (hyper-apropos-this-symbol)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1279 (notjunk (not (null sym)))
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 134
diff changeset
1280 (command-p (if (commandp sym) t))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1281 (variable-p (and sym (boundp sym)))
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
1282 (customizable-p (and variable-p
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
1283 (get sym 'custom-type)
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
1284 t))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1285 (function-p (fboundp sym))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1286 (apropos-p (eq 'hyper-apropos-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1287 (save-excursion (set-buffer (event-buffer event))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1288 major-mode)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1289 (name (if sym (symbol-name sym) ""))
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1290 (hyper-apropos-menu
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1291 (delete
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1292 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1293 (list (concat "Hyper-Help: " name)
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1294 (vector "Display documentation" 'hyper-apropos-get-doc notjunk)
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 179
diff changeset
1295 (vector "Set variable" 'hyper-apropos-set-variable variable-p)
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1296 (vector "Customize variable" 'hyper-apropos-customize-variable
161
28f395d8dc7a Import from CVS: tag r20-3b7
cvs
parents: 155
diff changeset
1297 customizable-p)
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1298 (vector "Show keys for" 'hyper-apropos-where-is command-p)
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 179
diff changeset
1299 (vector "Invoke command" 'hyper-apropos-invoke-fn command-p)
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 179
diff changeset
1300 (vector "Find function" 'hyper-apropos-find-function function-p)
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1301 (vector "Find tag" 'hyper-apropos-find-tag notjunk)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1302 (and apropos-p
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1303 ["Add keyword..." hyper-apropos-add-keyword t])
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1304 (and apropos-p
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1305 ["Eliminate keyword..." hyper-apropos-eliminate-keyword t])
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1306 (if apropos-p
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1307 ["Programmers' Apropos" hyper-apropos-toggle-programming-flag
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1308 :style toggle :selected hyper-apropos-programming-apropos]
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1309 ["Programmers' Help" hyper-apropos-toggle-programming-flag
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1310 :style toggle :selected hyper-apropos-programming-apropos])
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1311 (and hyper-apropos-programming-apropos
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1312 (vector "Disassemble function"
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1313 'hyper-apropos-disassemble
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1314 function-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1315 ["Help" describe-mode t]
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1316 ["Quit" hyper-apropos-quit t]
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1317 ))))
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1318 (popup-menu hyper-apropos-menu)))
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1319 ;;;###autoload
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1320 (define-obsolete-function-alias
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 161
diff changeset
1321 'hypropos-popup-menu 'hyper-apropos-popup-menu)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1322
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1323 (provide 'hyper-apropos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1324
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1325 ;; end of hyper-apropos.el