annotate lisp/help.el @ 209:41ff10fd062f r20-4b3

Import from CVS: tag r20-4b3
author cvs
date Mon, 13 Aug 2007 10:04:58 +0200
parents
children 78478c60bfcd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1 ;;; help.el --- help commands for XEmacs.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3 ;; Copyright (C) 1985, 1986, 1992-4, 1997 Free Software Foundation, Inc.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
4
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
5 ;; Maintainer: FSF
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
6 ;; Keywords: help, internal, dumped
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
7
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
8 ;; This file is part of XEmacs.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
9
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
10 ;; XEmacs is free software; you can redistribute it and/or modify it
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
11 ;; under the terms of the GNU General Public License as published by
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
13 ;; any later version.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
14
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
15 ;; XEmacs is distributed in the hope that it will be useful, but
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
18 ;; General Public License for more details.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
19
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
21 ;; along with XEmacs; see the file COPYING. If not, write to the
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
22 ;; Free Software Foundation, 59 Temple Place - Suite 330,
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
23 ;; Boston, MA 02111-1307, USA.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
24
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
25 ;;; Synched up with: FSF 19.30.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
26
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
27 ;;; Commentary:
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
28
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
29 ;; This file is dumped with XEmacs.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
30
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
31 ;; This code implements XEmacs's on-line help system, the one invoked by
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
32 ;;`M-x help-for-help'.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
33
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
34 ;; 06/11/1997 -- Converted to use char-after instead of broken
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
35 ;; following-char. -slb
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
36
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
37 ;;; Code:
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
38
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
39 ;#### FSFmacs
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
40 ;; Get the macro make-help-screen when this is compiled,
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
41 ;; or run interpreted, but not when the compiled code is loaded.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
42 ;(eval-when-compile (require 'help-macro))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
43
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
44 (defgroup help-appearance nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
45 "Appearance of help buffers"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
46 :group 'help)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
47
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
48 (defvar help-map (let ((map (make-sparse-keymap)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
49 (set-keymap-name map 'help-map)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
50 (set-keymap-prompt
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
51 map (purecopy (gettext "(Type ? for further options)")))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
52 map)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
53 "Keymap for characters following the Help key.")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
54
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
55 ;; global-map definitions moved to keydefs.el
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
56 (fset 'help-command help-map)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
57
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
58 (define-key help-map (vector help-char) 'help-for-help)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
59 (define-key help-map "?" 'help-for-help)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
60 (define-key help-map 'help 'help-for-help)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
61
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
62 (define-key help-map "\C-l" 'describe-copying) ; on \C-c in FSFmacs
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
63 (define-key help-map "\C-d" 'describe-distribution)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
64 (define-key help-map "\C-w" 'describe-no-warranty)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
65 (define-key help-map "a" 'hyper-apropos) ; 'command-apropos in FSFmacs
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
66 (define-key help-map "A" 'command-apropos)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
67
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
68 (define-key help-map "b" 'describe-bindings)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
69 (define-key help-map "B" 'describe-beta)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
70 (define-key help-map "\C-p" 'describe-pointer)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
71
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
72 (define-key help-map "C" 'customize)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
73 (define-key help-map "c" 'describe-key-briefly)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
74 (define-key help-map "k" 'describe-key)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
75
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
76 (define-key help-map "d" 'describe-function)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
77 (define-key help-map "e" 'describe-last-error)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
78 (define-key help-map "f" 'describe-function)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
79
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
80 (define-key help-map "F" 'xemacs-local-faq)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
81
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
82 ;;; Setup so Hyperbole can be autoloaded from a key.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
83 ;;; Choose a key on which to place the Hyperbole menus.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
84 ;;; For most people this key binding will work and will be equivalent
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
85 ;;; to {C-h h}.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
86 ;;;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
87 (or (where-is-internal 'hyperbole)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
88 (where-is-internal 'hui:menu)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
89 (define-key help-map "h" 'hyperbole))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
90 (autoload 'hyperbole "hsite" "Hyperbole info manager menus." t)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
91
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
92 (define-key help-map "i" 'info)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
93 (define-key help-map '(control i) 'Info-query)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
94 ;; FSFmacs has Info-goto-emacs-command-node on C-f, no binding
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
95 ;; for Info-elisp-ref
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
96 (define-key help-map '(control c) 'Info-goto-emacs-command-node)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
97 (define-key help-map '(control k) 'Info-goto-emacs-key-command-node)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
98 (define-key help-map '(control f) 'Info-elisp-ref)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
99
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
100 (define-key help-map "l" 'view-lossage)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
101
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
102 (define-key help-map "m" 'describe-mode)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
103
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
104 (define-key help-map "\C-n" 'view-emacs-news)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
105 (define-key help-map "n" 'view-emacs-news)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
106
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
107 (define-key help-map "p" 'finder-by-keyword)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
108 (autoload 'finder-by-keyword "finder"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
109 "Find packages matching a given keyword." t)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
110
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
111 (define-key help-map "s" 'describe-syntax)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
112
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
113 (define-key help-map "t" 'help-with-tutorial)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
114
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
115 (define-key help-map "w" 'where-is)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
116
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
117 (define-key help-map "v" 'describe-variable)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
118
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
119 (if (fboundp 'view-last-error)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
120 (define-key help-map "e" 'view-last-error))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
121
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
122
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
123 (define-key help-map "q" 'help-quit)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
124
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
125 ;#### This stuff was an attempt to have font locking and hyperlinks in the
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
126 ;help buffer, but it doesn't really work. Some of this stuff comes from
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
127 ;FSF Emacs; but the FSF Emacs implementation is rather broken, as usual.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
128 ;What needs to happen is this:
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
129 ;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
130 ; -- we probably need a "hyperlink mode" from which help-mode is derived.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
131 ; -- this means we probably need multiple inheritance of modes!
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
132 ; Thankfully this is not hard to implement; we already have the
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
133 ; ability for a keymap to have multiple parents. However, we'd
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
134 ; have to define any multiply-inherited-from modes using a standard
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
135 ; `define-mode' construction instead of manually doing it, because
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
136 ; we don't want each guy calling `kill-all-local-variables' and
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
137 ; messing up the previous one.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
138 ; -- we need to scan the buffer ourselves (not from font-lock, because
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
139 ; the user might not have font-lock enabled) and highlight only
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
140 ; those words that are *documented* functions and variables (and
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
141 ; probably excluding words without dashes in them unless enclosed
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
142 ; in quotes, so that common words like "list" and "point" don't
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
143 ; become hyperlinks.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
144 ; -- we should *not* use font-lock keywords like below. Instead we
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
145 ; should add the font-lock stuff ourselves during the scanning phase,
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
146 ; if font-lock is enabled in this buffer.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
147
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
148 ;(defun help-follow-reference (event extent user-data)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
149 ; (let ((symbol (intern-soft (extent-string extent))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
150 ; (cond ((and symbol (fboundp symbol))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
151 ; (describe-function symbol))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
152 ; ((and symbol (boundp symbol))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
153 ; (describe-variable symbol))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
154 ; (t nil))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
155
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
156 ;(defvar help-font-lock-keywords
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
157 ; (let ((name-char "[-+a-zA-Z0-9_*]") (sym-char "[-+a-zA-Z0-9_:*]"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
158 ; (list
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
159 ; ;;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
160 ; ;; The symbol itself.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
161 ; (list (concat "\\`\\(" name-char "+\\)\\(:\\)?")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
162 ; '(1 (if (match-beginning 2)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
163 ; 'font-lock-function-name-face
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
164 ; 'font-lock-variable-name-face)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
165 ; nil t))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
166 ; ;;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
167 ; ;; Words inside `' which tend to be symbol names.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
168 ; (list (concat "`\\(" sym-char sym-char "+\\)'")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
169 ; 1 '(prog1
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
170 ; 'font-lock-reference-face
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
171 ; (add-list-mode-item (match-beginning 1)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
172 ; (match-end 1)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
173 ; nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
174 ; 'help-follow-reference))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
175 ; t)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
176 ; ;;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
177 ; ;; CLisp `:' keywords as references.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
178 ; (list (concat "\\<:" sym-char "+\\>") 0 'font-lock-reference-face t)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
179 ; "Default expressions to highlight in Help mode.")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
180
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
181 ;(put 'help-mode 'font-lock-defaults '(help-font-lock-keywords))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
182
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
183 (define-derived-mode help-mode view-major-mode "Help"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
184 "Major mode for viewing help text.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
185 Entry to this mode runs the normal hook `help-mode-hook'.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
186 Commands:
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
187 \\{help-mode-map}"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
188 )
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
189
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
190 (define-key help-mode-map "q" 'help-mode-quit)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
191 (define-key help-mode-map "f" 'find-function-at-point)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
192
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
193 (defun describe-function-at-point ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
194 "Describe directly the function at point in the other window."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
195 (interactive)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
196 (let ((symb (function-at-point)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
197 (when symb
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
198 (describe-function symb))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
199 (defun describe-variable-at-point ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
200 "Describe directly the variable at point in the other window."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
201 (interactive)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
202 (let ((symb (variable-at-point)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
203 (when symb
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
204 (describe-variable symb))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
205 (defun help-next-symbol ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
206 "Move point to the next quoted symbol."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
207 (interactive)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
208 (search-forward "`" nil t))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
209 (defun help-prev-symbol ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
210 "Move point to the previous quoted symbol."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
211 (interactive)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
212 (search-backward "'" nil t))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
213 (define-key help-mode-map "d" 'describe-function-at-point)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
214 (define-key help-mode-map "v" 'describe-variable-at-point)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
215 (define-key help-mode-map [tab] 'help-next-symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
216 (define-key help-mode-map [(shift tab)] 'help-prev-symbol)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
217
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
218
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
219 (defun help-mode-quit ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
220 "Exits from help mode, possibly restoring the previous window configuration.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
221 Bury the help buffer to the end of the buffer list."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
222 (interactive)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
223 (let ((buf (current-buffer)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
224 (cond ((frame-property (selected-frame) 'help-window-config)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
225 (set-window-configuration
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
226 (frame-property (selected-frame) 'help-window-config))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
227 (set-frame-property (selected-frame) 'help-window-config nil))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
228 ((not (one-window-p))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
229 (delete-window)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
230 (bury-buffer buf)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
231
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
232 (defun help-quit ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
233 (interactive)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
234 nil)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
235
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
236 ;; This is a grody hack of the same genotype as `advertised-undo'; if the
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
237 ;; bindings of Backspace and C-h are the same, we want the menubar to claim
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
238 ;; that `info' in invoked with `C-h i', not `BS i'.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
239
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
240 (defun deprecated-help-command ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
241 (interactive)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
242 (if (eq 'help-command (key-binding "\C-h"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
243 (setq unread-command-event (character-to-event ?\C-h))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
244 (help-for-help)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
245
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
246 ;;(define-key global-map 'backspace 'deprecated-help-command)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
247
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
248 ;; This function has been moved to help-nomule.el and mule-help.el.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
249 ;; TUTORIAL arg is XEmacs addition
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
250 ;(defun help-with-tutorial (&optional tutorial)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
251 ; "Select the XEmacs learn-by-doing tutorial.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
252 ;Optional arg TUTORIAL specifies the tutorial file; default is \"TUTORIAL\"."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
253 ; (interactive)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
254 ; (if (null tutorial)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
255 ; (setq tutorial "TUTORIAL"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
256 ; (let ((file (expand-file-name (concat "~/" tutorial))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
257 ; (delete-other-windows)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
258 ; (if (get-file-buffer file)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
259 ; (switch-to-buffer (get-file-buffer file))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
260 ; (switch-to-buffer (create-file-buffer file))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
261 ; (setq buffer-file-name file)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
262 ; (setq default-directory (expand-file-name "~/"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
263 ; (setq buffer-auto-save-file-name nil)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
264 ; (insert-file-contents (expand-file-name tutorial data-directory))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
265 ; (goto-char (point-min))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
266 ; (search-forward "\n<<")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
267 ; (delete-region (point-at-bol) (point-at-eol))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
268 ; (let ((n (- (window-height (selected-window))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
269 ; (count-lines (point-min) (point))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
270 ; 6)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
271 ; (if (< n 12)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
272 ; (newline n)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
273 ; ;; Some people get confused by the large gap.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
274 ; (newline (/ n 2))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
275 ; (insert "[Middle of page left blank for didactic purposes. "
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
276 ; "Text continues below]")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
277 ; (newline (- n (/ n 2)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
278 ; (goto-char (point-min))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
279 ; (set-buffer-modified-p nil))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
280
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
281 ;; used by describe-key, describe-key-briefly, insert-key-binding, etc.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
282
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
283 (defun key-or-menu-binding (key &optional menu-flag)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
284 "Return the command invoked by KEY.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
285 Like `key-binding', but handles menu events and toolbar presses correctly.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
286 KEY is any value returned by `next-command-event'.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
287 MENU-FLAG is a symbol that should be set to T if KEY is a menu event,
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
288 or NIL otherwise"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
289 (let (defn)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
290 (and menu-flag (set menu-flag nil))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
291 ;; If the key typed was really a menu selection, grab the form out
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
292 ;; of the event object and intuit the function that would be called,
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
293 ;; and describe that instead.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
294 (if (and (vectorp key) (= 1 (length key))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
295 (or (misc-user-event-p (aref key 0))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
296 (eq (car-safe (aref key 0)) 'menu-selection)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
297 (let ((event (aref key 0)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
298 (setq defn (if (eventp event)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
299 (list (event-function event) (event-object event))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
300 (cdr event)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
301 (and menu-flag (set menu-flag t))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
302 (when (eq (car defn) 'eval)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
303 (setq defn (car (cdr defn))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
304 (when (eq (car-safe defn) 'call-interactively)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
305 (setq defn (car (cdr defn))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
306 (when (and (consp defn) (null (cdr defn)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
307 (setq defn (car defn))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
308 ;; else
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
309 (setq defn (key-binding key)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
310 ;; kludge: if a toolbar button was pressed on, try to find the
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
311 ;; binding of the toolbar button.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
312 (if (and (eq defn 'press-toolbar-button)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
313 (vectorp key)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
314 (button-press-event-p (aref key (1- (length key)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
315 ;; wait for the button release. We're on shaky ground here ...
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
316 (let ((event (next-command-event))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
317 button)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
318 (if (and (button-release-event-p event)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
319 (event-over-toolbar-p event)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
320 (eq 'release-and-activate-toolbar-button
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
321 (key-binding (vector event)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
322 (setq button (event-toolbar-button event)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
323 (toolbar-button-callback button)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
324 ;; if anything went wrong, try returning the binding of
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
325 ;; the button-up event, of the original binding
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
326 (or (key-or-menu-binding (vector event))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
327 defn)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
328 ;; no toolbar kludge
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
329 defn)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
330 ))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
331
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
332 (defun describe-key-briefly (key)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
333 "Print the name of the function KEY invokes. KEY is a string."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
334 (interactive "kDescribe key briefly: ")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
335 (let (defn menup)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
336 (setq defn (key-or-menu-binding key 'menup))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
337 (if (or (null defn) (integerp defn))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
338 (message "%s is undefined" (key-description key))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
339 ;; If it's a keyboard macro which trivially invokes another command,
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
340 ;; document that instead.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
341 (if (or (stringp defn) (vectorp defn))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
342 (setq defn (or (key-binding defn)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
343 defn)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
344 (let ((last-event (and (vectorp key)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
345 (aref key (1- (length key))))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
346 (message (if (or (button-press-event-p last-event)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
347 (button-release-event-p last-event))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
348 (gettext "%s at that spot runs the command %s")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
349 (gettext "%s runs the command %s"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
350 ;; This used to say 'This menu item' but it could also
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
351 ;; be a scrollbar event. We can't distinguish at the
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
352 ;; moment.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
353 (if menup "This item" (key-description key))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
354 (if (symbolp defn) defn (prin1-to-string defn)))))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
355
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
356 ;; #### this is a horrible piece of shit function that should
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
357 ;; not exist. In FSF 19.30 this function has gotten three times
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
358 ;; as long and has tons and tons of dumb shit checking
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
359 ;; special-display-buffer-names and such crap. I absolutely
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
360 ;; refuse to insert that Ebolification here. I wanted to delete
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
361 ;; this function entirely but Mly bitched.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
362 ;;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
363 ;; If your user-land code calls this function, rewrite it to
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
364 ;; call with-displaying-help-buffer.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
365
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
366 (defun print-help-return-message (&optional function)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
367 "Display or return message saying how to restore windows after help command.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
368 Computes a message and applies the optional argument FUNCTION to it.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
369 If FUNCTION is nil, applies `message' to it, thus printing it."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
370 (and (not (get-buffer-window standard-output))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
371 (funcall
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
372 (or function 'message)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
373 (concat
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
374 (substitute-command-keys
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
375 (if (one-window-p t)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
376 (if pop-up-windows
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
377 (gettext "Type \\[delete-other-windows] to remove help window.")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
378 (gettext "Type \\[switch-to-buffer] RET to remove help window."))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
379 (gettext "Type \\[switch-to-buffer-other-window] RET to restore the other window.")))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
380 (substitute-command-keys
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
381 (gettext " \\[scroll-other-window] to scroll the help."))))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
382
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
383 (defcustom help-selects-help-window t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
384 "*If nil, use the \"old Emacs\" behavior for Help buffers.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
385 This just displays the buffer in another window, rather than selecting
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
386 the window."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
387 :type 'boolean
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
388 :group 'help-appearance)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
389
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
390 ;; Use this function for displaying help when C-h something is pressed
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
391 ;; or in similar situations. Do *not* use it when you are displaying
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
392 ;; a help message and then prompting for input in the minibuffer --
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
393 ;; this macro usually selects the help buffer, which is not what you
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
394 ;; want in those situations.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
395
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
396 ;;; ### Should really be a macro (as suggested above) to eliminate the
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
397 ;;; requirement of caller to code a lambda form in THUNK -- mrb
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
398 (defun with-displaying-help-buffer (thunk)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
399 (let ((winconfig (current-window-configuration))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
400 (was-one-window (one-window-p))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
401 (help-not-visible
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
402 (not (and (windows-of-buffer "*Help*") ;shortcut
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
403 (member (selected-frame)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
404 (mapcar 'window-frame
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
405 (windows-of-buffer "*Help*")))))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
406 (prog1 (with-output-to-temp-buffer "*Help*"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
407 (prog1 (funcall thunk)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
408 (save-excursion
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
409 (set-buffer standard-output)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
410 (help-mode))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
411 (let ((helpwin (get-buffer-window "*Help*")))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
412 (when helpwin
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
413 (with-current-buffer (window-buffer helpwin)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
414 ;; If the *Help* buffer is already displayed on this
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
415 ;; frame, don't override the previous configuration
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
416 (when help-not-visible
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
417 (set-frame-property (selected-frame)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
418 'help-window-config winconfig)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
419 (when help-selects-help-window
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
420 (select-window helpwin))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
421 (cond ((eq helpwin (selected-window))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
422 (display-message 'command
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
423 (substitute-command-keys "Type \\[help-mode-quit] to remove help window, \\[scroll-up] to scroll the help.")))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
424 (was-one-window
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
425 (display-message 'command
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
426 (substitute-command-keys "Type \\[delete-other-windows] to remove help window, \\[scroll-other-window] to scroll the help.")))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
427 (t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
428 (display-message 'command
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
429 (substitute-command-keys "Type \\[switch-to-buffer-other-window] to restore the other window, \\[scroll-other-window] to scroll the help.")))))))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
430
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
431 (defun describe-key (key)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
432 "Display documentation of the function invoked by KEY.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
433 KEY is a string, or vector of events.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
434 When called interactively, KEY may also be a menu selection."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
435 (interactive "kDescribe key: ")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
436 (let ((defn (key-or-menu-binding key)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
437 (if (or (null defn) (integerp defn))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
438 (message "%s is undefined" (key-description key))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
439 (with-displaying-help-buffer
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
440 (lambda ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
441 (princ (key-description key))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
442 (princ " runs ")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
443 (if (symbolp defn) (princ (format "`%S'" defn))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
444 (prin1 defn))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
445 (princ "\n\n")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
446 (cond ((or (stringp defn) (vectorp defn))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
447 (let ((cmd (key-binding defn)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
448 (if (not cmd)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
449 (princ "a keyboard macro")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
450 (progn
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
451 (princ "a keyboard macro which runs the command ")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
452 (prin1 cmd)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
453 (princ ":\n\n")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
454 (if (documentation cmd) (princ (documentation cmd)))))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
455 ((and (consp defn) (not (eq 'lambda (car-safe defn))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
456 (let ((describe-function-show-arglist nil))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
457 (describe-function-1 (car defn) standard-output)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
458 ((symbolp defn)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
459 (describe-function-1 defn standard-output))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
460 ((documentation defn)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
461 (princ (documentation defn)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
462 (t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
463 (princ "not documented"))))))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
464
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
465 (defun describe-mode ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
466 "Display documentation of current major mode and minor modes.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
467 For this to work correctly for a minor mode, the mode's indicator variable
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
468 \(listed in `minor-mode-alist') must also be a function whose documentation
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
469 describes the minor mode."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
470 (interactive)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
471 (with-displaying-help-buffer
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
472 (lambda ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
473 ;; XEmacs change: print the major-mode documentation before
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
474 ;; the minor modes.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
475 (princ mode-name)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
476 (princ " mode:\n")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
477 (princ (documentation major-mode))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
478 (princ "\n\n----\n\n")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
479 (let ((minor-modes minor-mode-alist))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
480 (while minor-modes
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
481 (let* ((minor-mode (car (car minor-modes)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
482 (indicator (car (cdr (car minor-modes)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
483 ;; Document a minor mode if it is listed in minor-mode-alist,
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
484 ;; bound locally in this buffer, non-nil, and has a function
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
485 ;; definition.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
486 (if (and (boundp minor-mode)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
487 (symbol-value minor-mode)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
488 (fboundp minor-mode))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
489 (let ((pretty-minor-mode minor-mode))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
490 (if (string-match "-mode\\'" (symbol-name minor-mode))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
491 (setq pretty-minor-mode
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
492 (capitalize
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
493 (substring (symbol-name minor-mode)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
494 0 (match-beginning 0)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
495 (while (and (consp indicator) (extentp (car indicator)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
496 (setq indicator (cdr indicator)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
497 (while (and indicator (symbolp indicator))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
498 (setq indicator (symbol-value indicator)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
499 (princ (format "%s minor mode (indicator%s):\n"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
500 pretty-minor-mode indicator))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
501 (princ (documentation minor-mode))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
502 (princ "\n\n----\n\n"))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
503 (setq minor-modes (cdr minor-modes)))))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
504
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
505 ;; So keyboard macro definitions are documented correctly
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
506 (fset 'defining-kbd-macro (symbol-function 'start-kbd-macro))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
507
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
508 (defun describe-distribution ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
509 "Display info on how to obtain the latest version of XEmacs."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
510 (interactive)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
511 (find-file-read-only
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
512 (expand-file-name "DISTRIB" data-directory)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
513
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
514 (defun describe-beta ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
515 "Display info on how to deal with Beta versions of XEmacs."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
516 (interactive)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
517 (find-file-read-only
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
518 (expand-file-name "BETA" data-directory))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
519 (goto-char (point-min)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
520
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
521 (defun describe-copying ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
522 "Display info on how you may redistribute copies of XEmacs."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
523 (interactive)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
524 (find-file-read-only
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
525 (expand-file-name "COPYING" data-directory))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
526 (goto-char (point-min)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
527
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
528 (defun describe-pointer ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
529 "Show a list of all defined mouse buttons, and their definitions."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
530 (interactive)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
531 (describe-bindings nil t))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
532
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
533 (defun describe-project ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
534 "Display info on the GNU project."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
535 (interactive)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
536 (find-file-read-only
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
537 (expand-file-name "GNU" data-directory))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
538 (goto-char (point-min)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
539
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
540 (defun describe-no-warranty ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
541 "Display info on all the kinds of warranty XEmacs does NOT have."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
542 (interactive)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
543 (describe-copying)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
544 (let (case-fold-search)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
545 (search-forward "NO WARRANTY")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
546 (recenter 0)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
547
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
548 (defun describe-bindings (&optional prefix mouse-only-p)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
549 "Show a list of all defined keys, and their definitions.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
550 The list is put in a buffer, which is displayed.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
551 If the optional argument PREFIX is supplied, only commands which
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
552 start with that sequence of keys are described.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
553 If the second argument (prefix arg, interactively) is non-null
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
554 then only the mouse bindings are displayed."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
555 (interactive (list nil current-prefix-arg))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
556 (with-displaying-help-buffer
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
557 (lambda ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
558 (describe-bindings-1 prefix mouse-only-p))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
559
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
560 (defun describe-bindings-1 (&optional prefix mouse-only-p)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
561 (let ((heading (if mouse-only-p
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
562 (gettext "button binding\n------ -------\n")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
563 (gettext "key binding\n--- -------\n")))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
564 (buffer (current-buffer))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
565 (minor minor-mode-map-alist)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
566 (local (current-local-map))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
567 (shadow '()))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
568 (set-buffer standard-output)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
569 (while minor
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
570 (let ((sym (car (car minor)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
571 (map (cdr (car minor))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
572 (if (symbol-value-in-buffer sym buffer nil)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
573 (progn
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
574 (insert (format "Minor Mode Bindings for `%s':\n"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
575 sym)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
576 heading)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
577 (describe-bindings-internal map nil shadow prefix mouse-only-p)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
578 (insert "\n")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
579 (setq shadow (cons map shadow))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
580 (setq minor (cdr minor))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
581 (if local
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
582 (progn
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
583 (insert "Local Bindings:\n" heading)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
584 (describe-bindings-internal local nil shadow prefix mouse-only-p)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
585 (insert "\n")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
586 (setq shadow (cons local shadow))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
587 (insert "Global Bindings:\n" heading)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
588 (describe-bindings-internal (current-global-map)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
589 nil shadow prefix mouse-only-p)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
590 (when (and prefix function-key-map (not mouse-only-p))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
591 (insert "\nFunction key map translations:\n" heading)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
592 (describe-bindings-internal function-key-map nil nil prefix mouse-only-p))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
593 (set-buffer buffer)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
594
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
595 (defun describe-prefix-bindings ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
596 "Describe the bindings of the prefix used to reach this command.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
597 The prefix described consists of all but the last event
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
598 of the key sequence that ran this command."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
599 (interactive)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
600 (let* ((key (this-command-keys))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
601 (prefix (make-vector (1- (length key)) nil))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
602 i)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
603 (setq i 0)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
604 (while (< i (length prefix))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
605 (aset prefix i (aref key i))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
606 (setq i (1+ i)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
607 (with-displaying-help-buffer
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
608 (lambda ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
609 (princ "Key bindings starting with ")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
610 (princ (key-description prefix))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
611 (princ ":\n\n")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
612 (describe-bindings-1 prefix nil)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
613
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
614 ;; Make C-h after a prefix, when not specifically bound,
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
615 ;; run describe-prefix-bindings.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
616 (setq prefix-help-command 'describe-prefix-bindings)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
617
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
618 (defun view-emacs-news ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
619 "Display info on recent changes to XEmacs."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
620 (interactive)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
621 #-infodock (require 'outl-mouse)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
622 (find-file (expand-file-name "NEWS" data-directory)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
623
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
624 (defun xemacs-www-page ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
625 "Go to the XEmacs World Wide Web page."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
626 (interactive)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
627 (funcall browse-url-browser-function "http://www.xemacs.org/"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
628
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
629 (defun xemacs-www-faq ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
630 "View the latest and greatest XEmacs FAQ using the World Wide Web."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
631 (interactive)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
632 (funcall browse-url-browser-function "http://www.xemacs.org/faq/index.html"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
633
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
634 (defun xemacs-local-faq ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
635 "View the local copy of the XEmacs FAQ.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
636 If you have access to the World Wide Web, you should use `xemacs-www-faq'
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
637 instead, to ensure that you get the most up-to-date information."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
638 (interactive)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
639 (save-window-excursion
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
640 (info)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
641 (Info-find-node "xemacs-faq" "Top"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
642 (switch-to-buffer "*info*"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
643
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
644 (defcustom view-lossage-key-count 100
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
645 "*Number of keys `view-lossage' shows.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
646 The maximum number of available keys is governed by `recent-keys-ring-size'."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
647 :type 'integer
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
648 :group 'help)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
649
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
650 (defcustom view-lossage-message-count 100
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
651 "*Number of minibuffer messages `view-lossage' shows."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
652 :type 'integer
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
653 :group 'help)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
654
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
655 (defun view-lossage ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
656 "Display recent input keystrokes and recent minibuffer messages.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
657 The number of keys shown is controlled by `view-lossage-key-count'.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
658 The number of messages shown is controlled by `view-lossage-message-count'."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
659 (interactive)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
660 (with-displaying-help-buffer
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
661 (lambda ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
662 (princ (key-description (recent-keys view-lossage-key-count)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
663 (save-excursion
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
664 (set-buffer standard-output)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
665 (goto-char (point-min))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
666 (insert "Recent keystrokes:\n\n")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
667 (while (progn (move-to-column 50) (not (eobp)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
668 (search-forward " " nil t)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
669 (insert "\n")))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
670 ;; XEmacs addition
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
671 (princ "\n\n\nRecent minibuffer messages (most recent first):\n\n")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
672 (save-excursion
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
673 (let ((buffer (get-buffer " *Message-Log*"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
674 (count 0)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
675 oldpoint)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
676 (set-buffer buffer)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
677 (goto-char (point-max))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
678 (set-buffer standard-output)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
679 (while (and (> (point buffer) (point-min buffer))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
680 (< count view-lossage-message-count))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
681 (setq oldpoint (point buffer))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
682 (forward-line -1 buffer)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
683 (insert-buffer-substring buffer (point buffer) oldpoint)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
684 (setq count (1+ count))))))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
685
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
686 (define-function 'help 'help-for-help)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
687 ;; #### FSF calls `make-help-screen' here. We need to port `help-macro.el'.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
688 (defun help-for-help ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
689 "You have typed \\[help-for-help], the help character. Type a Help option:
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
690 \(Use SPC or DEL to scroll through this text. Type \\<help-map>\\[help-quit] to exit the Help command.)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
691
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
692 \\[hyper-apropos] Type a substring; it shows a hypertext list of
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
693 functions and variables that contain that substring.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
694 See also the `apropos' command.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
695 \\[command-apropos] Type a substring; it shows a list of commands
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
696 (interactively callable functions) that contain that substring.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
697 \\[describe-bindings] Table of all key bindings.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
698 \\[describe-key-briefly] Type a command key sequence;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
699 it displays the function name that sequence runs.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
700 \\[Info-goto-emacs-command-node] Type a function name; it displays the Info node for that command.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
701 \\[describe-function] Type a function name; it shows its documentation.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
702 \\[Info-elisp-ref] Type a function name; it jumps to the full documentation
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
703 in the XEmacs Lisp Programmer's Manual.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
704 \\[xemacs-local-faq] Local copy of the XEmacs FAQ.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
705 \\[info] Info documentation reader.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
706 \\[Info-query] Type an Info file name; it displays it in Info reader.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
707 \\[describe-key] Type a command key sequence;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
708 it displays the documentation for the command bound to that key.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
709 \\[Info-goto-emacs-key-command-node] Type a command key sequence;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
710 it displays the Info node for the command bound to that key.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
711 \\[view-lossage] Recent input keystrokes and minibuffer messages.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
712 \\[describe-mode] Documentation of current major and minor modes.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
713 \\[view-emacs-news] News of recent XEmacs changes.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
714 \\[finder-by-keyword] Type a topic keyword; it finds matching packages.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
715 \\[describe-pointer] Table of all mouse-button bindings.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
716 \\[describe-syntax] Contents of syntax table with explanations.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
717 \\[help-with-tutorial] XEmacs learn-by-doing tutorial.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
718 \\[describe-variable] Type a variable name; it displays its documentation and value.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
719 \\[where-is] Type a command name; it displays which keystrokes invoke that command.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
720 \\[describe-distribution] XEmacs ordering information.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
721 \\[describe-no-warranty] Information on absence of warranty for XEmacs.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
722 \\[describe-copying] XEmacs copying permission (General Public License)."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
723 (interactive)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
724 (let ((help-key (copy-event last-command-event))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
725 event char)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
726 (message (gettext "A B C F I K L M N P S T V W C-c C-d C-n C-w. Type %s again for more help: ")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
727 ;; arrgh, no room for "C-i C-k C-f" !!
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
728 (single-key-description help-key))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
729 (setq event (next-command-event)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
730 char (event-to-character event))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
731 (if (or (equal event help-key)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
732 (eq char ??)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
733 (eq 'help-command (key-binding event)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
734 (save-window-excursion
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
735 (switch-to-buffer "*Help*")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
736 ;; #### I18N3 should mark buffer as output-translating
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
737 (delete-other-windows)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
738 (let ((buffer-read-only nil))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
739 (erase-buffer)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
740 (insert (documentation 'help-for-help)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
741 (goto-char (point-min))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
742 (while (or (equal event help-key)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
743 (eq char ??)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
744 (eq 'help-command (key-binding event))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
745 (eq char ?\ )
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
746 (eq 'scroll-up (key-binding event))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
747 (eq char ?\177)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
748 (and (not (eq char ?b))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
749 (eq 'scroll-down (key-binding event))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
750 (if (or (eq char ?\ )
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
751 (eq 'scroll-up (key-binding event)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
752 (scroll-up))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
753 (if (or (eq char ?\177)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
754 (and (not (eq char ?b))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
755 (eq 'scroll-down (key-binding event))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
756 (scroll-down))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
757 ;; write this way for I18N3 snarfing
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
758 (if (pos-visible-in-window-p (point-max))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
759 (message "A B C F I K L M N P S T V W C-c C-d C-n C-w C-i C-k C-f: ")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
760 (message "A B C F I K L M N P S T V W C-c C-d C-n C-w C-i C-k C-f or Space to scroll: "))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
761 (let ((cursor-in-echo-area t))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
762 (setq event (next-command-event event)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
763 char (or (event-to-character event) event))))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
764 (let ((defn (or (lookup-key help-map (vector event))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
765 (and (numberp char)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
766 (lookup-key help-map (make-string 1 (downcase char)))))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
767 (message nil)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
768 (if defn
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
769 (call-interactively defn)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
770 (ding)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
771
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
772 (defun function-called-at-point ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
773 "Return the function which is called by the list containing point.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
774 If that gives no function, return the function whose name is around point.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
775 If that doesn't give a function, return nil."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
776 (or (condition-case ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
777 (save-excursion
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
778 (save-restriction
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
779 (narrow-to-region (max (point-min) (- (point) 1000)) (point-max))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
780 (backward-up-list 1)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
781 (forward-char 1)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
782 (let (obj)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
783 (setq obj (read (current-buffer)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
784 (and (symbolp obj) (fboundp obj) obj))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
785 (error nil))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
786 (condition-case ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
787 (let ((stab (syntax-table)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
788 (unwind-protect
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
789 (save-excursion
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
790 (set-syntax-table emacs-lisp-mode-syntax-table)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
791 (or (not (zerop (skip-syntax-backward "_w")))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
792 (eq (char-syntax (char-after (point))) ?w)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
793 (eq (char-syntax (char-after (point))) ?_)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
794 (forward-sexp -1))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
795 (skip-chars-forward "`'")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
796 (let ((obj (read (current-buffer))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
797 (and (symbolp obj) (fboundp obj) obj)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
798 (set-syntax-table stab)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
799 (error nil))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
800
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
801 (defun function-at-point ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
802 "Return the function whose name is around point.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
803 If that gives no function, return the function which is called by the
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
804 list containing point. If that doesn't give a function, return nil."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
805 (or (condition-case ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
806 (let ((stab (syntax-table)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
807 (unwind-protect
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
808 (save-excursion
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
809 (set-syntax-table emacs-lisp-mode-syntax-table)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
810 (or (not (zerop (skip-syntax-backward "_w")))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
811 (eq (char-syntax (char-after (point))) ?w)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
812 (eq (char-syntax (char-after (point))) ?_)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
813 (forward-sexp -1))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
814 (skip-chars-forward "`'")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
815 (let ((obj (read (current-buffer))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
816 (and (symbolp obj) (fboundp obj) obj)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
817 (set-syntax-table stab)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
818 (error nil))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
819 (condition-case ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
820 (save-excursion
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
821 (save-restriction
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
822 (narrow-to-region (max (point-min) (- (point) 1000))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
823 (point-max))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
824 (backward-up-list 1)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
825 (forward-char 1)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
826 (let (obj)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
827 (setq obj (read (current-buffer)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
828 (and (symbolp obj) (fboundp obj) obj))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
829 (error nil))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
830
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
831 ;; Default to nil for the non-hackers? Not until we find a way to
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
832 ;; distinguish hackers from non-hackers automatically!
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
833 (defcustom describe-function-show-arglist t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
834 "*If non-nil, describe-function will show its arglist,
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
835 unless the function is autoloaded."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
836 :type 'boolean
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
837 :group 'help-appearance)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
838
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
839 (defun describe-function-find-file (function)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
840 (let ((files load-history)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
841 file)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
842 (while files
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
843 (if (memq function (cdr (car files)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
844 (setq file (car (car files))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
845 files nil))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
846 (setq files (cdr files)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
847 file))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
848
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
849 (defun describe-function (function)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
850 "Display the full documentation of FUNCTION (a symbol).
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
851 When run interactively, it defaults to any function found by
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
852 `function-at-point'."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
853 (interactive
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
854 (let* ((fn (function-at-point))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
855 (val (let ((enable-recursive-minibuffers t))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
856 (completing-read
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
857 (if fn
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
858 (format (gettext "Describe function (default %s): ")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
859 fn)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
860 (gettext "Describe function: "))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
861 obarray 'fboundp t nil 'function-history))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
862 (list (if (equal val "") fn (intern val)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
863 (with-displaying-help-buffer
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
864 (lambda ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
865 (describe-function-1 function standard-output)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
866 ;; Return the text we displayed.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
867 (buffer-string nil nil standard-output))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
868
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
869 (defun function-obsolete-p (function)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
870 "Return non-nil if FUNCTION is obsolete."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
871 (not (null (get function 'byte-obsolete-info))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
872
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
873 (defun function-obsoleteness-doc (function)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
874 "If FUNCTION is obsolete, return a string describing this."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
875 (let ((obsolete (get function 'byte-obsolete-info)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
876 (if obsolete
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
877 (format "Obsolete; %s"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
878 (if (stringp (car obsolete))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
879 (car obsolete)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
880 (format "use `%s' instead." (car obsolete)))))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
881
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
882 (defun function-compatible-p (function)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
883 "Return non-nil if FUNCTION is present for Emacs compatibility."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
884 (not (null (get function 'byte-compatible-info))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
885
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
886 (defun function-compatibility-doc (function)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
887 "If FUNCTION is Emacs compatible, return a string describing this."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
888 (let ((compatible (get function 'byte-compatible-info)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
889 (if compatible
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
890 (format "Emacs Compatible; %s"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
891 (if (stringp (car compatible))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
892 (car compatible)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
893 (format "use `%s' instead." (car compatible)))))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
894
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
895 ;Here are all the possibilities below spelled out, for the benefit
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
896 ;of the I18N3 snarfer.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
897 ;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
898 ;(gettext "a built-in function")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
899 ;(gettext "an interactive built-in function")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
900 ;(gettext "a built-in macro")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
901 ;(gettext "an interactive built-in macro")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
902 ;(gettext "a compiled Lisp function")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
903 ;(gettext "an interactive compiled Lisp function")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
904 ;(gettext "a compiled Lisp macro")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
905 ;(gettext "an interactive compiled Lisp macro")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
906 ;(gettext "a Lisp function")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
907 ;(gettext "an interactive Lisp function")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
908 ;(gettext "a Lisp macro")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
909 ;(gettext "an interactive Lisp macro")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
910 ;(gettext "a mocklisp function")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
911 ;(gettext "an interactive mocklisp function")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
912 ;(gettext "a mocklisp macro")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
913 ;(gettext "an interactive mocklisp macro")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
914 ;(gettext "an autoloaded Lisp function")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
915 ;(gettext "an interactive autoloaded Lisp function")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
916 ;(gettext "an autoloaded Lisp macro")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
917 ;(gettext "an interactive autoloaded Lisp macro")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
918
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
919 (defun describe-function-1 (function stream &optional nodoc)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
920 (princ (format "`%S' is " function) stream)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
921 (let* ((def function)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
922 (doc (condition-case nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
923 (or (documentation function)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
924 (gettext "not documented"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
925 (void-function "")))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
926 aliases file-name autoload-file kbd-macro-p fndef macrop)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
927 (while (and (symbolp def) (fboundp def))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
928 (when (not (eq def function))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
929 (setq aliases
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
930 (if aliases
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
931 ;; I18N3 Need gettext due to concat
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
932 (concat aliases
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
933 (format
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
934 "\n which is an alias for `%s', "
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
935 (symbol-name def)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
936 (format "an alias for `%s', " (symbol-name def)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
937 (setq def (symbol-function def)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
938 (if (compiled-function-p def)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
939 (setq file-name (compiled-function-annotation def)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
940 (if (eq 'macro (car-safe def))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
941 (setq fndef (cdr def)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
942 file-name (and (compiled-function-p (cdr def))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
943 (compiled-function-annotation (cdr def)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
944 macrop t)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
945 (setq fndef def))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
946 (if aliases (princ aliases stream))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
947 (let ((int #'(lambda (string an-p macro-p)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
948 (princ (format
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
949 (gettext (concat
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
950 (cond ((commandp def)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
951 "an interactive ")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
952 (an-p "an ")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
953 (t "a "))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
954 "%s"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
955 (if macro-p " macro" " function")))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
956 string)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
957 stream))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
958 (cond ((or (stringp def) (vectorp def))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
959 (princ "a keyboard macro." stream)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
960 (setq kbd-macro-p t))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
961 ((subrp fndef)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
962 (funcall int "built-in" nil macrop))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
963 ((compiled-function-p fndef)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
964 (funcall int "compiled Lisp" nil macrop))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
965 ; XEmacs -- we handle aliases above.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
966 ; ((symbolp fndef)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
967 ; (princ (format "alias for `%s'"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
968 ; (prin1-to-string def)) stream))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
969 ((eq (car-safe fndef) 'lambda)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
970 (funcall int "Lisp" nil macrop))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
971 ((eq (car-safe fndef) 'mocklisp)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
972 (funcall int "mocklisp" nil macrop))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
973 ((eq (car-safe def) 'autoload)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
974 (setq autoload-file (elt def 1))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
975 (funcall int "autoloaded Lisp" t (elt def 4)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
976 ((and (symbolp def) (not (fboundp def)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
977 (princ "a symbol with a void (unbound) function definition." stream))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
978 (t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
979 nil)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
980 (princ "\n")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
981 (if autoload-file
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
982 (princ (format " -- autoloads from \"%s\"\n" autoload-file) stream))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
983 (or file-name
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
984 (setq file-name (describe-function-find-file function)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
985 (if file-name
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
986 (princ (format " -- loaded from \"%s\"\n" file-name)) stream)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
987 ;; (terpri stream)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
988 (if describe-function-show-arglist
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
989 (let ((arglist
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
990 (cond ((compiled-function-p fndef)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
991 (compiled-function-arglist fndef))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
992 ((eq (car-safe fndef) 'lambda)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
993 (nth 1 fndef))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
994 ((and (subrp fndef)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
995 (string-match
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
996 "[\n\t ]*\narguments: ?(\\(.*\\))\n?\\'"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
997 doc))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
998 (prog1
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
999 (substring doc (match-beginning 1) (match-end 1))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1000 (setq doc (substring doc 0 (match-beginning 0)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1001 (t t))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1002 (if (listp arglist)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1003 (progn
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1004 ;; (princ " ")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1005 (princ (cons function
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1006 (mapcar (lambda (arg)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1007 (if (memq arg '(&optional &rest))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1008 arg
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1009 (intern (upcase (symbol-name arg)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1010 arglist)) stream)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1011 (terpri stream)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1012 (if (stringp arglist)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1013 (princ (format "(%s %s)\n" function arglist) stream))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1014 (terpri stream)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1015 (cond (kbd-macro-p
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1016 (princ "These characters are executed:\n\n\t" stream)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1017 (princ (key-description def) stream)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1018 (cond ((setq def (key-binding def))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1019 (princ (format "\n\nwhich executes the command %S.\n\n" def) stream)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1020 (describe-function-1 def stream))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1021 (nodoc nil)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1022 (t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1023 ;; tell the user about obsoleteness.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1024 ;; If the function is obsolete and is aliased, don't
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1025 ;; even bother to report the documentation, as a further
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1026 ;; encouragement to use the new function.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1027 (let ((obsolete (function-obsoleteness-doc function))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1028 (compatible (function-compatibility-doc function)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1029 (when obsolete
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1030 (princ obsolete stream)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1031 (terpri stream)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1032 (terpri stream))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1033 (when compatible
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1034 (princ compatible stream)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1035 (terpri stream)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1036 (terpri stream))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1037 (unless (and obsolete aliases)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1038 (princ doc stream)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1039 (unless (or (equal doc "")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1040 (eq ?\n (aref doc (1- (length doc)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1041 (terpri stream))))))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1042
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1043
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1044 ;;; ## this doesn't seem to be used for anything
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1045 ;; (defun describe-function-arglist (function)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1046 ;; (interactive (list (or (function-at-point)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1047 ;; (error "no function call at point"))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1048 ;; (let ((b nil))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1049 ;; (unwind-protect
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1050 ;; (save-excursion
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1051 ;; (set-buffer (setq b (get-buffer-create " *arglist*")))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1052 ;; (buffer-disable-undo b)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1053 ;; (erase-buffer)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1054 ;; (describe-function-1 function b t)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1055 ;; (goto-char (point-min))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1056 ;; (end-of-line)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1057 ;; (or (eobp) (delete-char 1))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1058 ;; (just-one-space)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1059 ;; (end-of-line)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1060 ;; (message (buffer-substring (point-min) (point))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1061 ;; (and b (kill-buffer b)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1062
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1063
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1064 (defun variable-at-point ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1065 (ignore-errors
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1066 (let ((stab (syntax-table)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1067 (unwind-protect
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1068 (save-excursion
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1069 (set-syntax-table emacs-lisp-mode-syntax-table)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1070 (or (not (zerop (skip-syntax-backward "_w")))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1071 (eq (char-syntax (char-after (point))) ?w)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1072 (eq (char-syntax (char-after (point))) ?_)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1073 (forward-sexp -1))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1074 (skip-chars-forward "'")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1075 (let ((obj (read (current-buffer))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1076 (and (symbolp obj) (boundp obj) obj)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1077 (set-syntax-table stab)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1078
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1079 (defun variable-obsolete-p (variable)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1080 "Return non-nil if VARIABLE is obsolete."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1081 (not (null (get variable 'byte-obsolete-variable))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1082
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1083 (defun variable-obsoleteness-doc (variable)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1084 "If VARIABLE is obsolete, return a string describing this."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1085 (let ((obsolete (get variable 'byte-obsolete-variable)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1086 (if obsolete
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1087 (format "Obsolete; %s"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1088 (if (stringp obsolete)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1089 obsolete
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1090 (format "use `%s' instead." obsolete))))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1091
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1092 (defun variable-compatible-p (variable)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1093 "Return non-nil if VARIABLE is Emacs compatible."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1094 (not (null (get variable 'byte-compatible-variable))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1095
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1096 (defun variable-compatibility-doc (variable)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1097 "If VARIABLE is Emacs compatible, return a string describing this."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1098 (let ((compatible (get variable 'byte-compatible-variable)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1099 (if compatible
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1100 (format "Emacs Compatible; %s"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1101 (if (stringp compatible)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1102 compatible
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1103 (format "use `%s' instead." compatible))))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1104
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1105 (defun built-in-variable-doc (variable)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1106 "Return a string describing whether VARIABLE is built-in."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1107 (let ((type (built-in-variable-type variable)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1108 (case type
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1109 (integer "a built-in integer variable")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1110 (const-integer "a built-in constant integer variable")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1111 (boolean "a built-in boolean variable")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1112 (const-boolean "a built-in constant boolean variable")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1113 (object "a simple built-in variable")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1114 (const-object "a simple built-in constant variable")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1115 (const-specifier "a built-in constant specifier variable")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1116 (current-buffer "a built-in buffer-local variable")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1117 (const-current-buffer "a built-in constant buffer-local variable")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1118 (default-buffer "a built-in default buffer-local variable")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1119 (selected-console "a built-in console-local variable")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1120 (const-selected-console "a built-in constant console-local variable")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1121 (default-console "a built-in default console-local variable")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1122 (t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1123 (if type "an unknown type of built-in variable?"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1124 "a variable declared in Lisp")))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1125
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1126 (defun describe-variable (variable)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1127 "Display the full documentation of VARIABLE (a symbol)."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1128 (interactive
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1129 (let* ((v (variable-at-point))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1130 (val (let ((enable-recursive-minibuffers t))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1131 (completing-read
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1132 (if v
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1133 (format "Describe variable (default %s): " v)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1134 (gettext "Describe variable: "))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1135 obarray 'boundp t nil 'variable-history))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1136 (list (if (equal val "") v (intern val)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1137 (with-displaying-help-buffer
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1138 (lambda ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1139 (let ((origvar variable)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1140 aliases)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1141 (let ((print-escape-newlines t))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1142 (princ (format "`%s' is " (symbol-name variable)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1143 (while (variable-alias variable)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1144 (let ((newvar (variable-alias variable)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1145 (if aliases
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1146 ;; I18N3 Need gettext due to concat
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1147 (setq aliases
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1148 (concat aliases
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1149 (format "\n which is an alias for `%s',"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1150 (symbol-name newvar))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1151 (setq aliases
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1152 (format "an alias for `%s',"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1153 (symbol-name newvar))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1154 (setq variable newvar)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1155 (if aliases
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1156 (princ (format "%s" aliases)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1157 (princ (built-in-variable-doc variable))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1158 (princ ".\n\n")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1159 (princ "Value: ")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1160 (if (not (boundp variable))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1161 (princ "void")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1162 (prin1 (symbol-value variable)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1163 (terpri)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1164 (cond ((local-variable-p variable (current-buffer))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1165 (let* ((void (cons nil nil))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1166 (def (condition-case nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1167 (default-value variable)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1168 (error void))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1169 (princ "This value is specific to the current buffer.")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1170 (terpri)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1171 (if (local-variable-p variable nil)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1172 (progn
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1173 (princ "(Its value is local to each buffer.)")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1174 (terpri)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1175 (if (if (eq def void)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1176 (boundp variable)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1177 (not (eq (symbol-value variable) def)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1178 ;; #### I18N3 doesn't localize properly!
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1179 (progn (princ "Its default-value is ")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1180 (if (eq def void)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1181 (princ "void.")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1182 (prin1 def))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1183 (terpri)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1184 ((local-variable-p variable (current-buffer) t)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1185 (princ "Setting it would make its value buffer-local.\n"))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1186 (terpri)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1187 (princ "Documentation:")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1188 (terpri)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1189 (let ((doc (documentation-property variable 'variable-documentation))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1190 (obsolete (variable-obsoleteness-doc origvar))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1191 (compatible (variable-compatibility-doc origvar)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1192 (when obsolete
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1193 (princ obsolete)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1194 (terpri)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1195 (terpri))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1196 (when compatible
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1197 (princ compatible)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1198 (terpri)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1199 (terpri))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1200 ;; don't bother to print anything if variable is obsolete and aliased.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1201 (when (or (not obsolete) (not aliases))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1202 (if doc
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1203 ;; note: documentation-property calls substitute-command-keys.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1204 (princ doc)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1205 (princ "not documented as a variable."))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1206 (terpri)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1207 ;; Return the text we displayed.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1208 (buffer-string nil nil standard-output)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1210 (defun sorted-key-descriptions (keys &optional separator)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1211 "Sort and separate the key descriptions for KEYS.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1212 The sorting is done by length (shortest bindings first), and the bindings
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1213 are separated with SEPARATOR (\", \" by default)."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1214 (mapconcat 'key-description
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1215 (sort keys #'(lambda (x y)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1216 (< (length x) (length y))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1217 (or separator ", ")))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1218
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1219 (defun where-is (definition)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1220 "Print message listing key sequences that invoke specified command.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1221 Argument is a command definition, usually a symbol with a function definition.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1222 When run interactively, it defaults to any function found by
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1223 `function-at-point'."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1224 (interactive
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1225 (let ((fn (function-at-point))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1226 (enable-recursive-minibuffers t)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1227 val)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1228 (setq val (read-command
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1229 (if fn (format "Where is command (default %s): " fn)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1230 "Where is command: ")))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1231 (list (if (equal (symbol-name val) "")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1232 fn val))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1233 (let ((keys (where-is-internal definition)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1234 (if keys
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1235 (message "%s is on %s" definition (sorted-key-descriptions keys))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1236 (message "%s is not on any keys" definition)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1237 nil)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1238
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1239 ;; `locate-library' moved to "packages.el"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1240
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1241
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1242 ;; Functions ported from C into Lisp in XEmacs
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1243
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1244 (defun describe-syntax ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1245 "Describe the syntax specifications in the syntax table.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1246 The descriptions are inserted in a buffer, which is then displayed."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1247 (interactive)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1248 (with-displaying-help-buffer
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1249 (lambda ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1250 ;; defined in syntax.el
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1251 (describe-syntax-table (syntax-table) standard-output))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1252
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1253 (defun list-processes ()
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1254 "Display a list of all processes.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1255 \(Any processes listed as Exited or Signaled are actually eliminated
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1256 after the listing is made.)"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1257 (interactive)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1258 (with-output-to-temp-buffer "*Process List*"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1259 (set-buffer standard-output)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1260 (buffer-disable-undo standard-output)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1261 (make-local-variable 'truncate-lines)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1262 (setq truncate-lines t)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1263 (let ((stream standard-output))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1264 ;; 00000000001111111111222222222233333333334444444444
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1265 ;; 01234567890123456789012345678901234567890123456789
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1266 ;; rewritten for I18N3. This one should stay rewritten
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1267 ;; so that the dashes will line up properly.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1268 (princ "Proc Status Buffer Tty Command\n---- ------ ------ --- -------\n" stream)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1269 (let ((tail (process-list)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1270 (while tail
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1271 (let* ((p (car tail))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1272 (pid (process-id p))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1273 (s (process-status p)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1274 (setq tail (cdr tail))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1275 (princ (format "%-13s" (process-name p)) stream)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1276 ;(if (and (eq system-type 'vax-vms)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1277 ; (eq s 'signal)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1278 ; (< (process-exit-status p) NSIG))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1279 ; (princ (aref sys_errlist (process-exit-status p)) stream))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1280 (princ s stream)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1281 (if (and (eq s 'exit) (/= (process-exit-status p) 0))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1282 (princ (format " %d" (process-exit-status p)) stream))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1283 (if (memq s '(signal exit closed))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1284 ;; Do delete-exited-processes' work
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1285 (delete-process p))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1286 (indent-to 22 1) ;####
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1287 (let ((b (process-buffer p)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1288 (cond ((not b)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1289 (princ "(none)" stream))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1290 ((not (buffer-name b))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1291 (princ "(killed)" stream))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1292 (t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1293 (princ (buffer-name b) stream))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1294 (indent-to 37 1) ;####
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1295 (let ((tn (process-tty-name p)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1296 (cond ((not tn)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1297 (princ "(none)" stream))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1298 (t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1299 (princ (format "%s" tn) stream))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1300 (indent-to 49 1) ;####
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1301 (if (not (integerp pid))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1302 (progn
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1303 (princ "network stream connection " stream)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1304 (princ (car pid) stream)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1305 (princ "@" stream)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1306 (princ (cdr pid) stream))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1307 (let ((cmd (process-command p)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1308 (while cmd
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1309 (princ (car cmd) stream)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1310 (setq cmd (cdr cmd))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1311 (if cmd (princ " " stream)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1312 (terpri stream)))))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1313
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1314 ;; `find-function' et al moved to "find-func.el"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1315
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1316 ;;; help.el ends here