annotate lisp/help.el @ 40263:3657a6c97b2f

(struct image): Add `background', `background_valid', and `background_transparent' fields. (image_background, image_background_transparent): New declarations. (IMAGE_BACKGROUND, IMAGE_BACKGROUND_TRANSPARENT): New macros.
author Miles Bader <miles@gnu.org>
date Wed, 24 Oct 2001 17:16:52 +0000
parents e511f555920c
children ffef7ba0b65d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
660
08eb386dd0f3 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 444
diff changeset
1 ;;; help.el --- help commands for Emacs
08eb386dd0f3 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 444
diff changeset
2
36277
ab9c82e64020 (view-order-manuals): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36249
diff changeset
3 ;; Copyright (C) 1985, 1986, 1993, 1994, 1998, 1999, 2000, 2001
ab9c82e64020 (view-order-manuals): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36249
diff changeset
4 ;; Free Software Foundation, Inc.
846
20674ae6bf52 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 811
diff changeset
5
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 755
diff changeset
6 ;; Maintainer: FSF
811
e694e0879463 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 807
diff changeset
7 ;; Keywords: help, internal
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 755
diff changeset
8
409
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 755
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
409
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14 ;; any later version.
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19 ;; GNU General Public License for more details.
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13358
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13358
diff changeset
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13358
diff changeset
24 ;; Boston, MA 02111-1307, USA.
409
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25
2315
9e7ec92a4fdf Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2312
diff changeset
26 ;;; Commentary:
9e7ec92a4fdf Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2312
diff changeset
27
16391
5d64d742ccbb (print-help-return-message): Use new functions `special-display-p' and
Erik Naggum <erik@naggum.no>
parents: 16273
diff changeset
28 ;; This code implements GNU Emacs' on-line help system, the one invoked by
25473
1ad8606c8cc7 (help-make-xrefs): Don't lose on non-empty blank line after key table.
Dave Love <fx@gnu.org>
parents: 25047
diff changeset
29 ;; `M-x help-for-help'.
2315
9e7ec92a4fdf Added or corrected Commentary headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2312
diff changeset
30
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 755
diff changeset
31 ;;; Code:
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 755
diff changeset
32
2312
ad7b89a430df Don't load help-screen at run time if compiled.
Richard M. Stallman <rms@gnu.org>
parents: 2237
diff changeset
33 ;; Get the macro make-help-screen when this is compiled,
ad7b89a430df Don't load help-screen at run time if compiled.
Richard M. Stallman <rms@gnu.org>
parents: 2237
diff changeset
34 ;; or run interpreted, but not when the compiled code is loaded.
2697
05ff97695d32 Require help-macro, not help-screen.
Richard M. Stallman <rms@gnu.org>
parents: 2638
diff changeset
35 (eval-when-compile (require 'help-macro))
39728
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
36
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
37 ;; This makes `with-output-to-temp-buffer' buffers use `help-mode'.
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
38 (add-hook 'temp-buffer-setup-hook 'help-mode-setup)
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
39 (add-hook 'temp-buffer-show-hook 'help-mode-finish)
2237
2670a8f6a42e Teach this to use help-screen.el.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2134
diff changeset
40
409
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
41 (defvar help-map (make-sparse-keymap)
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
42 "Keymap for characters following the Help key.")
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
43
919
567b06901789 entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 918
diff changeset
44 (define-key global-map (char-to-string help-char) 'help-command)
12424
aa25c9b2e043 Bind f1 and help like C-h.
Richard M. Stallman <rms@gnu.org>
parents: 11890
diff changeset
45 (define-key global-map [help] 'help-command)
aa25c9b2e043 Bind f1 and help like C-h.
Richard M. Stallman <rms@gnu.org>
parents: 11890
diff changeset
46 (define-key global-map [f1] 'help-command)
409
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
47 (fset 'help-command help-map)
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
48
919
567b06901789 entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 918
diff changeset
49 (define-key help-map (char-to-string help-char) 'help-for-help)
12424
aa25c9b2e043 Bind f1 and help like C-h.
Richard M. Stallman <rms@gnu.org>
parents: 11890
diff changeset
50 (define-key help-map [help] 'help-for-help)
aa25c9b2e043 Bind f1 and help like C-h.
Richard M. Stallman <rms@gnu.org>
parents: 11890
diff changeset
51 (define-key help-map [f1] 'help-for-help)
409
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
52 (define-key help-map "?" 'help-for-help)
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
53
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
54 (define-key help-map "\C-c" 'describe-copying)
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
55 (define-key help-map "\C-d" 'describe-distribution)
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
56 (define-key help-map "\C-w" 'describe-no-warranty)
5025
0556b068e9ee (describe-project): New function, on C-h C-p.
Richard M. Stallman <rms@gnu.org>
parents: 4467
diff changeset
57 (define-key help-map "\C-p" 'describe-project)
17200
9438563a5151 (help-map): Use apropos-command, not command-apropos.
Richard M. Stallman <rms@gnu.org>
parents: 17005
diff changeset
58 (define-key help-map "a" 'apropos-command)
409
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
59
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
60 (define-key help-map "b" 'describe-bindings)
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
61
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
62 (define-key help-map "c" 'describe-key-briefly)
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
63 (define-key help-map "k" 'describe-key)
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
64
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
65 (define-key help-map "d" 'describe-function)
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
66 (define-key help-map "f" 'describe-function)
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
67
10923
fe008aef4cf1 (view-emacs-FAQ): New function. Bind to C-h F.
Richard M. Stallman <rms@gnu.org>
parents: 10622
diff changeset
68 (define-key help-map "F" 'view-emacs-FAQ)
fe008aef4cf1 (view-emacs-FAQ): New function. Bind to C-h F.
Richard M. Stallman <rms@gnu.org>
parents: 10622
diff changeset
69
409
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70 (define-key help-map "i" 'info)
22470
eec1f722bded (help-map): C-h 4 i runs info-other-window.
Richard M. Stallman <rms@gnu.org>
parents: 22417
diff changeset
71 (define-key help-map "4i" 'info-other-window)
732
a8d94735277e *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 660
diff changeset
72 (define-key help-map "\C-f" 'Info-goto-emacs-command-node)
a8d94735277e *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 660
diff changeset
73 (define-key help-map "\C-k" 'Info-goto-emacs-key-command-node)
18293
ac6884f51b58 (help-map): Make C-i run info-lookup-symbol.
Richard M. Stallman <rms@gnu.org>
parents: 17917
diff changeset
74 (define-key help-map "\C-i" 'info-lookup-symbol)
409
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
75
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
76 (define-key help-map "l" 'view-lossage)
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
77
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
78 (define-key help-map "m" 'describe-mode)
36277
ab9c82e64020 (view-order-manuals): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36249
diff changeset
79 (define-key help-map "\C-m" 'view-order-manuals)
409
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
80
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
81 (define-key help-map "\C-n" 'view-emacs-news)
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
82 (define-key help-map "n" 'view-emacs-news)
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
83
2134
b275e1b50542 Added autoload, binding and menu line for new finder feature (P).
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2079
diff changeset
84 (define-key help-map "p" 'finder-by-keyword)
7978
8356e992ddb6 (finder-by-keyword): Add doc string and t for interactive.
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
85 (autoload 'finder-by-keyword "finder"
8356e992ddb6 (finder-by-keyword): Add doc string and t for interactive.
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
86 "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>
parents: 2079
diff changeset
87
26757
6af9f1dc59c4 (view-emacs-problems): New command, bound to C-h P.
Dave Love <fx@gnu.org>
parents: 26650
diff changeset
88 (define-key help-map "P" 'view-emacs-problems)
6af9f1dc59c4 (view-emacs-problems): New command, bound to C-h P.
Dave Love <fx@gnu.org>
parents: 26650
diff changeset
89
409
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
90 (define-key help-map "s" 'describe-syntax)
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
91
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92 (define-key help-map "t" 'help-with-tutorial)
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
93
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
94 (define-key help-map "w" 'where-is)
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
95
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
96 (define-key help-map "v" 'describe-variable)
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
97
6580
4c20c6b1d2c2 (help): New alias.
Richard M. Stallman <rms@gnu.org>
parents: 6476
diff changeset
98 (define-key help-map "q" 'help-quit)
4c20c6b1d2c2 (help): New alias.
Richard M. Stallman <rms@gnu.org>
parents: 6476
diff changeset
99
39651
444f50200adc (help-mode-map): Make button-buffer-map our parent.
Miles Bader <miles@gnu.org>
parents: 39512
diff changeset
100
6580
4c20c6b1d2c2 (help): New alias.
Richard M. Stallman <rms@gnu.org>
parents: 6476
diff changeset
101 (defun help-quit ()
23333
b8369b78f1ba (help-quit): Add doc.
Richard M. Stallman <rms@gnu.org>
parents: 23332
diff changeset
102 "Just exit from the Help command's command loop."
6580
4c20c6b1d2c2 (help): New alias.
Richard M. Stallman <rms@gnu.org>
parents: 6476
diff changeset
103 (interactive)
4c20c6b1d2c2 (help): New alias.
Richard M. Stallman <rms@gnu.org>
parents: 6476
diff changeset
104 nil)
4c20c6b1d2c2 (help): New alias.
Richard M. Stallman <rms@gnu.org>
parents: 6476
diff changeset
105
21188
607ce9d7cf53 (help-mode-maybe): Set view-return-to-alist.
Richard M. Stallman <rms@gnu.org>
parents: 20953
diff changeset
106 (defvar help-return-method nil
607ce9d7cf53 (help-mode-maybe): Set view-return-to-alist.
Richard M. Stallman <rms@gnu.org>
parents: 20953
diff changeset
107 "What to do to \"exit\" the help buffer.
607ce9d7cf53 (help-mode-maybe): Set view-return-to-alist.
Richard M. Stallman <rms@gnu.org>
parents: 20953
diff changeset
108 This is a list
607ce9d7cf53 (help-mode-maybe): Set view-return-to-alist.
Richard M. Stallman <rms@gnu.org>
parents: 20953
diff changeset
109 (WINDOW . t) delete the selected window, go to WINDOW.
607ce9d7cf53 (help-mode-maybe): Set view-return-to-alist.
Richard M. Stallman <rms@gnu.org>
parents: 20953
diff changeset
110 (WINDOW . quit-window) do quit-window, then select WINDOW.
607ce9d7cf53 (help-mode-maybe): Set view-return-to-alist.
Richard M. Stallman <rms@gnu.org>
parents: 20953
diff changeset
111 (WINDOW BUF START POINT) display BUF at START, POINT, then select WINDOW.")
607ce9d7cf53 (help-mode-maybe): Set view-return-to-alist.
Richard M. Stallman <rms@gnu.org>
parents: 20953
diff changeset
112
409
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113 (defun print-help-return-message (&optional function)
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
114 "Display or return message saying how to restore windows after help command.
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
115 Computes a message and applies the optional argument FUNCTION to it.
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
116 If FUNCTION is nil, applies `message' to it, thus printing it."
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
117 (and (not (get-buffer-window standard-output))
8259
604d89082229 (print-help-return-message): If help buffer is a
Richard M. Stallman <rms@gnu.org>
parents: 7978
diff changeset
118 (let ((first-message
16391
5d64d742ccbb (print-help-return-message): Use new functions `special-display-p' and
Erik Naggum <erik@naggum.no>
parents: 16273
diff changeset
119 (cond ((special-display-p (buffer-name standard-output))
21188
607ce9d7cf53 (help-mode-maybe): Set view-return-to-alist.
Richard M. Stallman <rms@gnu.org>
parents: 20953
diff changeset
120 (setq help-return-method (cons (selected-window) t))
8259
604d89082229 (print-help-return-message): If help buffer is a
Richard M. Stallman <rms@gnu.org>
parents: 7978
diff changeset
121 ;; If the help output buffer is a special display buffer,
604d89082229 (print-help-return-message): If help buffer is a
Richard M. Stallman <rms@gnu.org>
parents: 7978
diff changeset
122 ;; don't say anything about how to get rid of it.
604d89082229 (print-help-return-message): If help buffer is a
Richard M. Stallman <rms@gnu.org>
parents: 7978
diff changeset
123 ;; First of all, the user will do that with the window
604d89082229 (print-help-return-message): If help buffer is a
Richard M. Stallman <rms@gnu.org>
parents: 7978
diff changeset
124 ;; manager, not with Emacs.
604d89082229 (print-help-return-message): If help buffer is a
Richard M. Stallman <rms@gnu.org>
parents: 7978
diff changeset
125 ;; Secondly, the buffer has not been displayed yet,
604d89082229 (print-help-return-message): If help buffer is a
Richard M. Stallman <rms@gnu.org>
parents: 7978
diff changeset
126 ;; so we don't know whether its frame will be selected.
604d89082229 (print-help-return-message): If help buffer is a
Richard M. Stallman <rms@gnu.org>
parents: 7978
diff changeset
127 nil)
30667
2bd60ea8076f (print-help-return-message): When
Gerd Moellmann <gerd@gnu.org>
parents: 30621
diff changeset
128 (display-buffer-reuse-frames
2bd60ea8076f (print-help-return-message): When
Gerd Moellmann <gerd@gnu.org>
parents: 30621
diff changeset
129 (setq help-return-method (cons (selected-window)
2bd60ea8076f (print-help-return-message): When
Gerd Moellmann <gerd@gnu.org>
parents: 30621
diff changeset
130 'quit-window))
2bd60ea8076f (print-help-return-message): When
Gerd Moellmann <gerd@gnu.org>
parents: 30621
diff changeset
131 nil)
8259
604d89082229 (print-help-return-message): If help buffer is a
Richard M. Stallman <rms@gnu.org>
parents: 7978
diff changeset
132 ((not (one-window-p t))
21188
607ce9d7cf53 (help-mode-maybe): Set view-return-to-alist.
Richard M. Stallman <rms@gnu.org>
parents: 20953
diff changeset
133 (setq help-return-method
607ce9d7cf53 (help-mode-maybe): Set view-return-to-alist.
Richard M. Stallman <rms@gnu.org>
parents: 20953
diff changeset
134 (cons (selected-window) 'quit-window))
8259
604d89082229 (print-help-return-message): If help buffer is a
Richard M. Stallman <rms@gnu.org>
parents: 7978
diff changeset
135 "Type \\[switch-to-buffer-other-window] RET to restore the other window.")
604d89082229 (print-help-return-message): If help buffer is a
Richard M. Stallman <rms@gnu.org>
parents: 7978
diff changeset
136 (pop-up-windows
21188
607ce9d7cf53 (help-mode-maybe): Set view-return-to-alist.
Richard M. Stallman <rms@gnu.org>
parents: 20953
diff changeset
137 (setq help-return-method (cons (selected-window) t))
8259
604d89082229 (print-help-return-message): If help buffer is a
Richard M. Stallman <rms@gnu.org>
parents: 7978
diff changeset
138 "Type \\[delete-other-windows] to remove help window.")
604d89082229 (print-help-return-message): If help buffer is a
Richard M. Stallman <rms@gnu.org>
parents: 7978
diff changeset
139 (t
21188
607ce9d7cf53 (help-mode-maybe): Set view-return-to-alist.
Richard M. Stallman <rms@gnu.org>
parents: 20953
diff changeset
140 (setq help-return-method
607ce9d7cf53 (help-mode-maybe): Set view-return-to-alist.
Richard M. Stallman <rms@gnu.org>
parents: 20953
diff changeset
141 (list (selected-window) (window-buffer)
607ce9d7cf53 (help-mode-maybe): Set view-return-to-alist.
Richard M. Stallman <rms@gnu.org>
parents: 20953
diff changeset
142 (window-start) (window-point)))
8259
604d89082229 (print-help-return-message): If help buffer is a
Richard M. Stallman <rms@gnu.org>
parents: 7978
diff changeset
143 "Type \\[switch-to-buffer] RET to remove help window."))))
604d89082229 (print-help-return-message): If help buffer is a
Richard M. Stallman <rms@gnu.org>
parents: 7978
diff changeset
144 (funcall (or function 'message)
604d89082229 (print-help-return-message): If help buffer is a
Richard M. Stallman <rms@gnu.org>
parents: 7978
diff changeset
145 (concat
604d89082229 (print-help-return-message): If help buffer is a
Richard M. Stallman <rms@gnu.org>
parents: 7978
diff changeset
146 (if first-message
28909
43d9eb93e1fb (help-xref-stack): Doc fix.
Dave Love <fx@gnu.org>
parents: 28841
diff changeset
147 (substitute-command-keys first-message))
43d9eb93e1fb (help-xref-stack): Doc fix.
Dave Love <fx@gnu.org>
parents: 28841
diff changeset
148 (if first-message " ")
11524
cafa503e806c (print-help-return-message): Check same-window-buffer-names
Richard M. Stallman <rms@gnu.org>
parents: 11428
diff changeset
149 ;; If the help buffer will go in a separate frame,
cafa503e806c (print-help-return-message): Check same-window-buffer-names
Richard M. Stallman <rms@gnu.org>
parents: 11428
diff changeset
150 ;; 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>
parents: 16273
diff changeset
151 (if (special-display-p (buffer-name standard-output))
11524
cafa503e806c (print-help-return-message): Check same-window-buffer-names
Richard M. Stallman <rms@gnu.org>
parents: 11428
diff changeset
152 nil
16391
5d64d742ccbb (print-help-return-message): Use new functions `special-display-p' and
Erik Naggum <erik@naggum.no>
parents: 16273
diff changeset
153 (if (same-window-p (buffer-name standard-output))
11524
cafa503e806c (print-help-return-message): Check same-window-buffer-names
Richard M. Stallman <rms@gnu.org>
parents: 11428
diff changeset
154 ;; Say how to scroll this window.
cafa503e806c (print-help-return-message): Check same-window-buffer-names
Richard M. Stallman <rms@gnu.org>
parents: 11428
diff changeset
155 (substitute-command-keys
cafa503e806c (print-help-return-message): Check same-window-buffer-names
Richard M. Stallman <rms@gnu.org>
parents: 11428
diff changeset
156 "\\[scroll-up] to scroll the help.")
cafa503e806c (print-help-return-message): Check same-window-buffer-names
Richard M. Stallman <rms@gnu.org>
parents: 11428
diff changeset
157 ;; Say how to scroll some other window.
11428
d39d8e8b6d20 (print-help-return-message): Check same-window-buffer-names
Richard M. Stallman <rms@gnu.org>
parents: 10923
diff changeset
158 (substitute-command-keys
11524
cafa503e806c (print-help-return-message): Check same-window-buffer-names
Richard M. Stallman <rms@gnu.org>
parents: 11428
diff changeset
159 "\\[scroll-other-window] to scroll the help."))))))))
409
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
160
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
161 ;; So keyboard macro definitions are documented correctly
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
162 (fset 'defining-kbd-macro (symbol-function 'start-kbd-macro))
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
163
39728
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
164 (defalias 'help 'help-for-help)
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
165 (make-help-screen help-for-help
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
166 "a b c C f F C-f i I k C-k l L m n p s t v w C-c C-d C-n C-p C-w; ? for help:"
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
167 "You have typed %THIS-KEY%, the help character. Type a Help option:
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
168 \(Use SPC or DEL to scroll through this text. Type \\<help-map>\\[help-quit] to exit the Help command.)
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
169
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
170 a command-apropos. Give a substring, and see a list of commands
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
171 (functions interactively callable) that contain
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
172 that substring. See also the apropos command.
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
173 b describe-bindings. Display table of all key bindings.
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
174 c describe-key-briefly. Type a command key sequence;
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
175 it prints the function name that sequence runs.
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
176 C describe-coding-system. This describes either a specific coding system
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
177 (if you type its name) or the coding systems currently in use
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
178 (if you type just RET).
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
179 f describe-function. Type a function name and get documentation of it.
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
180 C-f Info-goto-emacs-command-node. Type a function name;
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
181 it takes you to the Info node for that command.
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
182 i info. The info documentation reader.
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
183 I describe-input-method. Describe a specific input method (if you type
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
184 its name) or the current input method (if you type just RET).
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
185 C-i info-lookup-symbol. Display the definition of a specific symbol
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
186 as found in the manual for the language this buffer is written in.
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
187 k describe-key. Type a command key sequence;
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
188 it displays the full documentation.
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
189 C-k Info-goto-emacs-key-command-node. Type a command key sequence;
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
190 it takes you to the Info node for the command bound to that key.
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
191 l view-lossage. Show last 100 characters you typed.
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
192 L describe-language-environment. This describes either a
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
193 specific language environment (if you type its name)
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
194 or the current language environment (if you type just RET).
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
195 m describe-mode. Print documentation of current minor modes,
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
196 and the current major mode, including their special commands.
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
197 n view-emacs-news. Display news of recent Emacs changes.
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
198 p finder-by-keyword. Find packages matching a given topic keyword.
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
199 s describe-syntax. Display contents of syntax table, plus explanations.
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
200 t help-with-tutorial. Select the Emacs learn-by-doing tutorial.
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
201 v describe-variable. Type name of a variable;
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
202 it displays the variable's documentation and value.
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
203 w where-is. Type command name; it prints which keystrokes
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
204 invoke that command.
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
205
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
206 F Display the frequently asked questions file.
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
207 h Display the HELLO file which illustrates various scripts.
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
208 C-c Display Emacs copying permission (General Public License).
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
209 C-d Display Emacs ordering information.
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
210 C-n Display news of recent Emacs changes.
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
211 C-p Display information about the GNU project.
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
212 C-w Display information on absence of warranty for GNU Emacs."
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
213 help-map)
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
214
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
215
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
216
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
217 (defun function-called-at-point ()
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
218 "Return a function around point or else called by the list containing point.
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
219 If that doesn't give a function, return nil."
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
220 (with-syntax-table emacs-lisp-mode-syntax-table
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
221 (or (condition-case ()
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
222 (save-excursion
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
223 (or (not (zerop (skip-syntax-backward "_w")))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
224 (eq (char-syntax (following-char)) ?w)
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
225 (eq (char-syntax (following-char)) ?_)
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
226 (forward-sexp -1))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
227 (skip-chars-forward "'")
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
228 (let ((obj (read (current-buffer))))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
229 (and (symbolp obj) (fboundp obj) obj)))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
230 (error nil))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
231 (condition-case ()
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
232 (save-excursion
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
233 (save-restriction
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
234 (narrow-to-region (max (point-min)
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
235 (- (point) 1000)) (point-max))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
236 ;; Move up to surrounding paren, then after the open.
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
237 (backward-up-list 1)
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
238 (forward-char 1)
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
239 ;; If there is space here, this is probably something
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
240 ;; other than a real Lisp function call, so ignore it.
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
241 (if (looking-at "[ \t]")
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
242 (error "Probably not a Lisp function call"))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
243 (let ((obj (read (current-buffer))))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
244 (and (symbolp obj) (fboundp obj) obj))))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
245 (error nil)))))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
246
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
247
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
248 ;;; `User' help functions
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
249
409
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
250 (defun describe-distribution ()
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
251 "Display info on how to obtain the latest version of GNU Emacs."
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
252 (interactive)
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
253 (find-file-read-only
444
4cec2e6d4f9e *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 409
diff changeset
254 (expand-file-name "DISTRIB" data-directory)))
409
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
255
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
256 (defun describe-copying ()
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
257 "Display info on how you may redistribute copies of GNU Emacs."
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
258 (interactive)
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
259 (find-file-read-only
444
4cec2e6d4f9e *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 409
diff changeset
260 (expand-file-name "COPYING" data-directory))
409
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
261 (goto-char (point-min)))
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
262
5025
0556b068e9ee (describe-project): New function, on C-h C-p.
Richard M. Stallman <rms@gnu.org>
parents: 4467
diff changeset
263 (defun describe-project ()
0556b068e9ee (describe-project): New function, on C-h C-p.
Richard M. Stallman <rms@gnu.org>
parents: 4467
diff changeset
264 "Display info on the GNU project."
0556b068e9ee (describe-project): New function, on C-h C-p.
Richard M. Stallman <rms@gnu.org>
parents: 4467
diff changeset
265 (interactive)
0556b068e9ee (describe-project): New function, on C-h C-p.
Richard M. Stallman <rms@gnu.org>
parents: 4467
diff changeset
266 (find-file-read-only
36403
d97291862662 (describe-project): Display the file THE-GNU-PROJECT.
Gerd Moellmann <gerd@gnu.org>
parents: 36398
diff changeset
267 (expand-file-name "THE-GNU-PROJECT" data-directory))
5025
0556b068e9ee (describe-project): New function, on C-h C-p.
Richard M. Stallman <rms@gnu.org>
parents: 4467
diff changeset
268 (goto-char (point-min)))
0556b068e9ee (describe-project): New function, on C-h C-p.
Richard M. Stallman <rms@gnu.org>
parents: 4467
diff changeset
269
409
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
270 (defun describe-no-warranty ()
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
271 "Display info on all the kinds of warranty Emacs does NOT have."
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
272 (interactive)
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
273 (describe-copying)
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
274 (let (case-fold-search)
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
275 (search-forward "NO WARRANTY")
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
276 (recenter 0)))
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
277
3980
bf2d4294a1dd (describe-prefix-bindings): New command.
Richard M. Stallman <rms@gnu.org>
parents: 3145
diff changeset
278 (defun describe-prefix-bindings ()
3982
e50f7b531c7f (describe-prefix-bindings): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 3980
diff changeset
279 "Describe the bindings of the prefix used to reach this command.
e50f7b531c7f (describe-prefix-bindings): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 3980
diff changeset
280 The prefix described consists of all but the last event
e50f7b531c7f (describe-prefix-bindings): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 3980
diff changeset
281 of the key sequence that ran this command."
3980
bf2d4294a1dd (describe-prefix-bindings): New command.
Richard M. Stallman <rms@gnu.org>
parents: 3145
diff changeset
282 (interactive)
11890
543a76aa50b9 (describe-prefix-bindings): If key is a string,
Karl Heuer <kwzh@gnu.org>
parents: 11524
diff changeset
283 (let* ((key (this-command-keys)))
543a76aa50b9 (describe-prefix-bindings): If key is a string,
Karl Heuer <kwzh@gnu.org>
parents: 11524
diff changeset
284 (describe-bindings
543a76aa50b9 (describe-prefix-bindings): If key is a string,
Karl Heuer <kwzh@gnu.org>
parents: 11524
diff changeset
285 (if (stringp key)
543a76aa50b9 (describe-prefix-bindings): If key is a string,
Karl Heuer <kwzh@gnu.org>
parents: 11524
diff changeset
286 (substring key 0 (1- (length key)))
543a76aa50b9 (describe-prefix-bindings): If key is a string,
Karl Heuer <kwzh@gnu.org>
parents: 11524
diff changeset
287 (let ((prefix (make-vector (1- (length key)) nil))
543a76aa50b9 (describe-prefix-bindings): If key is a string,
Karl Heuer <kwzh@gnu.org>
parents: 11524
diff changeset
288 (i 0))
543a76aa50b9 (describe-prefix-bindings): If key is a string,
Karl Heuer <kwzh@gnu.org>
parents: 11524
diff changeset
289 (while (< i (length prefix))
543a76aa50b9 (describe-prefix-bindings): If key is a string,
Karl Heuer <kwzh@gnu.org>
parents: 11524
diff changeset
290 (aset prefix i (aref key i))
543a76aa50b9 (describe-prefix-bindings): If key is a string,
Karl Heuer <kwzh@gnu.org>
parents: 11524
diff changeset
291 (setq i (1+ i)))
543a76aa50b9 (describe-prefix-bindings): If key is a string,
Karl Heuer <kwzh@gnu.org>
parents: 11524
diff changeset
292 prefix)))))
39728
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
293 ;; Make C-h after a prefix, when not specifically bound,
3982
e50f7b531c7f (describe-prefix-bindings): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 3980
diff changeset
294 ;; run describe-prefix-bindings.
3980
bf2d4294a1dd (describe-prefix-bindings): New command.
Richard M. Stallman <rms@gnu.org>
parents: 3145
diff changeset
295 (setq prefix-help-command 'describe-prefix-bindings)
bf2d4294a1dd (describe-prefix-bindings): New command.
Richard M. Stallman <rms@gnu.org>
parents: 3145
diff changeset
296
21210
2a51a4912199 (view-emacs-news): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents: 21188
diff changeset
297 (defun view-emacs-news (&optional arg)
2a51a4912199 (view-emacs-news): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents: 21188
diff changeset
298 "Display info on recent changes to Emacs.
30920
67bba5cea7bf (view-emacs-news): Rewritten for new naming scheme
Gerd Moellmann <gerd@gnu.org>
parents: 30819
diff changeset
299 With numeric argument, display information on correspondingly older changes."
21210
2a51a4912199 (view-emacs-news): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents: 21188
diff changeset
300 (interactive "P")
30920
67bba5cea7bf (view-emacs-news): Rewritten for new naming scheme
Gerd Moellmann <gerd@gnu.org>
parents: 30819
diff changeset
301 (let* ((arg (if arg (prefix-numeric-value arg) 0))
67bba5cea7bf (view-emacs-news): Rewritten for new naming scheme
Gerd Moellmann <gerd@gnu.org>
parents: 30819
diff changeset
302 (file (cond ((eq arg 0) "NEWS")
67bba5cea7bf (view-emacs-news): Rewritten for new naming scheme
Gerd Moellmann <gerd@gnu.org>
parents: 30819
diff changeset
303 ((eq arg 1) "ONEWS")
67bba5cea7bf (view-emacs-news): Rewritten for new naming scheme
Gerd Moellmann <gerd@gnu.org>
parents: 30819
diff changeset
304 (t
67bba5cea7bf (view-emacs-news): Rewritten for new naming scheme
Gerd Moellmann <gerd@gnu.org>
parents: 30819
diff changeset
305 (nth (- arg 2)
67bba5cea7bf (view-emacs-news): Rewritten for new naming scheme
Gerd Moellmann <gerd@gnu.org>
parents: 30819
diff changeset
306 (nreverse (directory-files data-directory
33147
826a062813f4 (view-emacs-news): Use ONEWS.* instead of NEWS.* files.
Gerd Moellmann <gerd@gnu.org>
parents: 32706
diff changeset
307 nil "^ONEWS\\.[0-9]+$"
30920
67bba5cea7bf (view-emacs-news): Rewritten for new naming scheme
Gerd Moellmann <gerd@gnu.org>
parents: 30819
diff changeset
308 nil)))))))
67bba5cea7bf (view-emacs-news): Rewritten for new naming scheme
Gerd Moellmann <gerd@gnu.org>
parents: 30819
diff changeset
309 (if file
67bba5cea7bf (view-emacs-news): Rewritten for new naming scheme
Gerd Moellmann <gerd@gnu.org>
parents: 30819
diff changeset
310 (find-file-read-only (expand-file-name file data-directory))
67bba5cea7bf (view-emacs-news): Rewritten for new naming scheme
Gerd Moellmann <gerd@gnu.org>
parents: 30819
diff changeset
311 (error "No such old news"))))
409
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
312
36277
ab9c82e64020 (view-order-manuals): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36249
diff changeset
313 (defun view-order-manuals ()
ab9c82e64020 (view-order-manuals): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36249
diff changeset
314 "Display the Emacs ORDERS file."
ab9c82e64020 (view-order-manuals): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36249
diff changeset
315 (interactive)
36398
f20c9b522f1d (view-order-manuals): Use goto-address.
Gerd Moellmann <gerd@gnu.org>
parents: 36277
diff changeset
316 (find-file-read-only (expand-file-name "ORDERS" data-directory))
f20c9b522f1d (view-order-manuals): Use goto-address.
Gerd Moellmann <gerd@gnu.org>
parents: 36277
diff changeset
317 (goto-address))
36277
ab9c82e64020 (view-order-manuals): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 36249
diff changeset
318
10923
fe008aef4cf1 (view-emacs-FAQ): New function. Bind to C-h F.
Richard M. Stallman <rms@gnu.org>
parents: 10622
diff changeset
319 (defun view-emacs-FAQ ()
fe008aef4cf1 (view-emacs-FAQ): New function. Bind to C-h F.
Richard M. Stallman <rms@gnu.org>
parents: 10622
diff changeset
320 "Display the Emacs Frequently Asked Questions (FAQ) file."
fe008aef4cf1 (view-emacs-FAQ): New function. Bind to C-h F.
Richard M. Stallman <rms@gnu.org>
parents: 10622
diff changeset
321 (interactive)
39786
f50214c096af (describe-bindings-internal): New fun moved from keymap.c.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39728
diff changeset
322 ;; (find-file-read-only (expand-file-name "FAQ" data-directory))
28935
0a2323529cff (view-emacs-FAQ): Change `emacs-faq' to `efaq'.
Gerd Moellmann <gerd@gnu.org>
parents: 28909
diff changeset
323 (info "(efaq)"))
10923
fe008aef4cf1 (view-emacs-FAQ): New function. Bind to C-h F.
Richard M. Stallman <rms@gnu.org>
parents: 10622
diff changeset
324
26757
6af9f1dc59c4 (view-emacs-problems): New command, bound to C-h P.
Dave Love <fx@gnu.org>
parents: 26650
diff changeset
325 (defun view-emacs-problems ()
6af9f1dc59c4 (view-emacs-problems): New command, bound to C-h P.
Dave Love <fx@gnu.org>
parents: 26650
diff changeset
326 "Display info on known problems with Emacs and possible workarounds."
6af9f1dc59c4 (view-emacs-problems): New command, bound to C-h P.
Dave Love <fx@gnu.org>
parents: 26650
diff changeset
327 (interactive)
6af9f1dc59c4 (view-emacs-problems): New command, bound to C-h P.
Dave Love <fx@gnu.org>
parents: 26650
diff changeset
328 (view-file (expand-file-name "PROBLEMS" data-directory)))
6af9f1dc59c4 (view-emacs-problems): New command, bound to C-h P.
Dave Love <fx@gnu.org>
parents: 26650
diff changeset
329
409
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
330 (defun view-lossage ()
36975
d0fab2f2af5a (view-lossage): Mention open-dribble-file in the doc
Eli Zaretskii <eliz@gnu.org>
parents: 36777
diff changeset
331 "Display last 100 input keystrokes.
d0fab2f2af5a (view-lossage): Mention open-dribble-file in the doc
Eli Zaretskii <eliz@gnu.org>
parents: 36777
diff changeset
332
d0fab2f2af5a (view-lossage): Mention open-dribble-file in the doc
Eli Zaretskii <eliz@gnu.org>
parents: 36777
diff changeset
333 To record all your input on a file, use `open-dribble-file'."
409
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
334 (interactive)
39789
e511f555920c (view-lossage): Call help-setup-xref correctly and earlier.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39786
diff changeset
335 (help-setup-xref (list #'view-lossage) (interactive-p))
e511f555920c (view-lossage): Call help-setup-xref correctly and earlier.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39786
diff changeset
336 (with-output-to-temp-buffer (help-buffer)
8504
8c492f23ee28 (view-lossage): Handle buffers and frames in recent-keys.
Richard M. Stallman <rms@gnu.org>
parents: 8259
diff changeset
337 (princ (mapconcat (function (lambda (key)
8c492f23ee28 (view-lossage): Handle buffers and frames in recent-keys.
Richard M. Stallman <rms@gnu.org>
parents: 8259
diff changeset
338 (if (or (integerp key)
8c492f23ee28 (view-lossage): Handle buffers and frames in recent-keys.
Richard M. Stallman <rms@gnu.org>
parents: 8259
diff changeset
339 (symbolp key)
8c492f23ee28 (view-lossage): Handle buffers and frames in recent-keys.
Richard M. Stallman <rms@gnu.org>
parents: 8259
diff changeset
340 (listp key))
8c492f23ee28 (view-lossage): Handle buffers and frames in recent-keys.
Richard M. Stallman <rms@gnu.org>
parents: 8259
diff changeset
341 (single-key-description key)
8c492f23ee28 (view-lossage): Handle buffers and frames in recent-keys.
Richard M. Stallman <rms@gnu.org>
parents: 8259
diff changeset
342 (prin1-to-string key nil))))
8c492f23ee28 (view-lossage): Handle buffers and frames in recent-keys.
Richard M. Stallman <rms@gnu.org>
parents: 8259
diff changeset
343 (recent-keys)
8c492f23ee28 (view-lossage): Handle buffers and frames in recent-keys.
Richard M. Stallman <rms@gnu.org>
parents: 8259
diff changeset
344 " "))
39659
4bd383bb2137 (help-mode): Use define-derived-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39651
diff changeset
345 (with-current-buffer standard-output
409
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
346 (goto-char (point-min))
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
347 (while (progn (move-to-column 50) (not (eobp)))
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
348 (search-forward " " nil t)
39789
e511f555920c (view-lossage): Call help-setup-xref correctly and earlier.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39786
diff changeset
349 (insert "\n")))
409
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
350 (print-help-return-message)))
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
351
39728
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
352
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
353 ;; Key bindings
409
671fceb3316b Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
354
22325
baef082e5d6d (help-setup-xref): Change all callers to
Karl Heuer <kwzh@gnu.org>
parents: 22234
diff changeset
355 (defun describe-bindings (&optional prefix buffer)
20848
4c3e62fe8898 (describe-bindings): New command (formerly in keymap.c).
Richard M. Stallman <rms@gnu.org>
parents: 20290
diff changeset
356 "Show a list of all defined keys, and their definitions.
4c3e62fe8898 (describe-bindings): New command (formerly in keymap.c).
Richard M. Stallman <rms@gnu.org>
parents: 20290
diff changeset
357 We put that list in a buffer, and display the buffer.
4c3e62fe8898 (describe-bindings): New command (formerly in keymap.c).
Richard M. Stallman <rms@gnu.org>
parents: 20290
diff changeset
358
4c3e62fe8898 (describe-bindings): New command (formerly in keymap.c).
Richard M. Stallman <rms@gnu.org>
parents: 20290
diff changeset
359 The optional argument PREFIX, if non-nil, should be a key sequence;
22325
baef082e5d6d (help-setup-xref): Change all callers to
Karl Heuer <kwzh@gnu.org>
parents: 22234
diff changeset
360 then we display only bindings that start with that prefix.
baef082e5d6d (help-setup-xref): Change all callers to
Karl Heuer <kwzh@gnu.org>
parents: 22234
diff changeset
361 The optional argument BUFFER specifies which buffer's bindings
baef082e5d6d (help-setup-xref): Change all callers to
Karl Heuer <kwzh@gnu.org>
parents: 22234
diff changeset
362 to display (default, the current buffer)."
39789
e511f555920c (view-lossage): Call help-setup-xref correctly and earlier.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39786
diff changeset
363 (interactive)
22325
baef082e5d6d (help-setup-xref): Change all callers to
Karl Heuer <kwzh@gnu.org>
parents: 22234
diff changeset
364 (or buffer (setq buffer (current-buffer)))
39789
e511f555920c (view-lossage): Call help-setup-xref correctly and earlier.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39786
diff changeset
365 (help-setup-xref (list #'describe-bindings prefix buffer) (interactive-p))
22325
baef082e5d6d (help-setup-xref): Change all callers to
Karl Heuer <kwzh@gnu.org>
parents: 22234
diff changeset
366 (with-current-buffer buffer
39789
e511f555920c (view-lossage): Call help-setup-xref correctly and earlier.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39786
diff changeset
367 (describe-bindings-internal nil prefix)))
20848
4c3e62fe8898 (describe-bindings): New command (formerly in keymap.c).
Richard M. Stallman <rms@gnu.org>
parents: 20290
diff changeset
368
39786
f50214c096af (describe-bindings-internal): New fun moved from keymap.c.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39728
diff changeset
369 ;; This function used to be in keymap.c.
f50214c096af (describe-bindings-internal): New fun moved from keymap.c.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39728
diff changeset
370 (defun describe-bindings-internal (&optional menus prefix)
f50214c096af (describe-bindings-internal): New fun moved from keymap.c.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39728
diff changeset
371 "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>
parents: 39728
diff changeset
372 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>
parents: 39728
diff changeset
373
f50214c096af (describe-bindings-internal): New fun moved from keymap.c.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39728
diff changeset
374 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>
parents: 39728
diff changeset
375 \(Ordinarily these are omitted from the output.)
f50214c096af (describe-bindings-internal): New fun moved from keymap.c.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39728
diff changeset
376 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>
parents: 39728
diff changeset
377 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>
parents: 39728
diff changeset
378 (interactive)
f50214c096af (describe-bindings-internal): New fun moved from keymap.c.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39728
diff changeset
379 (let ((buf (current-buffer)))
f50214c096af (describe-bindings-internal): New fun moved from keymap.c.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39728
diff changeset
380 (with-output-to-temp-buffer "*Help*"
f50214c096af (describe-bindings-internal): New fun moved from keymap.c.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39728
diff changeset
381 (with-current-buffer standard-output
f50214c096af (describe-bindings-internal): New fun moved from keymap.c.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39728
diff changeset
382 (describe-buffer-bindings buf prefix menus)))))
f50214c096af (describe-bindings-internal): New fun moved from keymap.c.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39728
diff changeset
383
17917
2a41f677885f (describe-key-briefly, where-is): Prefix arg means
Richard M. Stallman <rms@gnu.org>
parents: 17756
diff changeset
384 (defun where-is (definition &optional insert)
24079
11e777f59a1f (help-make-xrefs): Avoid infloop in keymap substitutions
Dave Love <fx@gnu.org>
parents: 24055
diff changeset
385 "Print message listing key sequences that invoke the command DEFINITION.
17917
2a41f677885f (describe-key-briefly, where-is): Prefix arg means
Richard M. Stallman <rms@gnu.org>
parents: 17756
diff changeset
386 Argument is a command definition, usually a symbol with a function definition.
2a41f677885f (describe-key-briefly, where-is): Prefix arg means
Richard M. Stallman <rms@gnu.org>
parents: 17756
diff changeset
387 If INSERT (the prefix arg) is non-nil, insert the message in the buffer."
6476
2e28b96d5b64 (where-is): New function.
Richard M. Stallman <rms@gnu.org>
parents: 6433
diff changeset
388 (interactive
2e28b96d5b64 (where-is): New function.
Richard M. Stallman <rms@gnu.org>
parents: 6433
diff changeset
389 (let ((fn (function-called-at-point))
39728
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
390 (enable-recursive-minibuffers t)
6476
2e28b96d5b64 (where-is): New function.
Richard M. Stallman <rms@gnu.org>
parents: 6433
diff changeset
391 val)
2e28b96d5b64 (where-is): New function.
Richard M. Stallman <rms@gnu.org>
parents: 6433
diff changeset
392 (setq val (completing-read (if fn
2e28b96d5b64 (where-is): New function.
Richard M. Stallman <rms@gnu.org>
parents: 6433
diff changeset
393 (format "Where is command (default %s): " fn)
2e28b96d5b64 (where-is): New function.
Richard M. Stallman <rms@gnu.org>
parents: 6433
diff changeset
394 "Where is command: ")
26805
45e359e91cbb 1999-12-11 Samir Barjoud <samir@mindspring.com>
Dave Love <fx@gnu.org>
parents: 26757
diff changeset
395 obarray 'commandp t))
6476
2e28b96d5b64 (where-is): New function.
Richard M. Stallman <rms@gnu.org>
parents: 6433
diff changeset
396 (list (if (equal val "")
17917
2a41f677885f (describe-key-briefly, where-is): Prefix arg means
Richard M. Stallman <rms@gnu.org>
parents: 17756
diff changeset
397 fn (intern val))
2a41f677885f (describe-key-briefly, where-is): Prefix arg means
Richard M. Stallman <rms@gnu.org>
parents: 17756
diff changeset
398 current-prefix-arg)))
6476
2e28b96d5b64 (where-is): New function.
Richard M. Stallman <rms@gnu.org>
parents: 6433
diff changeset
399 (let* ((keys (where-is-internal definition overriding-local-map nil nil))
17917
2a41f677885f (describe-key-briefly, where-is): Prefix arg means
Richard M. Stallman <rms@gnu.org>
parents: 17756
diff changeset
400 (keys1 (mapconcat 'key-description keys ", "))
2a41f677885f (describe-key-briefly, where-is): Prefix arg means
Richard M. Stallman <rms@gnu.org>
parents: 17756
diff changeset
401 (standard-output (if insert (current-buffer) t)))
2a41f677885f (describe-key-briefly, where-is): Prefix arg means
Richard M. Stallman <rms@gnu.org>
parents: 17756
diff changeset
402 (if insert
2a41f677885f (describe-key-briefly, where-is): Prefix arg means
Richard M. Stallman <rms@gnu.org>
parents: 17756
diff changeset
403 (if (> (length keys1) 0)
2a41f677885f (describe-key-briefly, where-is): Prefix arg means
Richard M. Stallman <rms@gnu.org>
parents: 17756
diff changeset
404 (princ (format "%s (%s)" keys1 definition))
2a41f677885f (describe-key-briefly, where-is): Prefix arg means
Richard M. Stallman <rms@gnu.org>
parents: 17756
diff changeset
405 (princ (format "M-x %s RET" definition)))
2a41f677885f (describe-key-briefly, where-is): Prefix arg means
Richard M. Stallman <rms@gnu.org>
parents: 17756
diff changeset
406 (if (> (length keys1) 0)
2a41f677885f (describe-key-briefly, where-is): Prefix arg means
Richard M. Stallman <rms@gnu.org>
parents: 17756
diff changeset
407 (princ (format "%s is on %s" definition keys1))
2a41f677885f (describe-key-briefly, where-is): Prefix arg means
Richard M. Stallman <rms@gnu.org>
parents: 17756
diff changeset
408 (princ (format "%s is not on any key" definition)))))
6476
2e28b96d5b64 (where-is): New function.
Richard M. Stallman <rms@gnu.org>
parents: 6433
diff changeset
409 nil)
2e28b96d5b64 (where-is): New function.
Richard M. Stallman <rms@gnu.org>
parents: 6433
diff changeset
410
39728
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
411 (defun string-key-binding (key)
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
412 "Value is the binding of KEY in a string.
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
413 If KEY is an event on a string, and that string has a `local-map'
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
414 or `keymap' property, return the binding of KEY in the string's keymap."
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
415 (let* ((defn nil)
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
416 (start (when (vectorp key)
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
417 (if (memq (aref key 0) '(mode-line header-line))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
418 (event-start (aref key 1))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
419 (and (consp (aref key 0))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
420 (event-start (aref key 0))))))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
421 (string-info (and (consp start) (nth 4 start))))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
422 (when string-info
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
423 (let* ((string (car string-info))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
424 (pos (cdr string-info))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
425 (local-map (and (> pos 0)
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
426 (< pos (length string))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
427 (or (get-text-property pos 'local-map string)
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
428 (get-text-property pos 'keymap string)))))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
429 (setq defn (and local-map (lookup-key local-map key)))))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
430 defn))
24079
11e777f59a1f (help-make-xrefs): Avoid infloop in keymap substitutions
Dave Love <fx@gnu.org>
parents: 24055
diff changeset
431
39728
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
432 (defun describe-key-briefly (key &optional insert)
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
433 "Print the name of the function KEY invokes. KEY is a string.
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
434 If INSERT (the prefix arg) is non-nil, insert the message in the buffer."
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
435 (interactive "kDescribe key briefly: \nP")
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
436 (save-excursion
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
437 (let ((modifiers (event-modifiers (aref key 0)))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
438 (standard-output (if insert (current-buffer) t))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
439 window position)
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
440 ;; For a mouse button event, go to the button it applies to
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
441 ;; to get the right key bindings. And go to the right place
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
442 ;; in case the keymap depends on where you clicked.
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
443 (if (or (memq 'click modifiers) (memq 'down modifiers)
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
444 (memq 'drag modifiers))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
445 (setq window (posn-window (event-start (aref key 0)))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
446 position (posn-point (event-start (aref key 0)))))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
447 (if (windowp window)
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
448 (progn
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
449 (set-buffer (window-buffer window))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
450 (goto-char position)))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
451 ;; Ok, now look up the key and name the command.
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
452 (let ((defn (or (string-key-binding key)
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
453 (key-binding key)))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
454 (key-desc (key-description key)))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
455 (if (or (null defn) (integerp defn))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
456 (princ (format "%s is undefined" key-desc))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
457 (princ (format (if insert
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
458 "`%s' (`%s')"
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
459 (if (windowp window)
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
460 "%s at that spot runs the command %s"
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
461 "%s runs the command %s"))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
462 key-desc
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
463 (if (symbolp defn) defn (prin1-to-string defn)))))))))
31243
30007aab98df (help-xref-mule-regexp): New variable
Kenichi Handa <handa@m17n.org>
parents: 30920
diff changeset
464
30007aab98df (help-xref-mule-regexp): New variable
Kenichi Handa <handa@m17n.org>
parents: 30920
diff changeset
465
39728
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
466 (defun describe-key (key)
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
467 "Display documentation of the function invoked by KEY. KEY is a string."
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
468 (interactive "kDescribe key: ")
21371
22a3be0ae9dc (help-highlight-face): Use underline.
Richard M. Stallman <rms@gnu.org>
parents: 21210
diff changeset
469 (save-excursion
39728
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
470 (let ((modifiers (event-modifiers (aref key 0)))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
471 window position)
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
472 ;; For a mouse button event, go to the button it applies to
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
473 ;; to get the right key bindings. And go to the right place
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
474 ;; in case the keymap depends on where you clicked.
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
475 (if (or (memq 'click modifiers) (memq 'down modifiers)
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
476 (memq 'drag modifiers))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
477 (setq window (posn-window (event-start (aref key 0)))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
478 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>
parents: 39728
diff changeset
479 (when (windowp window)
39728
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
480 (set-buffer (window-buffer window))
39786
f50214c096af (describe-bindings-internal): New fun moved from keymap.c.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39728
diff changeset
481 (goto-char position))
39728
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
482 (let ((defn (or (string-key-binding key) (key-binding key))))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
483 (if (or (null defn) (integerp defn))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
484 (message "%s is undefined" (key-description key))
39789
e511f555920c (view-lossage): Call help-setup-xref correctly and earlier.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39786
diff changeset
485 (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>
parents: 39786
diff changeset
486 (with-output-to-temp-buffer (help-buffer)
39728
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
487 (princ (key-description key))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
488 (if (windowp window)
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
489 (princ " at that spot"))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
490 (princ " runs the command ")
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
491 (prin1 defn)
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
492 (princ "\n which is ")
39789
e511f555920c (view-lossage): Call help-setup-xref correctly and earlier.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39786
diff changeset
493 (describe-function-1 defn)
39728
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
494 (print-help-return-message)))))))
31422
2a7aafb126fb (help-make-xrefs): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents: 31397
diff changeset
495
21371
22a3be0ae9dc (help-highlight-face): Use underline.
Richard M. Stallman <rms@gnu.org>
parents: 21210
diff changeset
496
39728
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
497 (defun describe-mode (&optional buffer)
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
498 "Display documentation of current major mode and minor modes.
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
499 The major mode description comes first, followed by the minor modes,
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
500 each on a separate page.
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
501 For this to work correctly for a minor mode, the mode's indicator variable
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
502 \(listed in `minor-mode-alist') must also be a function whose documentation
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
503 describes the minor mode."
21371
22a3be0ae9dc (help-highlight-face): Use underline.
Richard M. Stallman <rms@gnu.org>
parents: 21210
diff changeset
504 (interactive)
39728
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
505 (when buffer (set-buffer buffer))
39789
e511f555920c (view-lossage): Call help-setup-xref correctly and earlier.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39786
diff changeset
506 (help-setup-xref (list #'describe-mode (current-buffer)) (interactive-p))
e511f555920c (view-lossage): Call help-setup-xref correctly and earlier.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39786
diff changeset
507 (with-output-to-temp-buffer (help-buffer)
39728
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
508 (when minor-mode-alist
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
509 (princ "The major mode is described first.
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
510 For minor modes, see following pages.\n\n"))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
511 (princ mode-name)
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
512 (princ " mode:\n")
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
513 (princ (documentation major-mode))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
514 (let ((minor-modes minor-mode-alist))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
515 (while minor-modes
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
516 (let* ((minor-mode (car (car minor-modes)))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
517 (indicator (car (cdr (car minor-modes)))))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
518 ;; Document a minor mode if it is listed in minor-mode-alist,
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
519 ;; bound locally in this buffer, non-nil, and has a function
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
520 ;; definition.
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
521 (if (and (boundp minor-mode)
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
522 (symbol-value minor-mode)
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
523 (fboundp minor-mode))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
524 (let ((pretty-minor-mode minor-mode))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
525 (if (string-match "\\(-minor\\)?-mode\\'"
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
526 (symbol-name minor-mode))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
527 (setq pretty-minor-mode
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
528 (capitalize
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
529 (substring (symbol-name minor-mode)
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
530 0 (match-beginning 0)))))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
531 (while (and indicator (symbolp indicator)
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
532 (boundp indicator)
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
533 (not (eq indicator (symbol-value indicator))))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
534 (setq indicator (symbol-value indicator)))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
535 (princ "\n\f\n")
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
536 (princ (format "%s minor mode (%s):\n"
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
537 pretty-minor-mode
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
538 (if indicator
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
539 (format "indicator%s" indicator)
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
540 "no indicator")))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
541 (princ (documentation minor-mode)))))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
542 (setq minor-modes (cdr minor-modes))))
570d86d34c32 Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents: 39659
diff changeset
543 (print-help-return-message)))
21371
22a3be0ae9dc (help-highlight-face): Use underline.
Richard M. Stallman <rms@gnu.org>
parents: 21210
diff changeset
544
23747
fb3963445995 Add resizing of temporary buffers.
Richard M. Stallman <rms@gnu.org>
parents: 23742
diff changeset
545
fb3963445995 Add resizing of temporary buffers.
Richard M. Stallman <rms@gnu.org>
parents: 23742
diff changeset
546 ;;; Automatic resizing of temporary buffers.
fb3963445995 Add resizing of temporary buffers.
Richard M. Stallman <rms@gnu.org>
parents: 23742
diff changeset
547
23749
ea095fa15fb9 Rename function and variables added in previous change:
Richard M. Stallman <rms@gnu.org>
parents: 23747
diff changeset
548 (defcustom temp-buffer-max-height (lambda (buffer) (/ (- (frame-height) 2) 2))
23747
fb3963445995 Add resizing of temporary buffers.
Richard M. Stallman <rms@gnu.org>
parents: 23742
diff changeset
549 "*Maximum height of a window displaying a temporary buffer.
fb3963445995 Add resizing of temporary buffers.
Richard M. Stallman <rms@gnu.org>
parents: 23742
diff changeset
550 This is the maximum height (in text lines) which `resize-temp-buffer-window'
fb3963445995 Add resizing of temporary buffers.
Richard M. Stallman <rms@gnu.org>
parents: 23742
diff changeset
551 will give to a window displaying a temporary buffer.
fb3963445995 Add resizing of temporary buffers.
Richard M. Stallman <rms@gnu.org>
parents: 23742
diff changeset
552 It can also be a function which will be called with the object corresponding
fb3963445995 Add resizing of temporary buffers.
Richard M. Stallman <rms@gnu.org>
parents: 23742
diff changeset
553 to the buffer to be displayed as argument and should return an integer
fb3963445995 Add resizing of temporary buffers.
Richard M. Stallman <rms@gnu.org>
parents: 23742
diff changeset
554 positive number."
fb3963445995 Add resizing of temporary buffers.
Richard M. Stallman <rms@gnu.org>
parents: 23742
diff changeset
555 :type '(choice integer function)
fb3963445995 Add resizing of temporary buffers.
Richard M. Stallman <rms@gnu.org>
parents: 23742
diff changeset
556 :group 'help
fb3963445995 Add resizing of temporary buffers.
Richard M. Stallman <rms@gnu.org>
parents: 23742
diff changeset
557 :version "20.4")
fb3963445995 Add resizing of temporary buffers.
Richard M. Stallman <rms@gnu.org>
parents: 23742
diff changeset
558
32183
3e4bdf7c90c4 (help-xref-on-pp): Use match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31491
diff changeset
559 (define-minor-mode temp-buffer-resize-mode
3e4bdf7c90c4 (help-xref-on-pp): Use match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31491
diff changeset
560 "Toggle the mode which makes windows smaller for temporary buffers.
23747
fb3963445995 Add resizing of temporary buffers.
Richard M. Stallman <rms@gnu.org>
parents: 23742
diff changeset
561 With prefix argument ARG, turn the resizing of windows displaying temporary
fb3963445995 Add resizing of temporary buffers.
Richard M. Stallman <rms@gnu.org>
parents: 23742
diff changeset
562 buffers on if ARG is positive or off otherwise.
32183
3e4bdf7c90c4 (help-xref-on-pp): Use match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31491
diff changeset
563 This makes the window the right height for its contents, but never
3e4bdf7c90c4 (help-xref-on-pp): Use match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31491
diff changeset
564 more than `temp-buffer-max-height' nor less than `window-min-height'.
3e4bdf7c90c4 (help-xref-on-pp): Use match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31491
diff changeset
565 This applies to `help', `apropos' and `completion' buffers, and some others."
39659
4bd383bb2137 (help-mode): Use define-derived-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39651
diff changeset
566 :global t :group 'help
32183
3e4bdf7c90c4 (help-xref-on-pp): Use match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31491
diff changeset
567 (if temp-buffer-resize-mode
36249
c96d6054a03e Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 35233
diff changeset
568 ;; `help-make-xrefs' may add a `back' button and thus increase the
32183
3e4bdf7c90c4 (help-xref-on-pp): Use match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31491
diff changeset
569 ;; text size, so `resize-temp-buffer-window' must be run *after* it.
3e4bdf7c90c4 (help-xref-on-pp): Use match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 31491
diff changeset
570 (add-hook 'temp-buffer-show-hook 'resize-temp-buffer-window 'append)
32184
ab059a552fa2 Missing paren.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 32183
diff changeset
571 (remove-hook 'temp-buffer-show-hook 'resize-temp-buffer-window)))
23747
fb3963445995 Add resizing of temporary buffers.
Richard M. Stallman <rms@gnu.org>
parents: 23742
diff changeset
572
fb3963445995 Add resizing of temporary buffers.
Richard M. Stallman <rms@gnu.org>
parents: 23742
diff changeset
573 (defun resize-temp-buffer-window ()
fb3963445995 Add resizing of temporary buffers.
Richard M. Stallman <rms@gnu.org>
parents: 23742
diff changeset
574 "Resize the current window to fit its contents.
23749
ea095fa15fb9 Rename function and variables added in previous change:
Richard M. Stallman <rms@gnu.org>
parents: 23747
diff changeset
575 Will not make it higher than `temp-buffer-max-height' nor smaller than
24079
11e777f59a1f (help-make-xrefs): Avoid infloop in keymap substitutions
Dave Love <fx@gnu.org>
parents: 24055
diff changeset
576 `window-min-height'. Do nothing if it is the only window on its frame, if it
23747
fb3963445995 Add resizing of temporary buffers.
Richard M. Stallman <rms@gnu.org>
parents: 23742
diff changeset
577 is not as wide as the frame or if some of the window's contents are scrolled
fb3963445995 Add resizing of temporary buffers.
Richard M. Stallman <rms@gnu.org>
parents: 23742
diff changeset
578 out of view."
fb3963445995 Add resizing of temporary buffers.
Richard M. Stallman <rms@gnu.org>
parents: 23742
diff changeset
579 (unless (or (one-window-p 'nomini)
fb3963445995 Add resizing of temporary buffers.
Richard M. Stallman <rms@gnu.org>
parents: 23742
diff changeset
580 (not (pos-visible-in-window-p (point-min)))
fb3963445995 Add resizing of temporary buffers.
Richard M. Stallman <rms@gnu.org>
parents: 23742
diff changeset
581 (/= (frame-width) (window-width)))
32706
605eabd04a57 (resize-temp-buffer-window): Use `fit-window-to-buffer'.
Miles Bader <miles@gnu.org>
parents: 32690
diff changeset
582 (fit-window-to-buffer
605eabd04a57 (resize-temp-buffer-window): Use `fit-window-to-buffer'.
Miles Bader <miles@gnu.org>
parents: 32690
diff changeset
583 (selected-window)
605eabd04a57 (resize-temp-buffer-window): Use `fit-window-to-buffer'.
Miles Bader <miles@gnu.org>
parents: 32690
diff changeset
584 (if (functionp temp-buffer-max-height)
605eabd04a57 (resize-temp-buffer-window): Use `fit-window-to-buffer'.
Miles Bader <miles@gnu.org>
parents: 32690
diff changeset
585 (funcall temp-buffer-max-height (current-buffer))
605eabd04a57 (resize-temp-buffer-window): Use `fit-window-to-buffer'.
Miles Bader <miles@gnu.org>
parents: 32690
diff changeset
586 temp-buffer-max-height))))
23747
fb3963445995 Add resizing of temporary buffers.
Richard M. Stallman <rms@gnu.org>
parents: 23742
diff changeset
587
32540
4150b1424eb9 Provide `help' for the sake of define-minor-mode
Gerd Moellmann <gerd@gnu.org>
parents: 32184
diff changeset
588 ;; Provide this for the sake of define-minor-mode which generates
4150b1424eb9 Provide `help' for the sake of define-minor-mode
Gerd Moellmann <gerd@gnu.org>
parents: 32184
diff changeset
589 ;; defcustoms which require 'help'.
4150b1424eb9 Provide `help' for the sake of define-minor-mode
Gerd Moellmann <gerd@gnu.org>
parents: 32184
diff changeset
590 (provide 'help)
4150b1424eb9 Provide `help' for the sake of define-minor-mode
Gerd Moellmann <gerd@gnu.org>
parents: 32184
diff changeset
591
660
08eb386dd0f3 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 444
diff changeset
592 ;;; help.el ends here