annotate lisp/help.el @ 231:557eaa0339bf r20-5b14

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