660
|
1 ;;; help.el --- help commands for Emacs
|
|
2
|
55172
|
3 ;; Copyright (C) 1985, 1986, 1993, 1994, 1998, 1999, 2000, 2001, 2002, 2004
|
36277
|
4 ;; Free Software Foundation, Inc.
|
846
|
5
|
807
|
6 ;; Maintainer: FSF
|
811
|
7 ;; Keywords: help, internal
|
807
|
8
|
409
|
9 ;; This file is part of GNU Emacs.
|
|
10
|
|
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
|
|
12 ;; it under the terms of the GNU General Public License as published by
|
807
|
13 ;; the Free Software Foundation; either version 2, or (at your option)
|
409
|
14 ;; any later version.
|
|
15
|
|
16 ;; GNU Emacs is distributed in the hope that it will be useful,
|
|
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
19 ;; GNU General Public License for more details.
|
|
20
|
|
21 ;; You should have received a copy of the GNU General Public License
|
14169
|
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
|
|
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
24 ;; Boston, MA 02111-1307, USA.
|
409
|
25
|
2315
|
26 ;;; Commentary:
|
|
27
|
16391
5d64d742ccbb
(print-help-return-message): Use new functions `special-display-p' and
Erik Naggum <erik@naggum.no>
diff
changeset
|
28 ;; This code implements GNU Emacs' on-line help system, the one invoked by
|
25473
|
29 ;; `M-x help-for-help'.
|
2315
|
30
|
807
|
31 ;;; Code:
|
|
32
|
2312
|
33 ;; Get the macro make-help-screen when this is compiled,
|
|
34 ;; or run interpreted, but not when the compiled code is loaded.
|
2697
|
35 (eval-when-compile (require 'help-macro))
|
39728
|
36
|
|
37 ;; This makes `with-output-to-temp-buffer' buffers use `help-mode'.
|
|
38 (add-hook 'temp-buffer-setup-hook 'help-mode-setup)
|
|
39 (add-hook 'temp-buffer-show-hook 'help-mode-finish)
|
2237
|
40
|
409
|
41 (defvar help-map (make-sparse-keymap)
|
|
42 "Keymap for characters following the Help key.")
|
|
43
|
919
|
44 (define-key global-map (char-to-string help-char) 'help-command)
|
12424
|
45 (define-key global-map [help] 'help-command)
|
|
46 (define-key global-map [f1] 'help-command)
|
409
|
47 (fset 'help-command help-map)
|
|
48
|
919
|
49 (define-key help-map (char-to-string help-char) 'help-for-help)
|
12424
|
50 (define-key help-map [help] 'help-for-help)
|
|
51 (define-key help-map [f1] 'help-for-help)
|
53204
|
52 (define-key help-map "." 'display-local-help)
|
409
|
53 (define-key help-map "?" 'help-for-help)
|
|
54
|
|
55 (define-key help-map "\C-c" 'describe-copying)
|
|
56 (define-key help-map "\C-d" 'describe-distribution)
|
42735
|
57 (define-key help-map "\C-e" 'view-emacs-problems)
|
|
58 (define-key help-map "\C-f" 'view-emacs-FAQ)
|
|
59 (define-key help-map "\C-m" 'view-order-manuals)
|
|
60 (define-key help-map "\C-n" 'view-emacs-news)
|
|
61 (define-key help-map "\C-p" 'describe-project)
|
45070
|
62 (define-key help-map "\C-t" 'view-todo)
|
409
|
63 (define-key help-map "\C-w" 'describe-no-warranty)
|
42735
|
64
|
|
65 ;; This does not fit the pattern, but it is natural given the C-\ command.
|
|
66 (define-key help-map "\C-\\" 'describe-input-method)
|
|
67
|
|
68 (define-key help-map "C" 'describe-coding-system)
|
|
69 (define-key help-map "F" 'Info-goto-emacs-command-node)
|
|
70 (define-key help-map "I" 'describe-input-method)
|
|
71 (define-key help-map "K" 'Info-goto-emacs-key-command-node)
|
|
72 (define-key help-map "L" 'describe-language-environment)
|
|
73 (define-key help-map "S" 'info-lookup-symbol)
|
|
74
|
17200
|
75 (define-key help-map "a" 'apropos-command)
|
409
|
76
|
|
77 (define-key help-map "b" 'describe-bindings)
|
|
78
|
|
79 (define-key help-map "c" 'describe-key-briefly)
|
|
80
|
42735
|
81 (define-key help-map "e" 'view-echo-area-messages)
|
|
82
|
409
|
83 (define-key help-map "f" 'describe-function)
|
|
84
|
42735
|
85 (define-key help-map "h" 'view-hello-file)
|
10923
|
86
|
409
|
87 (define-key help-map "i" 'info)
|
22470
|
88 (define-key help-map "4i" 'info-other-window)
|
42735
|
89
|
|
90 (define-key help-map "k" 'describe-key)
|
409
|
91
|
|
92 (define-key help-map "l" 'view-lossage)
|
|
93
|
|
94 (define-key help-map "m" 'describe-mode)
|
|
95
|
|
96 (define-key help-map "n" 'view-emacs-news)
|
|
97
|
2134
b275e1b50542
Added autoload, binding and menu line for new finder feature (P).
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
98 (define-key help-map "p" 'finder-by-keyword)
|
7978
|
99 (autoload 'finder-by-keyword "finder"
|
|
100 "Find packages matching a given keyword." t)
|
2134
b275e1b50542
Added autoload, binding and menu line for new finder feature (P).
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
101
|
46329
|
102 (define-key help-map "r" 'info-emacs-manual)
|
|
103
|
409
|
104 (define-key help-map "s" 'describe-syntax)
|
|
105
|
|
106 (define-key help-map "t" 'help-with-tutorial)
|
|
107
|
|
108 (define-key help-map "w" 'where-is)
|
|
109
|
|
110 (define-key help-map "v" 'describe-variable)
|
|
111
|
6580
|
112 (define-key help-map "q" 'help-quit)
|
|
113
|
39651
|
114
|
6580
|
115 (defun help-quit ()
|
23333
|
116 "Just exit from the Help command's command loop."
|
6580
|
117 (interactive)
|
|
118 nil)
|
|
119
|
21188
|
120 (defvar help-return-method nil
|
|
121 "What to do to \"exit\" the help buffer.
|
|
122 This is a list
|
|
123 (WINDOW . t) delete the selected window, go to WINDOW.
|
|
124 (WINDOW . quit-window) do quit-window, then select WINDOW.
|
|
125 (WINDOW BUF START POINT) display BUF at START, POINT, then select WINDOW.")
|
|
126
|
409
|
127 (defun print-help-return-message (&optional function)
|
|
128 "Display or return message saying how to restore windows after help command.
|
46329
|
129 This function assumes that `standard-output' is the help buffer.
|
|
130 It computes a message, and applies the optional argument FUNCTION to it.
|
|
131 If FUNCTION is nil, it applies `message', thus displaying the message."
|
409
|
132 (and (not (get-buffer-window standard-output))
|
8259
|
133 (let ((first-message
|
16391
5d64d742ccbb
(print-help-return-message): Use new functions `special-display-p' and
Erik Naggum <erik@naggum.no>
diff
changeset
|
134 (cond ((special-display-p (buffer-name standard-output))
|
21188
|
135 (setq help-return-method (cons (selected-window) t))
|
8259
|
136 ;; If the help output buffer is a special display buffer,
|
|
137 ;; don't say anything about how to get rid of it.
|
|
138 ;; First of all, the user will do that with the window
|
|
139 ;; manager, not with Emacs.
|
|
140 ;; Secondly, the buffer has not been displayed yet,
|
|
141 ;; so we don't know whether its frame will be selected.
|
|
142 nil)
|
30667
|
143 (display-buffer-reuse-frames
|
|
144 (setq help-return-method (cons (selected-window)
|
|
145 'quit-window))
|
|
146 nil)
|
8259
|
147 ((not (one-window-p t))
|
21188
|
148 (setq help-return-method
|
|
149 (cons (selected-window) 'quit-window))
|
8259
|
150 "Type \\[switch-to-buffer-other-window] RET to restore the other window.")
|
|
151 (pop-up-windows
|
21188
|
152 (setq help-return-method (cons (selected-window) t))
|
8259
|
153 "Type \\[delete-other-windows] to remove help window.")
|
|
154 (t
|
21188
|
155 (setq help-return-method
|
|
156 (list (selected-window) (window-buffer)
|
|
157 (window-start) (window-point)))
|
8259
|
158 "Type \\[switch-to-buffer] RET to remove help window."))))
|
|
159 (funcall (or function 'message)
|
|
160 (concat
|
|
161 (if first-message
|
28909
|
162 (substitute-command-keys first-message))
|
|
163 (if first-message " ")
|
11524
|
164 ;; If the help buffer will go in a separate frame,
|
|
165 ;; it's no use mentioning a command to scroll, so don't.
|
16391
5d64d742ccbb
(print-help-return-message): Use new functions `special-display-p' and
Erik Naggum <erik@naggum.no>
diff
changeset
|
166 (if (special-display-p (buffer-name standard-output))
|
11524
|
167 nil
|
16391
5d64d742ccbb
(print-help-return-message): Use new functions `special-display-p' and
Erik Naggum <erik@naggum.no>
diff
changeset
|
168 (if (same-window-p (buffer-name standard-output))
|
11524
|
169 ;; Say how to scroll this window.
|
|
170 (substitute-command-keys
|
|
171 "\\[scroll-up] to scroll the help.")
|
|
172 ;; Say how to scroll some other window.
|
11428
|
173 (substitute-command-keys
|
11524
|
174 "\\[scroll-other-window] to scroll the help."))))))))
|
409
|
175
|
|
176 ;; So keyboard macro definitions are documented correctly
|
|
177 (fset 'defining-kbd-macro (symbol-function 'start-kbd-macro))
|
|
178
|
39728
|
179 (defalias 'help 'help-for-help)
|
|
180 (make-help-screen help-for-help
|
53204
|
181 "a b c C e f F i I k C-k l L m p s t v w C-c C-d C-f C-n C-p C-t C-w . or ? :"
|
39728
|
182 "You have typed %THIS-KEY%, the help character. Type a Help option:
|
|
183 \(Use SPC or DEL to scroll through this text. Type \\<help-map>\\[help-quit] to exit the Help command.)
|
|
184
|
|
185 a command-apropos. Give a substring, and see a list of commands
|
|
186 (functions interactively callable) that contain
|
|
187 that substring. See also the apropos command.
|
|
188 b describe-bindings. Display table of all key bindings.
|
|
189 c describe-key-briefly. Type a command key sequence;
|
|
190 it prints the function name that sequence runs.
|
|
191 C describe-coding-system. This describes either a specific coding system
|
|
192 (if you type its name) or the coding systems currently in use
|
|
193 (if you type just RET).
|
42735
|
194 e view-echo-area-messages. Show the `*Messages*' buffer.
|
39728
|
195 f describe-function. Type a function name and get documentation of it.
|
42735
|
196 F Info-goto-emacs-command-node. Type a function name;
|
39728
|
197 it takes you to the Info node for that command.
|
42738
|
198 h Display the HELLO file which illustrates various scripts.
|
39728
|
199 i info. The info documentation reader.
|
|
200 I describe-input-method. Describe a specific input method (if you type
|
|
201 its name) or the current input method (if you type just RET).
|
|
202 k describe-key. Type a command key sequence;
|
|
203 it displays the full documentation.
|
42735
|
204 K Info-goto-emacs-key-command-node. Type a command key sequence;
|
39728
|
205 it takes you to the Info node for the command bound to that key.
|
|
206 l view-lossage. Show last 100 characters you typed.
|
|
207 L describe-language-environment. This describes either a
|
|
208 specific language environment (if you type its name)
|
|
209 or the current language environment (if you type just RET).
|
|
210 m describe-mode. Print documentation of current minor modes,
|
|
211 and the current major mode, including their special commands.
|
|
212 p finder-by-keyword. Find packages matching a given topic keyword.
|
|
213 s describe-syntax. Display contents of syntax table, plus explanations.
|
42735
|
214 S info-lookup-symbol. Display the definition of a specific symbol
|
|
215 as found in the manual for the language this buffer is written in.
|
39728
|
216 t help-with-tutorial. Select the Emacs learn-by-doing tutorial.
|
|
217 v describe-variable. Type name of a variable;
|
|
218 it displays the variable's documentation and value.
|
|
219 w where-is. Type command name; it prints which keystrokes
|
|
220 invoke that command.
|
53204
|
221 . display-local-help. Display any available local help at point
|
|
222 in the echo area.
|
39728
|
223
|
42735
|
224 C-c Display Emacs copying permission (GNU General Public License).
|
39728
|
225 C-d Display Emacs ordering information.
|
42735
|
226 C-e Display info about Emacs problems.
|
|
227 C-f Display the Emacs FAQ.
|
|
228 C-m Display how to order printed Emacs manuals.
|
39728
|
229 C-n Display news of recent Emacs changes.
|
|
230 C-p Display information about the GNU project.
|
45070
|
231 C-t Display the Emacs TODO list.
|
39728
|
232 C-w Display information on absence of warranty for GNU Emacs."
|
|
233 help-map)
|
|
234
|
|
235
|
|
236
|
|
237 (defun function-called-at-point ()
|
|
238 "Return a function around point or else called by the list containing point.
|
|
239 If that doesn't give a function, return nil."
|
|
240 (with-syntax-table emacs-lisp-mode-syntax-table
|
|
241 (or (condition-case ()
|
|
242 (save-excursion
|
|
243 (or (not (zerop (skip-syntax-backward "_w")))
|
|
244 (eq (char-syntax (following-char)) ?w)
|
|
245 (eq (char-syntax (following-char)) ?_)
|
|
246 (forward-sexp -1))
|
|
247 (skip-chars-forward "'")
|
|
248 (let ((obj (read (current-buffer))))
|
|
249 (and (symbolp obj) (fboundp obj) obj)))
|
|
250 (error nil))
|
|
251 (condition-case ()
|
|
252 (save-excursion
|
|
253 (save-restriction
|
|
254 (narrow-to-region (max (point-min)
|
|
255 (- (point) 1000)) (point-max))
|
|
256 ;; Move up to surrounding paren, then after the open.
|
|
257 (backward-up-list 1)
|
|
258 (forward-char 1)
|
|
259 ;; If there is space here, this is probably something
|
|
260 ;; other than a real Lisp function call, so ignore it.
|
|
261 (if (looking-at "[ \t]")
|
|
262 (error "Probably not a Lisp function call"))
|
|
263 (let ((obj (read (current-buffer))))
|
|
264 (and (symbolp obj) (fboundp obj) obj))))
|
|
265 (error nil)))))
|
|
266
|
|
267
|
|
268 ;;; `User' help functions
|
|
269
|
409
|
270 (defun describe-distribution ()
|
|
271 "Display info on how to obtain the latest version of GNU Emacs."
|
|
272 (interactive)
|
42802
|
273 (view-file (expand-file-name "DISTRIB" data-directory)))
|
409
|
274
|
|
275 (defun describe-copying ()
|
|
276 "Display info on how you may redistribute copies of GNU Emacs."
|
|
277 (interactive)
|
42254
|
278 (view-file (expand-file-name "COPYING" data-directory))
|
409
|
279 (goto-char (point-min)))
|
|
280
|
5025
|
281 (defun describe-project ()
|
|
282 "Display info on the GNU project."
|
|
283 (interactive)
|
42254
|
284 (view-file (expand-file-name "THE-GNU-PROJECT" data-directory))
|
5025
|
285 (goto-char (point-min)))
|
|
286
|
409
|
287 (defun describe-no-warranty ()
|
|
288 "Display info on all the kinds of warranty Emacs does NOT have."
|
|
289 (interactive)
|
|
290 (describe-copying)
|
|
291 (let (case-fold-search)
|
|
292 (search-forward "NO WARRANTY")
|
|
293 (recenter 0)))
|
|
294
|
3980
|
295 (defun describe-prefix-bindings ()
|
3982
|
296 "Describe the bindings of the prefix used to reach this command.
|
|
297 The prefix described consists of all but the last event
|
|
298 of the key sequence that ran this command."
|
3980
|
299 (interactive)
|
11890
|
300 (let* ((key (this-command-keys)))
|
|
301 (describe-bindings
|
|
302 (if (stringp key)
|
|
303 (substring key 0 (1- (length key)))
|
|
304 (let ((prefix (make-vector (1- (length key)) nil))
|
|
305 (i 0))
|
|
306 (while (< i (length prefix))
|
|
307 (aset prefix i (aref key i))
|
|
308 (setq i (1+ i)))
|
|
309 prefix)))))
|
39728
|
310 ;; Make C-h after a prefix, when not specifically bound,
|
3982
|
311 ;; run describe-prefix-bindings.
|
3980
|
312 (setq prefix-help-command 'describe-prefix-bindings)
|
|
313
|
21210
|
314 (defun view-emacs-news (&optional arg)
|
|
315 "Display info on recent changes to Emacs.
|
55172
|
316 With argument, display info only for the selected version."
|
21210
|
317 (interactive "P")
|
55172
|
318 (if (not arg)
|
|
319 (view-file (expand-file-name "NEWS" data-directory))
|
|
320 (let* ((map (sort
|
|
321 (delete-dups
|
|
322 (apply
|
|
323 'nconc
|
|
324 (mapcar
|
|
325 (lambda (file)
|
|
326 (with-temp-buffer
|
|
327 (insert-file-contents
|
|
328 (expand-file-name file data-directory))
|
|
329 (let (res)
|
|
330 (while (re-search-forward
|
|
331 (if (string-match "^ONEWS\\.[0-9]+$" file)
|
|
332 "Changes in \\(?:Emacs\\|version\\)?[ \t]*\\([0-9]+\\(?:\\.[0-9]+\\)?\\)"
|
|
333 "^\* [^0-9\n]*\\([0-9]+\\.[0-9]+\\)") nil t)
|
|
334 (setq res (cons (list (match-string-no-properties 1)
|
|
335 file) res)))
|
|
336 res)))
|
|
337 (append '("NEWS" "ONEWS")
|
|
338 (directory-files data-directory nil
|
|
339 "^ONEWS\\.[0-9]+$" nil)))))
|
|
340 (lambda (a b)
|
|
341 (string< (car b) (car a)))))
|
|
342 (current (caar map))
|
|
343 (version (completing-read
|
|
344 (format "Read NEWS for the version (default %s): " current)
|
|
345 (mapcar 'car map) nil nil nil nil current))
|
|
346 (file (cadr (assoc version map)))
|
|
347 res)
|
|
348 (if (not file)
|
|
349 (error "No news is good news")
|
|
350 (view-file (expand-file-name file data-directory))
|
|
351 (widen)
|
|
352 (goto-char (point-min))
|
|
353 (when (re-search-forward
|
|
354 (concat (if (string-match "^ONEWS\\.[0-9]+$" file)
|
|
355 "Changes in \\(?:Emacs\\|version\\)?[ \t]*"
|
|
356 "^\* [^0-9\n]*") version)
|
|
357 nil t)
|
|
358 (beginning-of-line)
|
|
359 (narrow-to-region
|
|
360 (point)
|
|
361 (save-excursion
|
|
362 (while (and (setq res
|
|
363 (re-search-forward
|
|
364 (if (string-match "^ONEWS\\.[0-9]+$" file)
|
|
365 "Changes in \\(?:Emacs\\|version\\)?[ \t]*\\([0-9]+\\(?:\\.[0-9]+\\)?\\)"
|
|
366 "^\* [^0-9\n]*\\([0-9]+\\.[0-9]+\\)") nil t))
|
|
367 (equal (match-string-no-properties 1) version)))
|
|
368 (or res (goto-char (point-max)))
|
|
369 (beginning-of-line)
|
|
370 (point))))))))
|
409
|
371
|
45070
|
372 (defun view-todo (&optional arg)
|
|
373 "Display the Emacs TODO list."
|
|
374 (interactive "P")
|
|
375 (view-file (expand-file-name "TODO" data-directory)))
|
|
376
|
42735
|
377 (defun view-echo-area-messages ()
|
|
378 "View the log of recent echo-area messages: the `*Messages*' buffer.
|
|
379 The number of messages retained in that buffer
|
|
380 is specified by the variable `message-log-max'."
|
|
381 (interactive)
|
|
382 (switch-to-buffer (get-buffer-create "*Messages*")))
|
|
383
|
36277
|
384 (defun view-order-manuals ()
|
|
385 "Display the Emacs ORDERS file."
|
|
386 (interactive)
|
42254
|
387 (view-file (expand-file-name "ORDERS" data-directory))
|
36398
|
388 (goto-address))
|
36277
|
389
|
10923
|
390 (defun view-emacs-FAQ ()
|
|
391 "Display the Emacs Frequently Asked Questions (FAQ) file."
|
|
392 (interactive)
|
39786
f50214c096af
(describe-bindings-internal): New fun moved from keymap.c.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
393 ;; (find-file-read-only (expand-file-name "FAQ" data-directory))
|
28935
|
394 (info "(efaq)"))
|
10923
|
395
|
26757
|
396 (defun view-emacs-problems ()
|
|
397 "Display info on known problems with Emacs and possible workarounds."
|
|
398 (interactive)
|
|
399 (view-file (expand-file-name "PROBLEMS" data-directory)))
|
|
400
|
409
|
401 (defun view-lossage ()
|
36975
|
402 "Display last 100 input keystrokes.
|
|
403
|
|
404 To record all your input on a file, use `open-dribble-file'."
|
409
|
405 (interactive)
|
39789
e511f555920c
(view-lossage): Call help-setup-xref correctly and earlier.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
406 (help-setup-xref (list #'view-lossage) (interactive-p))
|
e511f555920c
(view-lossage): Call help-setup-xref correctly and earlier.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
407 (with-output-to-temp-buffer (help-buffer)
|
44332
|
408 (princ (mapconcat (lambda (key)
|
|
409 (if (or (integerp key) (symbolp key) (listp key))
|
|
410 (single-key-description key)
|
|
411 (prin1-to-string key nil)))
|
8504
|
412 (recent-keys)
|
|
413 " "))
|
39659
|
414 (with-current-buffer standard-output
|
409
|
415 (goto-char (point-min))
|
|
416 (while (progn (move-to-column 50) (not (eobp)))
|
|
417 (search-forward " " nil t)
|
39789
e511f555920c
(view-lossage): Call help-setup-xref correctly and earlier.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
418 (insert "\n")))
|
409
|
419 (print-help-return-message)))
|
|
420
|
39728
|
421
|
|
422 ;; Key bindings
|
409
|
423
|
22325
|
424 (defun describe-bindings (&optional prefix buffer)
|
20848
|
425 "Show a list of all defined keys, and their definitions.
|
|
426 We put that list in a buffer, and display the buffer.
|
|
427
|
|
428 The optional argument PREFIX, if non-nil, should be a key sequence;
|
22325
|
429 then we display only bindings that start with that prefix.
|
|
430 The optional argument BUFFER specifies which buffer's bindings
|
|
431 to display (default, the current buffer)."
|
39789
e511f555920c
(view-lossage): Call help-setup-xref correctly and earlier.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
432 (interactive)
|
22325
|
433 (or buffer (setq buffer (current-buffer)))
|
39789
e511f555920c
(view-lossage): Call help-setup-xref correctly and earlier.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
434 (help-setup-xref (list #'describe-bindings prefix buffer) (interactive-p))
|
22325
|
435 (with-current-buffer buffer
|
39789
e511f555920c
(view-lossage): Call help-setup-xref correctly and earlier.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
436 (describe-bindings-internal nil prefix)))
|
20848
|
437
|
39786
f50214c096af
(describe-bindings-internal): New fun moved from keymap.c.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
438 ;; This function used to be in keymap.c.
|
f50214c096af
(describe-bindings-internal): New fun moved from keymap.c.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
439 (defun describe-bindings-internal (&optional menus prefix)
|
f50214c096af
(describe-bindings-internal): New fun moved from keymap.c.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
440 "Show a list of all defined keys, and their definitions.
|
f50214c096af
(describe-bindings-internal): New fun moved from keymap.c.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
441 We put that list in a buffer, and display the buffer.
|
f50214c096af
(describe-bindings-internal): New fun moved from keymap.c.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
442
|
f50214c096af
(describe-bindings-internal): New fun moved from keymap.c.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
443 The optional argument MENUS, if non-nil, says to mention menu bindings.
|
f50214c096af
(describe-bindings-internal): New fun moved from keymap.c.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
444 \(Ordinarily these are omitted from the output.)
|
f50214c096af
(describe-bindings-internal): New fun moved from keymap.c.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
445 The optional argument PREFIX, if non-nil, should be a key sequence;
|
f50214c096af
(describe-bindings-internal): New fun moved from keymap.c.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
446 then we display only bindings that start with that prefix."
|
f50214c096af
(describe-bindings-internal): New fun moved from keymap.c.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
447 (interactive)
|
f50214c096af
(describe-bindings-internal): New fun moved from keymap.c.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
448 (let ((buf (current-buffer)))
|
f50214c096af
(describe-bindings-internal): New fun moved from keymap.c.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
449 (with-output-to-temp-buffer "*Help*"
|
f50214c096af
(describe-bindings-internal): New fun moved from keymap.c.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
450 (with-current-buffer standard-output
|
f50214c096af
(describe-bindings-internal): New fun moved from keymap.c.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
451 (describe-buffer-bindings buf prefix menus)))))
|
f50214c096af
(describe-bindings-internal): New fun moved from keymap.c.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
452
|
17917
|
453 (defun where-is (definition &optional insert)
|
24079
|
454 "Print message listing key sequences that invoke the command DEFINITION.
|
17917
|
455 Argument is a command definition, usually a symbol with a function definition.
|
|
456 If INSERT (the prefix arg) is non-nil, insert the message in the buffer."
|
6476
|
457 (interactive
|
|
458 (let ((fn (function-called-at-point))
|
39728
|
459 (enable-recursive-minibuffers t)
|
6476
|
460 val)
|
48202
50c0685806fb
(where-is): Rename map to defs (a list of syms is not a map).
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
461 (setq val (completing-read
|
50c0685806fb
(where-is): Rename map to defs (a list of syms is not a map).
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
462 (if fn
|
50c0685806fb
(where-is): Rename map to defs (a list of syms is not a map).
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
463 (format "Where is command (default %s): " fn)
|
50c0685806fb
(where-is): Rename map to defs (a list of syms is not a map).
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
464 "Where is command: ")
|
50c0685806fb
(where-is): Rename map to defs (a list of syms is not a map).
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
465 obarray 'commandp t))
|
50c0685806fb
(where-is): Rename map to defs (a list of syms is not a map).
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
466 (list (if (equal val "") fn (intern val)) current-prefix-arg)))
|
48193
|
467 (let ((func (indirect-function definition))
|
48202
50c0685806fb
(where-is): Rename map to defs (a list of syms is not a map).
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
468 (defs nil)
|
48193
|
469 (standard-output (if insert (current-buffer) t)))
|
48202
50c0685806fb
(where-is): Rename map to defs (a list of syms is not a map).
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
470 (mapatoms (lambda (symbol)
|
50c0685806fb
(where-is): Rename map to defs (a list of syms is not a map).
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
471 (and (fboundp symbol)
|
50c0685806fb
(where-is): Rename map to defs (a list of syms is not a map).
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
472 (not (eq symbol definition))
|
49188
|
473 (eq func (condition-case ()
|
|
474 (indirect-function symbol)
|
|
475 (error symbol)))
|
48202
50c0685806fb
(where-is): Rename map to defs (a list of syms is not a map).
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
476 (push symbol defs))))
|
48193
|
477 (princ (mapconcat
|
|
478 #'(lambda (symbol)
|
49757
|
479 (let* ((remapped (command-remapping symbol))
|
48202
50c0685806fb
(where-is): Rename map to defs (a list of syms is not a map).
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
480 (keys (where-is-internal
|
50c0685806fb
(where-is): Rename map to defs (a list of syms is not a map).
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
481 symbol overriding-local-map nil nil remapped))
|
50c0685806fb
(where-is): Rename map to defs (a list of syms is not a map).
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
482 (keys (mapconcat 'key-description keys ", ")))
|
48193
|
483 (if insert
|
|
484 (if (> (length keys) 0)
|
|
485 (if remapped
|
|
486 (format "%s (%s) (remapped from %s)"
|
|
487 keys remapped symbol)
|
|
488 (format "%s (%s)" keys symbol))
|
|
489 (format "M-x %s RET" symbol))
|
|
490 (if (> (length keys) 0)
|
|
491 (if remapped
|
|
492 (format "%s is remapped to %s which is on %s"
|
|
493 definition symbol keys)
|
|
494 (format "%s is on %s" symbol keys))
|
|
495 (format "%s is not on any key" symbol)))))
|
48202
50c0685806fb
(where-is): Rename map to defs (a list of syms is not a map).
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
496 (cons definition defs)
|
48193
|
497 ";\nand ")))
|
6476
|
498 nil)
|
|
499
|
39728
|
500 (defun string-key-binding (key)
|
|
501 "Value is the binding of KEY in a string.
|
|
502 If KEY is an event on a string, and that string has a `local-map'
|
|
503 or `keymap' property, return the binding of KEY in the string's keymap."
|
|
504 (let* ((defn nil)
|
|
505 (start (when (vectorp key)
|
44537
|
506 (if (memq (aref key 0)
|
|
507 '(mode-line header-line left-margin right-margin))
|
39728
|
508 (event-start (aref key 1))
|
|
509 (and (consp (aref key 0))
|
|
510 (event-start (aref key 0))))))
|
|
511 (string-info (and (consp start) (nth 4 start))))
|
|
512 (when string-info
|
|
513 (let* ((string (car string-info))
|
|
514 (pos (cdr string-info))
|
44537
|
515 (local-map (and (>= pos 0)
|
39728
|
516 (< pos (length string))
|
|
517 (or (get-text-property pos 'local-map string)
|
|
518 (get-text-property pos 'keymap string)))))
|
|
519 (setq defn (and local-map (lookup-key local-map key)))))
|
|
520 defn))
|
24079
|
521
|
44332
|
522 (defun help-key-description (key untranslated)
|
|
523 (let ((string (key-description key)))
|
46438
|
524 (if (or (not untranslated)
|
|
525 (and (eq (aref untranslated 0) ?\e) (not (eq (aref key 0) ?\e))))
|
44332
|
526 string
|
|
527 (let ((otherstring (key-description untranslated)))
|
|
528 (if (equal string otherstring)
|
|
529 string
|
|
530 (format "%s (translated from %s)" string otherstring))))))
|
49588
|
531
|
44332
|
532 (defun describe-key-briefly (key &optional insert untranslated)
|
39728
|
533 "Print the name of the function KEY invokes. KEY is a string.
|
44332
|
534 If INSERT (the prefix arg) is non-nil, insert the message in the buffer.
|
|
535 If non-nil UNTRANSLATED is a vector of the untranslated events.
|
|
536 It can also be a number in which case the untranslated events from
|
|
537 the last key hit are used."
|
|
538 (interactive "kDescribe key briefly: \nP\np")
|
|
539 (if (numberp untranslated)
|
|
540 (setq untranslated (this-single-command-raw-keys)))
|
39728
|
541 (save-excursion
|
|
542 (let ((modifiers (event-modifiers (aref key 0)))
|
|
543 (standard-output (if insert (current-buffer) t))
|
|
544 window position)
|
|
545 ;; For a mouse button event, go to the button it applies to
|
|
546 ;; to get the right key bindings. And go to the right place
|
|
547 ;; in case the keymap depends on where you clicked.
|
|
548 (if (or (memq 'click modifiers) (memq 'down modifiers)
|
|
549 (memq 'drag modifiers))
|
|
550 (setq window (posn-window (event-start (aref key 0)))
|
|
551 position (posn-point (event-start (aref key 0)))))
|
|
552 (if (windowp window)
|
|
553 (progn
|
|
554 (set-buffer (window-buffer window))
|
|
555 (goto-char position)))
|
|
556 ;; Ok, now look up the key and name the command.
|
|
557 (let ((defn (or (string-key-binding key)
|
|
558 (key-binding key)))
|
44332
|
559 (key-desc (help-key-description key untranslated)))
|
43697
8dc5abd4533a
(describe-key-briefly, describe-key): Interpret `undefined' like not
Pavel Janík <Pavel@Janik.cz>
diff
changeset
|
560 (if (or (null defn) (integerp defn) (equal defn 'undefined))
|
39728
|
561 (princ (format "%s is undefined" key-desc))
|
43309
|
562 (princ (format (if (windowp window)
|
|
563 "%s at that spot runs the command %s"
|
|
564 "%s runs the command %s")
|
39728
|
565 key-desc
|
|
566 (if (symbolp defn) defn (prin1-to-string defn)))))))))
|
31243
|
567
|
|
568
|
44332
|
569 (defun describe-key (key &optional untranslated)
|
42357
|
570 "Display documentation of the function invoked by KEY.
|
|
571 KEY should be a key sequence--when calling from a program,
|
44332
|
572 pass a string or a vector.
|
|
573 If non-nil UNTRANSLATED is a vector of the untranslated events.
|
|
574 It can also be a number in which case the untranslated events from
|
|
575 the last key hit are used."
|
|
576 (interactive "kDescribe key: \np")
|
|
577 (if (numberp untranslated)
|
|
578 (setq untranslated (this-single-command-raw-keys)))
|
21371
|
579 (save-excursion
|
39728
|
580 (let ((modifiers (event-modifiers (aref key 0)))
|
|
581 window position)
|
|
582 ;; For a mouse button event, go to the button it applies to
|
|
583 ;; to get the right key bindings. And go to the right place
|
|
584 ;; in case the keymap depends on where you clicked.
|
|
585 (if (or (memq 'click modifiers) (memq 'down modifiers)
|
|
586 (memq 'drag modifiers))
|
|
587 (setq window (posn-window (event-start (aref key 0)))
|
|
588 position (posn-point (event-start (aref key 0)))))
|
39786
f50214c096af
(describe-bindings-internal): New fun moved from keymap.c.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
589 (when (windowp window)
|
39728
|
590 (set-buffer (window-buffer window))
|
39786
f50214c096af
(describe-bindings-internal): New fun moved from keymap.c.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
591 (goto-char position))
|
39728
|
592 (let ((defn (or (string-key-binding key) (key-binding key))))
|
43697
8dc5abd4533a
(describe-key-briefly, describe-key): Interpret `undefined' like not
Pavel Janík <Pavel@Janik.cz>
diff
changeset
|
593 (if (or (null defn) (integerp defn) (equal defn 'undefined))
|
44332
|
594 (message "%s is undefined" (help-key-description key untranslated))
|
39789
e511f555920c
(view-lossage): Call help-setup-xref correctly and earlier.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
595 (help-setup-xref (list #'describe-function defn) (interactive-p))
|
e511f555920c
(view-lossage): Call help-setup-xref correctly and earlier.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
596 (with-output-to-temp-buffer (help-buffer)
|
44332
|
597 (princ (help-key-description key untranslated))
|
39728
|
598 (if (windowp window)
|
|
599 (princ " at that spot"))
|
|
600 (princ " runs the command ")
|
|
601 (prin1 defn)
|
|
602 (princ "\n which is ")
|
39789
e511f555920c
(view-lossage): Call help-setup-xref correctly and earlier.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
603 (describe-function-1 defn)
|
39728
|
604 (print-help-return-message)))))))
|
31422
|
605
|
21371
|
606
|
39728
|
607 (defun describe-mode (&optional buffer)
|
|
608 "Display documentation of current major mode and minor modes.
|
54815
|
609 A brief summary of the minor modes comes first, followed by the
|
|
610 major mode description. This is followed by detailed
|
|
611 descriptions of the minor modes, each on a separate page.
|
|
612
|
|
613 For this to work correctly for a minor mode, the mode's indicator
|
|
614 variable \(listed in `minor-mode-alist') must also be a function
|
|
615 whose documentation describes the minor mode."
|
21371
|
616 (interactive)
|
42679
|
617 (help-setup-xref (list #'describe-mode (or buffer (current-buffer)))
|
|
618 (interactive-p))
|
|
619 ;; For the sake of help-do-xref and help-xref-go-back,
|
|
620 ;; don't switch buffers before calling `help-buffer'.
|
39789
e511f555920c
(view-lossage): Call help-setup-xref correctly and earlier.
Stefan Monnier <monnier@iro.umontreal.ca>
diff
changeset
|
621 (with-output-to-temp-buffer (help-buffer)
|
42679
|
622 (save-excursion
|
|
623 (when buffer (set-buffer buffer))
|
52690
|
624 (let (minor-modes)
|
|
625 ;; Find enabled minor mode we will want to mention.
|
|
626 (dolist (mode minor-mode-list)
|
|
627 ;; Document a minor mode if it is listed in minor-mode-alist,
|
|
628 ;; non-nil, and has a function definition.
|
|
629 (and (boundp mode) (symbol-value mode)
|
|
630 (fboundp mode)
|
|
631 (let ((pretty-minor-mode mode)
|
|
632 indicator)
|
|
633 (if (string-match "\\(-minor\\)?-mode\\'"
|
|
634 (symbol-name mode))
|
|
635 (setq pretty-minor-mode
|
|
636 (capitalize
|
|
637 (substring (symbol-name mode)
|
|
638 0 (match-beginning 0)))))
|
|
639 (setq indicator (cadr (assq mode minor-mode-alist)))
|
|
640 (while (and indicator (symbolp indicator)
|
|
641 (boundp indicator)
|
|
642 (not (eq indicator (symbol-value indicator))))
|
|
643 (setq indicator (symbol-value indicator)))
|
|
644 (push (list pretty-minor-mode mode indicator)
|
|
645 minor-modes))))
|
|
646 (if auto-fill-function
|
|
647 (push '("Auto Fill" auto-fill-mode " Fill")
|
|
648 minor-modes))
|
|
649 (setq minor-modes
|
|
650 (sort minor-modes
|
|
651 (lambda (a b) (string-lessp (car a) (car b)))))
|
|
652 (when minor-modes
|
|
653 (princ "Summary of minor modes:\n")
|
|
654 (dolist (mode minor-modes)
|
|
655 (let ((pretty-minor-mode (nth 0 mode))
|
|
656 (indicator (nth 2 mode)))
|
|
657 (princ (format " %s minor mode (%s):\n"
|
|
658 pretty-minor-mode
|
|
659 (if indicator
|
|
660 (format "indicator%s" indicator)
|
|
661 "no indicator")))))
|
|
662 (princ "\n(Full information about these minor modes
|
|
663 follows the description of the major mode.)\n\n"))
|
|
664 ;; Document the major mode.
|
|
665 (princ mode-name)
|
|
666 (princ " mode:\n")
|
|
667 (princ (documentation major-mode))
|
|
668 ;; Document the minor modes fully.
|
|
669 (dolist (mode minor-modes)
|
|
670 (let ((pretty-minor-mode (nth 0 mode))
|
|
671 (mode-function (nth 1 mode))
|
|
672 (indicator (nth 2 mode)))
|
|
673 (princ "\n\f\n")
|
|
674 (princ (format "%s minor mode (%s):\n"
|
|
675 pretty-minor-mode
|
|
676 (if indicator
|
|
677 (format "indicator%s" indicator)
|
|
678 "no indicator")))
|
|
679 (princ (documentation mode-function)))))
|
42679
|
680 (print-help-return-message))))
|
21371
|
681
|
52690
|
682
|
50353
|
683 (defun describe-minor-mode (minor-mode)
|
50565
|
684 "Display documentation of a minor mode given as MINOR-MODE.
|
|
685 MINOR-MODE can be a minor mode symbol or a minor mode indicator string
|
|
686 appeared on the mode-line."
|
53204
|
687 (interactive (list (completing-read
|
50565
|
688 "Minor mode: "
|
|
689 (nconc
|
|
690 (describe-minor-mode-completion-table-for-symbol)
|
|
691 (describe-minor-mode-completion-table-for-indicator)
|
|
692 ))))
|
|
693 (if (symbolp minor-mode)
|
|
694 (setq minor-mode (symbol-name minor-mode)))
|
|
695 (let ((symbols (describe-minor-mode-completion-table-for-symbol))
|
|
696 (indicators (describe-minor-mode-completion-table-for-indicator)))
|
|
697 (cond
|
|
698 ((member minor-mode symbols)
|
|
699 (describe-minor-mode-from-symbol (intern minor-mode)))
|
|
700 ((member minor-mode indicators)
|
|
701 (describe-minor-mode-from-indicator minor-mode))
|
|
702 (t
|
|
703 (error "No such minor mode: %s" minor-mode)))))
|
|
704
|
53204
|
705 ;; symbol
|
50565
|
706 (defun describe-minor-mode-completion-table-for-symbol ()
|
|
707 ;; In order to list up all minor modes, minor-mode-list
|
|
708 ;; is used here instead of minor-mode-alist.
|
|
709 (delq nil (mapcar 'symbol-name minor-mode-list)))
|
|
710 (defun describe-minor-mode-from-symbol (symbol)
|
|
711 "Display documentation of a minor mode given as a symbol, SYMBOL"
|
53204
|
712 (interactive (list (intern (completing-read
|
50565
|
713 "Minor mode symbol: "
|
|
714 (describe-minor-mode-completion-table-for-symbol)))))
|
|
715 (if (fboundp symbol)
|
|
716 (describe-function symbol)
|
|
717 (describe-variable symbol)))
|
50353
|
718
|
50565
|
719 ;; indicator
|
|
720 (defun describe-minor-mode-completion-table-for-indicator ()
|
53204
|
721 (delq nil
|
50565
|
722 (mapcar (lambda (x)
|
|
723 (let ((i (format-mode-line x)))
|
|
724 ;; remove first space if existed
|
|
725 (cond
|
|
726 ((= 0 (length i))
|
|
727 nil)
|
|
728 ((eq (aref i 0) ?\ )
|
|
729 (substring i 1))
|
53204
|
730 (t
|
50565
|
731 i))))
|
|
732 minor-mode-alist)))
|
50353
|
733 (defun describe-minor-mode-from-indicator (indicator)
|
50565
|
734 "Display documentation of a minor mode specified by INDICATOR.
|
|
735 If you call this function interactively, you can give indicator which
|
|
736 is currently activated with completion."
|
53204
|
737 (interactive (list
|
|
738 (completing-read
|
50353
|
739 "Minor mode indicator: "
|
50565
|
740 (describe-minor-mode-completion-table-for-indicator))))
|
50353
|
741 (let ((minor-mode (lookup-minor-mode-from-indicator indicator)))
|
|
742 (if minor-mode
|
50565
|
743 (describe-minor-mode-from-symbol minor-mode)
|
50353
|
744 (error "Cannot find minor mode for `%s'" indicator))))
|
|
745
|
|
746 (defun lookup-minor-mode-from-indicator (indicator)
|
|
747 "Return a minor mode symbol from its indicator on the modeline."
|
50565
|
748 ;; remove first space if existed
|
53204
|
749 (if (and (< 0 (length indicator))
|
50565
|
750 (eq (aref indicator 0) ?\ ))
|
|
751 (setq indicator (substring indicator 1)))
|
50353
|
752 (let ((minor-modes minor-mode-alist)
|
|
753 result)
|
|
754 (while minor-modes
|
|
755 (let* ((minor-mode (car (car minor-modes)))
|
53204
|
756 (anindicator (format-mode-line
|
50565
|
757 (car (cdr (car minor-modes))))))
|
|
758 ;; remove first space if existed
|
53204
|
759 (if (and (stringp anindicator)
|
50565
|
760 (> (length anindicator) 0)
|
|
761 (eq (aref anindicator 0) ?\ ))
|
|
762 (setq anindicator (substring anindicator 1)))
|
|
763 (if (equal indicator anindicator)
|
50353
|
764 (setq result minor-mode
|
|
765 minor-modes nil)
|
|
766 (setq minor-modes (cdr minor-modes)))))
|
|
767 result))
|
|
768
|
23747
|
769
|
|
770 ;;; Automatic resizing of temporary buffers.
|
|
771
|
23749
|
772 (defcustom temp-buffer-max-height (lambda (buffer) (/ (- (frame-height) 2) 2))
|
23747
|
773 "*Maximum height of a window displaying a temporary buffer.
|
|
774 This is the maximum height (in text lines) which `resize-temp-buffer-window'
|
|
775 will give to a window displaying a temporary buffer.
|
|
776 It can also be a function which will be called with the object corresponding
|
|
777 to the buffer to be displayed as argument and should return an integer
|
|
778 positive number."
|
|
779 :type '(choice integer function)
|
|
780 :group 'help
|
|
781 :version "20.4")
|
|
782
|
32183
|
783 (define-minor-mode temp-buffer-resize-mode
|
|
784 "Toggle the mode which makes windows smaller for temporary buffers.
|
23747
|
785 With prefix argument ARG, turn the resizing of windows displaying temporary
|
|
786 buffers on if ARG is positive or off otherwise.
|
32183
|
787 This makes the window the right height for its contents, but never
|
|
788 more than `temp-buffer-max-height' nor less than `window-min-height'.
|
|
789 This applies to `help', `apropos' and `completion' buffers, and some others."
|
39659
|
790 :global t :group 'help
|
32183
|
791 (if temp-buffer-resize-mode
|
36249
|
792 ;; `help-make-xrefs' may add a `back' button and thus increase the
|
32183
|
793 ;; text size, so `resize-temp-buffer-window' must be run *after* it.
|
|
794 (add-hook 'temp-buffer-show-hook 'resize-temp-buffer-window 'append)
|
32184
|
795 (remove-hook 'temp-buffer-show-hook 'resize-temp-buffer-window)))
|
23747
|
796
|
|
797 (defun resize-temp-buffer-window ()
|
|
798 "Resize the current window to fit its contents.
|
23749
|
799 Will not make it higher than `temp-buffer-max-height' nor smaller than
|
24079
|
800 `window-min-height'. Do nothing if it is the only window on its frame, if it
|
23747
|
801 is not as wide as the frame or if some of the window's contents are scrolled
|
|
802 out of view."
|
|
803 (unless (or (one-window-p 'nomini)
|
|
804 (not (pos-visible-in-window-p (point-min)))
|
|
805 (/= (frame-width) (window-width)))
|
32706
|
806 (fit-window-to-buffer
|
|
807 (selected-window)
|
|
808 (if (functionp temp-buffer-max-height)
|
|
809 (funcall temp-buffer-max-height (current-buffer))
|
|
810 temp-buffer-max-height))))
|
23747
|
811
|
32540
|
812 ;; Provide this for the sake of define-minor-mode which generates
|
|
813 ;; defcustoms which require 'help'.
|
|
814 (provide 'help)
|
|
815
|
52401
|
816 ;;; arch-tag: cf427352-27e9-49b7-9a6f-741ebab02423
|
660
|
817 ;;; help.el ends here
|