Mercurial > emacs
annotate lisp/help.el @ 111691:3aa829f74a48
Fix compilation on Windows following revno 102488.
config.nt (EXTERNALLY_VISIBLE): Define.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Tue, 23 Nov 2010 22:21:16 +0200 |
parents | 811daa44285f |
children | 417b1e4d63cd |
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 |
64762
41bb365f41c4
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64091
diff
changeset
|
3 ;; Copyright (C) 1985, 1986, 1993, 1994, 1998, 1999, 2000, 2001, 2002, |
111097
811daa44285f
* lisp/help.el (finder-by-keyword): Remove unnecessary autoload.
Glenn Morris <rgm@gnu.org>
parents:
110015
diff
changeset
|
4 ;; 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 |
811daa44285f
* lisp/help.el (finder-by-keyword): Remove unnecessary autoload.
Glenn Morris <rgm@gnu.org>
parents:
110015
diff
changeset
|
5 ;; Free Software Foundation, Inc. |
846
20674ae6bf52
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
811
diff
changeset
|
6 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
755
diff
changeset
|
7 ;; Maintainer: FSF |
811
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
807
diff
changeset
|
8 ;; Keywords: help, internal |
110015
280c8ae2476d
Add "Package:" file headers to denote built-in packages.
Chong Yidong <cyd@stupidchicken.com>
parents:
109992
diff
changeset
|
9 ;; Package: emacs |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
755
diff
changeset
|
10 |
409 | 11 ;; This file is part of GNU Emacs. |
12 | |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
92787
diff
changeset
|
13 ;; GNU Emacs is free software: you can redistribute it and/or modify |
409 | 14 ;; it under the terms of the GNU General Public License as published by |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
92787
diff
changeset
|
15 ;; the Free Software Foundation, either version 3 of the License, or |
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
92787
diff
changeset
|
16 ;; (at your option) any later version. |
409 | 17 |
18 ;; GNU Emacs is distributed in the hope that it will be useful, | |
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 ;; GNU General Public License for more details. | |
22 | |
23 ;; You should have received a copy of the GNU General Public License | |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
92787
diff
changeset
|
24 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
409 | 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 |
86005
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
41 ;; The variable `help-window' below is used by `help-mode-finish' to |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
42 ;; communicate the window displaying help (the "help window") to the |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
43 ;; macro `with-help-window'. The latter sets `help-window' to t before |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
44 ;; invoking `with-output-to-temp-buffer'. If and only if `help-window' |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
45 ;; is eq to t, `help-mode-finish' (called by `temp-buffer-setup-hook') |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
46 ;; sets `help-window' to the window selected by `display-buffer'. |
104367
13e0436a968a
(help-print-return-message): Rename from print-help-return-message.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
101182
diff
changeset
|
47 ;; Exiting `with-help-window' and calling `help-print-return-message' |
86005
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
48 ;; reset `help-window' to nil. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
49 (defvar help-window nil |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
50 "Window chosen for displaying help.") |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
51 |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
52 ;; `help-window-point-marker' is a marker you can move to a valid |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
53 ;; position of the buffer shown in the help window in order to override |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
54 ;; the standard positioning mechanism (`point-min') chosen by |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
55 ;; `with-output-to-temp-buffer'. `with-help-window' has this point |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
56 ;; nowhere before exiting. Currently used by `view-lossage' to assert |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
57 ;; that the last keystrokes are always visible. |
92349
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
58 (defvar help-window-point-marker (make-marker) |
86005
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
59 "Marker to override default `window-point' of `help-window'.") |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
60 |
67224
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
61 (defvar help-map |
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
62 (let ((map (make-sparse-keymap))) |
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
63 (define-key map (char-to-string help-char) 'help-for-help) |
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
64 (define-key map [help] 'help-for-help) |
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
65 (define-key map [f1] 'help-for-help) |
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
66 (define-key map "." 'display-local-help) |
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
67 (define-key map "?" 'help-for-help) |
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
68 |
79368
d91beda3b06e
(help-map, help-for-help-internal): Add `C-h C-a'.
Juri Linkov <juri@jurta.org>
parents:
78418
diff
changeset
|
69 (define-key map "\C-a" 'about-emacs) |
67224
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
70 (define-key map "\C-c" 'describe-copying) |
92349
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
71 (define-key map "\C-d" 'view-emacs-debugging) |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
72 (define-key map "\C-e" 'view-external-packages) |
67224
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
73 (define-key map "\C-f" 'view-emacs-FAQ) |
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
74 (define-key map "\C-m" 'view-order-manuals) |
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
75 (define-key map "\C-n" 'view-emacs-news) |
92349
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
76 (define-key map "\C-o" 'describe-distribution) |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
77 (define-key map "\C-p" 'view-emacs-problems) |
80288
dc8ff8d15986
(view-emacs-todo): Rename from view-todo. Change users.
Kim F. Storm <storm@cua.dk>
parents:
79721
diff
changeset
|
78 (define-key map "\C-t" 'view-emacs-todo) |
67224
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
79 (define-key map "\C-w" 'describe-no-warranty) |
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
80 |
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
81 ;; This does not fit the pattern, but it is natural given the C-\ command. |
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
82 (define-key map "\C-\\" 'describe-input-method) |
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
83 |
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
84 (define-key map "C" 'describe-coding-system) |
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
85 (define-key map "F" 'Info-goto-emacs-command-node) |
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
86 (define-key map "I" 'describe-input-method) |
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
87 (define-key map "K" 'Info-goto-emacs-key-command-node) |
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
88 (define-key map "L" 'describe-language-environment) |
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
89 (define-key map "S" 'info-lookup-symbol) |
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
90 |
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
91 (define-key map "a" 'apropos-command) |
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
92 (define-key map "b" 'describe-bindings) |
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
93 (define-key map "c" 'describe-key-briefly) |
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
94 (define-key map "d" 'apropos-documentation) |
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
95 (define-key map "e" 'view-echo-area-messages) |
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
96 (define-key map "f" 'describe-function) |
92349
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
97 (define-key map "g" 'describe-gnu-project) |
67224
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
98 (define-key map "h" 'view-hello-file) |
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
99 |
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
100 (define-key map "i" 'info) |
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
101 (define-key map "4i" 'info-other-window) |
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
102 |
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
103 (define-key map "k" 'describe-key) |
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
104 (define-key map "l" 'view-lossage) |
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
105 (define-key map "m" 'describe-mode) |
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
106 (define-key map "n" 'view-emacs-news) |
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
107 (define-key map "p" 'finder-by-keyword) |
109992
640cdeb464c1
Improvements to describe-package buffer.
Chong Yidong <cyd@stupidchicken.com>
parents:
109302
diff
changeset
|
108 (define-key map "P" 'describe-package) |
67224
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
109 (define-key map "r" 'info-emacs-manual) |
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
110 (define-key map "s" 'describe-syntax) |
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
111 (define-key map "t" 'help-with-tutorial) |
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
112 (define-key map "w" 'where-is) |
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
113 (define-key map "v" 'describe-variable) |
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
114 (define-key map "q" 'help-quit) |
1a4439fe2adc
(help-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67204
diff
changeset
|
115 map) |
409 | 116 "Keymap for characters following the Help key.") |
117 | |
919 | 118 (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
|
119 (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
|
120 (define-key global-map [f1] 'help-command) |
409 | 121 (fset 'help-command help-map) |
122 | |
57485
32dab1aa8b9a
(describe-mode): Use marker buttons to make minor mode list into hyperlinks.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
56883
diff
changeset
|
123 ;; insert-button makes the action nil if it is not store somewhere |
32dab1aa8b9a
(describe-mode): Use marker buttons to make minor mode list into hyperlinks.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
56883
diff
changeset
|
124 (defvar help-button-cache nil) |
32dab1aa8b9a
(describe-mode): Use marker buttons to make minor mode list into hyperlinks.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
56883
diff
changeset
|
125 |
39651
444f50200adc
(help-mode-map): Make button-buffer-map our parent.
Miles Bader <miles@gnu.org>
parents:
39512
diff
changeset
|
126 |
6580 | 127 (defun help-quit () |
23333 | 128 "Just exit from the Help command's command loop." |
6580 | 129 (interactive) |
130 nil) | |
131 | |
21188
607ce9d7cf53
(help-mode-maybe): Set view-return-to-alist.
Richard M. Stallman <rms@gnu.org>
parents:
20953
diff
changeset
|
132 (defvar help-return-method nil |
607ce9d7cf53
(help-mode-maybe): Set view-return-to-alist.
Richard M. Stallman <rms@gnu.org>
parents:
20953
diff
changeset
|
133 "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
|
134 This is a list |
67279
8cf27ba1d450
(print-help-return-message): If pop-up-frames is non-nil, set up
Eli Zaretskii <eliz@gnu.org>
parents:
67224
diff
changeset
|
135 (WINDOW . t) delete the selected window (and possibly its frame, |
8cf27ba1d450
(print-help-return-message): If pop-up-frames is non-nil, set up
Eli Zaretskii <eliz@gnu.org>
parents:
67224
diff
changeset
|
136 see `quit-window' and `View-quit'), go to WINDOW. |
21188
607ce9d7cf53
(help-mode-maybe): Set view-return-to-alist.
Richard M. Stallman <rms@gnu.org>
parents:
20953
diff
changeset
|
137 (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
|
138 (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
|
139 |
104367
13e0436a968a
(help-print-return-message): Rename from print-help-return-message.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
101182
diff
changeset
|
140 (define-obsolete-function-alias 'print-help-return-message 'help-print-return-message "23.2") |
13e0436a968a
(help-print-return-message): Rename from print-help-return-message.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
101182
diff
changeset
|
141 (defun help-print-return-message (&optional function) |
409 | 142 "Display or return message saying how to restore windows after help command. |
46329
081502d6dd98
(help-map): Add binding for info-emacs-manual.
Richard M. Stallman <rms@gnu.org>
parents:
45070
diff
changeset
|
143 This function assumes that `standard-output' is the help buffer. |
081502d6dd98
(help-map): Add binding for info-emacs-manual.
Richard M. Stallman <rms@gnu.org>
parents:
45070
diff
changeset
|
144 It computes a message, and applies the optional argument FUNCTION to it. |
67279
8cf27ba1d450
(print-help-return-message): If pop-up-frames is non-nil, set up
Eli Zaretskii <eliz@gnu.org>
parents:
67224
diff
changeset
|
145 If FUNCTION is nil, it applies `message', thus displaying the message. |
8cf27ba1d450
(print-help-return-message): If pop-up-frames is non-nil, set up
Eli Zaretskii <eliz@gnu.org>
parents:
67224
diff
changeset
|
146 In addition, this function sets up `help-return-method', which see, that |
8cf27ba1d450
(print-help-return-message): If pop-up-frames is non-nil, set up
Eli Zaretskii <eliz@gnu.org>
parents:
67224
diff
changeset
|
147 specifies what to do when the user exits the help buffer." |
86005
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
148 ;; Reset `help-window' here to avoid confusing `help-mode-finish'. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
149 (setq help-window nil) |
409 | 150 (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
|
151 (let ((first-message |
67279
8cf27ba1d450
(print-help-return-message): If pop-up-frames is non-nil, set up
Eli Zaretskii <eliz@gnu.org>
parents:
67224
diff
changeset
|
152 (cond ((or |
8cf27ba1d450
(print-help-return-message): If pop-up-frames is non-nil, set up
Eli Zaretskii <eliz@gnu.org>
parents:
67224
diff
changeset
|
153 pop-up-frames |
8cf27ba1d450
(print-help-return-message): If pop-up-frames is non-nil, set up
Eli Zaretskii <eliz@gnu.org>
parents:
67224
diff
changeset
|
154 (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
|
155 (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
|
156 ;; 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
|
157 ;; 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
|
158 ;; 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
|
159 ;; manager, not with Emacs. |
604d89082229
(print-help-return-message): If help buffer is a
Richard M. Stallman <rms@gnu.org>
parents:
7978
diff
changeset
|
160 ;; 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
|
161 ;; 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
|
162 nil) |
30667
2bd60ea8076f
(print-help-return-message): When
Gerd Moellmann <gerd@gnu.org>
parents:
30621
diff
changeset
|
163 (display-buffer-reuse-frames |
2bd60ea8076f
(print-help-return-message): When
Gerd Moellmann <gerd@gnu.org>
parents:
30621
diff
changeset
|
164 (setq help-return-method (cons (selected-window) |
2bd60ea8076f
(print-help-return-message): When
Gerd Moellmann <gerd@gnu.org>
parents:
30621
diff
changeset
|
165 'quit-window)) |
2bd60ea8076f
(print-help-return-message): When
Gerd Moellmann <gerd@gnu.org>
parents:
30621
diff
changeset
|
166 nil) |
8259
604d89082229
(print-help-return-message): If help buffer is a
Richard M. Stallman <rms@gnu.org>
parents:
7978
diff
changeset
|
167 ((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
|
168 (setq help-return-method |
607ce9d7cf53
(help-mode-maybe): Set view-return-to-alist.
Richard M. Stallman <rms@gnu.org>
parents:
20953
diff
changeset
|
169 (cons (selected-window) 'quit-window)) |
69674
1d0de172f9fa
(print-help-return-message): Suggest to use display-buffer instead of
Eli Zaretskii <eliz@gnu.org>
parents:
69335
diff
changeset
|
170 "Type \\[display-buffer] RET to restore the other window.") |
8259
604d89082229
(print-help-return-message): If help buffer is a
Richard M. Stallman <rms@gnu.org>
parents:
7978
diff
changeset
|
171 (pop-up-windows |
21188
607ce9d7cf53
(help-mode-maybe): Set view-return-to-alist.
Richard M. Stallman <rms@gnu.org>
parents:
20953
diff
changeset
|
172 (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
|
173 "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
|
174 (t |
21188
607ce9d7cf53
(help-mode-maybe): Set view-return-to-alist.
Richard M. Stallman <rms@gnu.org>
parents:
20953
diff
changeset
|
175 (setq help-return-method |
607ce9d7cf53
(help-mode-maybe): Set view-return-to-alist.
Richard M. Stallman <rms@gnu.org>
parents:
20953
diff
changeset
|
176 (list (selected-window) (window-buffer) |
607ce9d7cf53
(help-mode-maybe): Set view-return-to-alist.
Richard M. Stallman <rms@gnu.org>
parents:
20953
diff
changeset
|
177 (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
|
178 "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
|
179 (funcall (or function 'message) |
604d89082229
(print-help-return-message): If help buffer is a
Richard M. Stallman <rms@gnu.org>
parents:
7978
diff
changeset
|
180 (concat |
604d89082229
(print-help-return-message): If help buffer is a
Richard M. Stallman <rms@gnu.org>
parents:
7978
diff
changeset
|
181 (if first-message |
28909 | 182 (substitute-command-keys first-message)) |
183 (if first-message " ") | |
11524
cafa503e806c
(print-help-return-message): Check same-window-buffer-names
Richard M. Stallman <rms@gnu.org>
parents:
11428
diff
changeset
|
184 ;; 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
|
185 ;; it's no use mentioning a command to scroll, so don't. |
67281
409eae14f7d9
(print-help-return-message): If pop-up-frames is non-nil, don't display
Eli Zaretskii <eliz@gnu.org>
parents:
67279
diff
changeset
|
186 (if (or pop-up-windows |
409eae14f7d9
(print-help-return-message): If pop-up-frames is non-nil, don't display
Eli Zaretskii <eliz@gnu.org>
parents:
67279
diff
changeset
|
187 (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
|
188 nil |
16391
5d64d742ccbb
(print-help-return-message): Use new functions `special-display-p' and
Erik Naggum <erik@naggum.no>
parents:
16273
diff
changeset
|
189 (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
|
190 ;; 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
|
191 (substitute-command-keys |
cafa503e806c
(print-help-return-message): Check same-window-buffer-names
Richard M. Stallman <rms@gnu.org>
parents:
11428
diff
changeset
|
192 "\\[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
|
193 ;; 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
|
194 (substitute-command-keys |
11524
cafa503e806c
(print-help-return-message): Check same-window-buffer-names
Richard M. Stallman <rms@gnu.org>
parents:
11428
diff
changeset
|
195 "\\[scroll-other-window] to scroll the help.")))))))) |
409 | 196 |
197 ;; So keyboard macro definitions are documented correctly | |
198 (fset 'defining-kbd-macro (symbol-function 'start-kbd-macro)) | |
199 | |
60006
dfc2b4718048
(help-for-help-internal): Renamed from help-for-help.
Richard M. Stallman <rms@gnu.org>
parents:
59926
diff
changeset
|
200 (defalias 'help 'help-for-help-internal) |
dfc2b4718048
(help-for-help-internal): Renamed from help-for-help.
Richard M. Stallman <rms@gnu.org>
parents:
59926
diff
changeset
|
201 ;; find-function can find this. |
dfc2b4718048
(help-for-help-internal): Renamed from help-for-help.
Richard M. Stallman <rms@gnu.org>
parents:
59926
diff
changeset
|
202 (defalias 'help-for-help 'help-for-help-internal) |
dfc2b4718048
(help-for-help-internal): Renamed from help-for-help.
Richard M. Stallman <rms@gnu.org>
parents:
59926
diff
changeset
|
203 ;; It can't find this, but nobody will look. |
dfc2b4718048
(help-for-help-internal): Renamed from help-for-help.
Richard M. Stallman <rms@gnu.org>
parents:
59926
diff
changeset
|
204 (make-help-screen help-for-help-internal |
105016
8604318df7f9
* bindings.el (mode-line-mode-menu): Add purecopy calls for :help.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104367
diff
changeset
|
205 (purecopy "Type a help option: [abcCdefFgiIkKlLmnprstvw.] C-[cdefmnoptw] or ?") |
105216
fb7e59394e9b
* help.el (help-for-help-internal): Don't purecopy the text (bug#4560).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105016
diff
changeset
|
206 ;; Don't purecopy this one, because it's not evaluated (it's |
fb7e59394e9b
* help.el (help-for-help-internal): Don't purecopy the text (bug#4560).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105016
diff
changeset
|
207 ;; directly used as a docstring in a function definition, so it'll |
fb7e59394e9b
* help.el (help-for-help-internal): Don't purecopy the text (bug#4560).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105016
diff
changeset
|
208 ;; be moved to the DOC file anyway: no need for purecopying it). |
39728
570d86d34c32
Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents:
39659
diff
changeset
|
209 "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
|
210 \(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
|
211 |
92349
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
212 a PATTERN Show commands whose name matches the PATTERN (a list of words |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
213 or a regexp). See also the `apropos' command. |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
214 b Display all key bindings. |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
215 c KEYS Display the command name run by the given key sequence. |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
216 C CODING Describe the given coding system, or RET for current ones. |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
217 d PATTERN Show a list of functions, variables, and other items whose |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
218 documentation matches the PATTERN (a list of words or a regexp). |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
219 e Go to the *Messages* buffer which logs echo-area messages. |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
220 f FUNCTION Display documentation for the given function. |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
221 F COMMAND Show the on-line manual's section that describes the command. |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
222 g Display information about the GNU project. |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
223 h Display the HELLO file which illustrates various scripts. |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
224 i Start the Info documentation reader: read on-line manuals. |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
225 I METHOD Describe a specific input method, or RET for current. |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
226 k KEYS Display the full documentation for the key sequence. |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
227 K KEYS Show the on-line manual's section for the command bound to KEYS. |
100684
1f761e07b952
(help-for-help-internal): Fix entry for "l".
Martin Rudalics <rudalics@gmx.at>
parents:
98621
diff
changeset
|
228 l Show last 300 input keystrokes (lossage). |
92349
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
229 L LANG-ENV Describes a specific language environment, or RET for current. |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
230 m Display documentation of current minor modes and current major mode, |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
231 including their special commands. |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
232 n Display news of recent Emacs changes. |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
233 p TOPIC Find packages matching a given topic keyword. |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
234 r Display the Emacs manual in Info mode. |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
235 s Display contents of current syntax table, plus explanations. |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
236 S SYMBOL Show the section for the given symbol in the on-line manual |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
237 for the programming language used in this buffer. |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
238 t Start the Emacs learn-by-doing tutorial. |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
239 v VARIABLE Display the given variable's documentation and value. |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
240 w COMMAND Display which keystrokes invoke the given command (where-is). |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
241 . Display any available local help at point in the echo area. |
39728
570d86d34c32
Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents:
39659
diff
changeset
|
242 |
92349
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
243 C-a Information about Emacs. |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
244 C-c Emacs copying permission (GNU General Public License). |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
245 C-d Instructions for debugging GNU Emacs. |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
246 C-e External packages and information about Emacs. |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
247 C-f Emacs FAQ. |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
248 C-m How to order printed Emacs manuals. |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
249 C-n News of recent Emacs changes. |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
250 C-o Emacs ordering and distribution information. |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
251 C-p Info about known Emacs problems. |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
252 C-t Emacs TODO list. |
105216
fb7e59394e9b
* help.el (help-for-help-internal): Don't purecopy the text (bug#4560).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105016
diff
changeset
|
253 C-w Information on absence of warranty for GNU Emacs." |
39728
570d86d34c32
Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents:
39659
diff
changeset
|
254 help-map) |
570d86d34c32
Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents:
39659
diff
changeset
|
255 |
570d86d34c32
Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents:
39659
diff
changeset
|
256 |
570d86d34c32
Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents:
39659
diff
changeset
|
257 |
570d86d34c32
Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents:
39659
diff
changeset
|
258 (defun function-called-at-point () |
570d86d34c32
Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents:
39659
diff
changeset
|
259 "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
|
260 If that doesn't give a function, return nil." |
95601
0f9baaf9427f
* help.el (function-called-at-point):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
261 (with-syntax-table emacs-lisp-mode-syntax-table |
0f9baaf9427f
* help.el (function-called-at-point):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
262 (or (condition-case () |
0f9baaf9427f
* help.el (function-called-at-point):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
263 (save-excursion |
0f9baaf9427f
* help.el (function-called-at-point):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
264 (or (not (zerop (skip-syntax-backward "_w"))) |
0f9baaf9427f
* help.el (function-called-at-point):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
265 (eq (char-syntax (following-char)) ?w) |
0f9baaf9427f
* help.el (function-called-at-point):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
266 (eq (char-syntax (following-char)) ?_) |
0f9baaf9427f
* help.el (function-called-at-point):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
267 (forward-sexp -1)) |
0f9baaf9427f
* help.el (function-called-at-point):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
268 (skip-chars-forward "'") |
0f9baaf9427f
* help.el (function-called-at-point):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
269 (let ((obj (read (current-buffer)))) |
0f9baaf9427f
* help.el (function-called-at-point):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
270 (and (symbolp obj) (fboundp obj) obj))) |
0f9baaf9427f
* help.el (function-called-at-point):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
271 (error nil)) |
0f9baaf9427f
* help.el (function-called-at-point):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
272 (condition-case () |
0f9baaf9427f
* help.el (function-called-at-point):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
273 (save-excursion |
0f9baaf9427f
* help.el (function-called-at-point):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
274 (save-restriction |
0f9baaf9427f
* help.el (function-called-at-point):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
275 (narrow-to-region (max (point-min) |
0f9baaf9427f
* help.el (function-called-at-point):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
276 (- (point) 1000)) (point-max)) |
0f9baaf9427f
* help.el (function-called-at-point):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
277 ;; Move up to surrounding paren, then after the open. |
0f9baaf9427f
* help.el (function-called-at-point):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
278 (backward-up-list 1) |
0f9baaf9427f
* help.el (function-called-at-point):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
279 (forward-char 1) |
0f9baaf9427f
* help.el (function-called-at-point):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
280 ;; If there is space here, this is probably something |
0f9baaf9427f
* help.el (function-called-at-point):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
281 ;; other than a real Lisp function call, so ignore it. |
0f9baaf9427f
* help.el (function-called-at-point):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
282 (if (looking-at "[ \t]") |
0f9baaf9427f
* help.el (function-called-at-point):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
283 (error "Probably not a Lisp function call")) |
0f9baaf9427f
* help.el (function-called-at-point):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
284 (let ((obj (read (current-buffer)))) |
0f9baaf9427f
* help.el (function-called-at-point):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
285 (and (symbolp obj) (fboundp obj) obj)))) |
0f9baaf9427f
* help.el (function-called-at-point):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
286 (error nil)) |
0f9baaf9427f
* help.el (function-called-at-point):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
287 (let* ((str (find-tag-default)) |
0f9baaf9427f
* help.el (function-called-at-point):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
288 (sym (if str (intern-soft str)))) |
0f9baaf9427f
* help.el (function-called-at-point):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
289 (if (and sym (fboundp sym)) |
0f9baaf9427f
* help.el (function-called-at-point):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
290 sym |
0f9baaf9427f
* help.el (function-called-at-point):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
291 (save-match-data |
0f9baaf9427f
* help.el (function-called-at-point):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
292 (when (and str (string-match "\\`\\W*\\(.*?\\)\\W*\\'" str)) |
0f9baaf9427f
* help.el (function-called-at-point):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
293 (setq sym (intern-soft (match-string 1 str))) |
0f9baaf9427f
* help.el (function-called-at-point):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
294 (and (fboundp sym) sym)))))))) |
39728
570d86d34c32
Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents:
39659
diff
changeset
|
295 |
570d86d34c32
Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents:
39659
diff
changeset
|
296 |
570d86d34c32
Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents:
39659
diff
changeset
|
297 ;;; `User' help functions |
570d86d34c32
Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents:
39659
diff
changeset
|
298 |
92349
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
299 (defun view-help-file (file &optional dir) |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
300 (view-file (expand-file-name file (or dir data-directory))) |
101182
1b1c8dcb77b9
(view-help-file): Use goto-address-mode instead of goto-address.
Juri Linkov <juri@jurta.org>
parents:
100908
diff
changeset
|
301 (goto-address-mode 1) |
92349
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
302 (goto-char (point-min))) |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
303 |
409 | 304 (defun describe-distribution () |
305 "Display info on how to obtain the latest version of GNU Emacs." | |
306 (interactive) | |
92349
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
307 (view-help-file "DISTRIB")) |
409 | 308 |
309 (defun describe-copying () | |
310 "Display info on how you may redistribute copies of GNU Emacs." | |
311 (interactive) | |
92349
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
312 (view-help-file "COPYING")) |
409 | 313 |
80288
dc8ff8d15986
(view-emacs-todo): Rename from view-todo. Change users.
Kim F. Storm <storm@cua.dk>
parents:
79721
diff
changeset
|
314 (defun describe-gnu-project () |
5025
0556b068e9ee
(describe-project): New function, on C-h C-p.
Richard M. Stallman <rms@gnu.org>
parents:
4467
diff
changeset
|
315 "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
|
316 (interactive) |
92349
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
317 (view-help-file "THE-GNU-PROJECT")) |
5025
0556b068e9ee
(describe-project): New function, on C-h C-p.
Richard M. Stallman <rms@gnu.org>
parents:
4467
diff
changeset
|
318 |
80288
dc8ff8d15986
(view-emacs-todo): Rename from view-todo. Change users.
Kim F. Storm <storm@cua.dk>
parents:
79721
diff
changeset
|
319 (define-obsolete-function-alias 'describe-project 'describe-gnu-project "22.2") |
dc8ff8d15986
(view-emacs-todo): Rename from view-todo. Change users.
Kim F. Storm <storm@cua.dk>
parents:
79721
diff
changeset
|
320 |
409 | 321 (defun describe-no-warranty () |
322 "Display info on all the kinds of warranty Emacs does NOT have." | |
323 (interactive) | |
324 (describe-copying) | |
325 (let (case-fold-search) | |
105498
3cdeeb563149
Markus Rost <rost at math.uni-bielefeld.de>
Glenn Morris <rgm@gnu.org>
parents:
105372
diff
changeset
|
326 (search-forward "Disclaimer of Warranty") |
3cdeeb563149
Markus Rost <rost at math.uni-bielefeld.de>
Glenn Morris <rgm@gnu.org>
parents:
105372
diff
changeset
|
327 (forward-line 0) |
409 | 328 (recenter 0))) |
329 | |
3980
bf2d4294a1dd
(describe-prefix-bindings): New command.
Richard M. Stallman <rms@gnu.org>
parents:
3145
diff
changeset
|
330 (defun describe-prefix-bindings () |
3982
e50f7b531c7f
(describe-prefix-bindings): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
3980
diff
changeset
|
331 "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
|
332 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
|
333 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
|
334 (interactive) |
72920
380408390d43
(describe-prefix-bindings): Use let, not let*.
Eli Zaretskii <eliz@gnu.org>
parents:
72911
diff
changeset
|
335 (let ((key (this-command-keys))) |
11890
543a76aa50b9
(describe-prefix-bindings): If key is a string,
Karl Heuer <kwzh@gnu.org>
parents:
11524
diff
changeset
|
336 (describe-bindings |
543a76aa50b9
(describe-prefix-bindings): If key is a string,
Karl Heuer <kwzh@gnu.org>
parents:
11524
diff
changeset
|
337 (if (stringp key) |
543a76aa50b9
(describe-prefix-bindings): If key is a string,
Karl Heuer <kwzh@gnu.org>
parents:
11524
diff
changeset
|
338 (substring key 0 (1- (length key))) |
543a76aa50b9
(describe-prefix-bindings): If key is a string,
Karl Heuer <kwzh@gnu.org>
parents:
11524
diff
changeset
|
339 (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
|
340 (i 0)) |
543a76aa50b9
(describe-prefix-bindings): If key is a string,
Karl Heuer <kwzh@gnu.org>
parents:
11524
diff
changeset
|
341 (while (< i (length prefix)) |
543a76aa50b9
(describe-prefix-bindings): If key is a string,
Karl Heuer <kwzh@gnu.org>
parents:
11524
diff
changeset
|
342 (aset prefix i (aref key i)) |
543a76aa50b9
(describe-prefix-bindings): If key is a string,
Karl Heuer <kwzh@gnu.org>
parents:
11524
diff
changeset
|
343 (setq i (1+ i))) |
543a76aa50b9
(describe-prefix-bindings): If key is a string,
Karl Heuer <kwzh@gnu.org>
parents:
11524
diff
changeset
|
344 prefix))))) |
39728
570d86d34c32
Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents:
39659
diff
changeset
|
345 ;; 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
|
346 ;; run describe-prefix-bindings. |
3980
bf2d4294a1dd
(describe-prefix-bindings): New command.
Richard M. Stallman <rms@gnu.org>
parents:
3145
diff
changeset
|
347 (setq prefix-help-command 'describe-prefix-bindings) |
bf2d4294a1dd
(describe-prefix-bindings): New command.
Richard M. Stallman <rms@gnu.org>
parents:
3145
diff
changeset
|
348 |
71206
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
349 (defun view-emacs-news (&optional version) |
21210
2a51a4912199
(view-emacs-news): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
21188
diff
changeset
|
350 "Display info on recent changes to Emacs. |
55172
a1210c6fc77b
(view-emacs-news): With argument, display info for the
Juri Linkov <juri@jurta.org>
parents:
54815
diff
changeset
|
351 With argument, display info only for the selected version." |
21210
2a51a4912199
(view-emacs-news): Handle prefix arg.
Richard M. Stallman <rms@gnu.org>
parents:
21188
diff
changeset
|
352 (interactive "P") |
71206
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
353 (unless version |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
354 (setq version emacs-major-version)) |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
355 (when (consp version) |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
356 (let* ((all-versions |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
357 (let (res) |
84871
534e99349c41
(view-emacs-news): Use `mapc' rather than `mapcar'.
Juanma Barranquero <lekktu@gmail.com>
parents:
79368
diff
changeset
|
358 (mapc |
71206
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
359 (lambda (file) |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
360 (with-temp-buffer |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
361 (insert-file-contents |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
362 (expand-file-name file data-directory)) |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
363 (while (re-search-forward |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
364 (if (member file '("NEWS.18" "NEWS.1-17")) |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
365 "Changes in \\(?:Emacs\\|version\\)?[ \t]*\\([0-9]+\\(?:\\.[0-9]+\\)?\\)" |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
366 "^\* [^0-9\n]*\\([0-9]+\\.[0-9]+\\)") nil t) |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
367 (setq res (cons (match-string-no-properties 1) res))))) |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
368 (cons "NEWS" |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
369 (directory-files data-directory nil |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
370 "^NEWS\\.[0-9][-0-9]*$" nil))) |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
371 (sort (delete-dups res) (lambda (a b) (string< b a))))) |
71487
e5f156e5a1b6
(view-emacs-news): Declare `res' in the right let* form.
Kim F. Storm <storm@cua.dk>
parents:
71306
diff
changeset
|
372 (current (car all-versions))) |
71206
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
373 (setq version (completing-read |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
374 (format "Read NEWS for the version (default %s): " current) |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
375 all-versions nil nil nil nil current)) |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
376 (if (integerp (string-to-number version)) |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
377 (setq version (string-to-number version)) |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
378 (unless (or (member version all-versions) |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
379 (<= (string-to-number version) (string-to-number current))) |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
380 (error "No news about version %s" version))))) |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
381 (when (integerp version) |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
382 (cond ((<= version 12) |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
383 (setq version (format "1.%d" version))) |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
384 ((<= version 18) |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
385 (setq version (format "%d" version))) |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
386 ((> version emacs-major-version) |
73759
6a147e17a7cd
(view-emacs-news): Fix typo in error message.
Juanma Barranquero <lekktu@gmail.com>
parents:
73233
diff
changeset
|
387 (error "No news about Emacs %d (yet)" version)))) |
71206
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
388 (let* ((vn (if (stringp version) |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
389 (string-to-number version) |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
390 version)) |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
391 (file (cond |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
392 ((>= vn emacs-major-version) "NEWS") |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
393 ((< vn 18) "NEWS.1-17") |
71487
e5f156e5a1b6
(view-emacs-news): Declare `res' in the right let* form.
Kim F. Storm <storm@cua.dk>
parents:
71306
diff
changeset
|
394 (t (format "NEWS.%d" vn)))) |
e5f156e5a1b6
(view-emacs-news): Declare `res' in the right let* form.
Kim F. Storm <storm@cua.dk>
parents:
71306
diff
changeset
|
395 res) |
71206
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
396 (view-file (expand-file-name file data-directory)) |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
397 (widen) |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
398 (goto-char (point-min)) |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
399 (when (stringp version) |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
400 (when (re-search-forward |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
401 (concat (if (< vn 19) |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
402 "Changes in Emacs[ \t]*" |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
403 "^\* [^0-9\n]*") version "$") |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
404 nil t) |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
405 (beginning-of-line) |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
406 (narrow-to-region |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
407 (point) |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
408 (save-excursion |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
409 (while (and (setq res |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
410 (re-search-forward |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
411 (if (< vn 19) |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
412 "Changes in \\(?:Emacs\\|version\\)?[ \t]*\\([0-9]+\\(?:\\.[0-9]+\\)?\\)" |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
413 "^\* [^0-9\n]*\\([0-9]+\\.[0-9]+\\)") nil t)) |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
414 (equal (match-string-no-properties 1) version))) |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
415 (or res (goto-char (point-max))) |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
416 (beginning-of-line) |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
417 (point))))))) |
07072bab2769
(view-emacs-news): Rewrite to support new NEWS,
Kim F. Storm <storm@cua.dk>
parents:
71080
diff
changeset
|
418 |
80288
dc8ff8d15986
(view-emacs-todo): Rename from view-todo. Change users.
Kim F. Storm <storm@cua.dk>
parents:
79721
diff
changeset
|
419 (defun view-emacs-todo (&optional arg) |
45070
fbd816e9e27d
(view-todo): New function.
Richard M. Stallman <rms@gnu.org>
parents:
44537
diff
changeset
|
420 "Display the Emacs TODO list." |
fbd816e9e27d
(view-todo): New function.
Richard M. Stallman <rms@gnu.org>
parents:
44537
diff
changeset
|
421 (interactive "P") |
92349
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
422 (view-help-file "TODO")) |
45070
fbd816e9e27d
(view-todo): New function.
Richard M. Stallman <rms@gnu.org>
parents:
44537
diff
changeset
|
423 |
80288
dc8ff8d15986
(view-emacs-todo): Rename from view-todo. Change users.
Kim F. Storm <storm@cua.dk>
parents:
79721
diff
changeset
|
424 (define-obsolete-function-alias 'view-todo 'view-emacs-todo "22.2") |
dc8ff8d15986
(view-emacs-todo): Rename from view-todo. Change users.
Kim F. Storm <storm@cua.dk>
parents:
79721
diff
changeset
|
425 |
dc8ff8d15986
(view-emacs-todo): Rename from view-todo. Change users.
Kim F. Storm <storm@cua.dk>
parents:
79721
diff
changeset
|
426 |
42735
86919cd01cdd
(view-echo-area-messages): New function.
Richard M. Stallman <rms@gnu.org>
parents:
42679
diff
changeset
|
427 (defun view-echo-area-messages () |
86919cd01cdd
(view-echo-area-messages): New function.
Richard M. Stallman <rms@gnu.org>
parents:
42679
diff
changeset
|
428 "View the log of recent echo-area messages: the `*Messages*' buffer. |
86919cd01cdd
(view-echo-area-messages): New function.
Richard M. Stallman <rms@gnu.org>
parents:
42679
diff
changeset
|
429 The number of messages retained in that buffer |
86919cd01cdd
(view-echo-area-messages): New function.
Richard M. Stallman <rms@gnu.org>
parents:
42679
diff
changeset
|
430 is specified by the variable `message-log-max'." |
86919cd01cdd
(view-echo-area-messages): New function.
Richard M. Stallman <rms@gnu.org>
parents:
42679
diff
changeset
|
431 (interactive) |
86919cd01cdd
(view-echo-area-messages): New function.
Richard M. Stallman <rms@gnu.org>
parents:
42679
diff
changeset
|
432 (switch-to-buffer (get-buffer-create "*Messages*"))) |
86919cd01cdd
(view-echo-area-messages): New function.
Richard M. Stallman <rms@gnu.org>
parents:
42679
diff
changeset
|
433 |
36277
ab9c82e64020
(view-order-manuals): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36249
diff
changeset
|
434 (defun view-order-manuals () |
ab9c82e64020
(view-order-manuals): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36249
diff
changeset
|
435 "Display the Emacs ORDERS file." |
ab9c82e64020
(view-order-manuals): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36249
diff
changeset
|
436 (interactive) |
92349
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
437 (view-help-file "ORDERS")) |
36277
ab9c82e64020
(view-order-manuals): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36249
diff
changeset
|
438 |
10923
fe008aef4cf1
(view-emacs-FAQ): New function. Bind to C-h F.
Richard M. Stallman <rms@gnu.org>
parents:
10622
diff
changeset
|
439 (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
|
440 "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
|
441 (interactive) |
39786
f50214c096af
(describe-bindings-internal): New fun moved from keymap.c.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39728
diff
changeset
|
442 ;; (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
|
443 (info "(efaq)")) |
10923
fe008aef4cf1
(view-emacs-FAQ): New function. Bind to C-h F.
Richard M. Stallman <rms@gnu.org>
parents:
10622
diff
changeset
|
444 |
26757
6af9f1dc59c4
(view-emacs-problems): New command, bound to C-h P.
Dave Love <fx@gnu.org>
parents:
26650
diff
changeset
|
445 (defun view-emacs-problems () |
6af9f1dc59c4
(view-emacs-problems): New command, bound to C-h P.
Dave Love <fx@gnu.org>
parents:
26650
diff
changeset
|
446 "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
|
447 (interactive) |
92349
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
448 (view-help-file "PROBLEMS")) |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
449 |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
450 (defun view-emacs-debugging () |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
451 "Display info on how to debug Emacs problems." |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
452 (interactive) |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
453 (view-help-file "DEBUG")) |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
454 |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
455 (defun view-external-packages () |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
456 "Display external packages and information about Emacs." |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
457 (interactive) |
ac2ad154ea14
(view-emacs-todo): Rename from view-todo.
Kim F. Storm <storm@cua.dk>
parents:
91795
diff
changeset
|
458 (view-help-file "MORE.STUFF")) |
26757
6af9f1dc59c4
(view-emacs-problems): New command, bound to C-h P.
Dave Love <fx@gnu.org>
parents:
26650
diff
changeset
|
459 |
409 | 460 (defun view-lossage () |
98621
835147d28933
* help.el (view-lossage): Fix docstring, lossage is now 300 keys.
Romain Francoise <romain@orebokech.com>
parents:
97457
diff
changeset
|
461 "Display last 300 input keystrokes. |
36975
d0fab2f2af5a
(view-lossage): Mention open-dribble-file in the doc
Eli Zaretskii <eliz@gnu.org>
parents:
36777
diff
changeset
|
462 |
d0fab2f2af5a
(view-lossage): Mention open-dribble-file in the doc
Eli Zaretskii <eliz@gnu.org>
parents:
36777
diff
changeset
|
463 To record all your input on a file, use `open-dribble-file'." |
409 | 464 (interactive) |
105372
bd2966850aac
Use `called-interactively-p' instead of `interactive-p'.
Juanma Barranquero <lekktu@gmail.com>
parents:
105216
diff
changeset
|
465 (help-setup-xref (list #'view-lossage) |
bd2966850aac
Use `called-interactively-p' instead of `interactive-p'.
Juanma Barranquero <lekktu@gmail.com>
parents:
105216
diff
changeset
|
466 (called-interactively-p 'interactive)) |
86005
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
467 (with-help-window (help-buffer) |
44332
bdf6c2baa447
(help-key-description): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43697
diff
changeset
|
468 (princ (mapconcat (lambda (key) |
bdf6c2baa447
(help-key-description): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43697
diff
changeset
|
469 (if (or (integerp key) (symbolp key) (listp key)) |
bdf6c2baa447
(help-key-description): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43697
diff
changeset
|
470 (single-key-description key) |
bdf6c2baa447
(help-key-description): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43697
diff
changeset
|
471 (prin1-to-string key nil))) |
8504
8c492f23ee28
(view-lossage): Handle buffers and frames in recent-keys.
Richard M. Stallman <rms@gnu.org>
parents:
8259
diff
changeset
|
472 (recent-keys) |
8c492f23ee28
(view-lossage): Handle buffers and frames in recent-keys.
Richard M. Stallman <rms@gnu.org>
parents:
8259
diff
changeset
|
473 " ")) |
39659
4bd383bb2137
(help-mode): Use define-derived-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39651
diff
changeset
|
474 (with-current-buffer standard-output |
409 | 475 (goto-char (point-min)) |
476 (while (progn (move-to-column 50) (not (eobp))) | |
69335
e7e05b5e771f
(view-lossage): Remove trailing whitespace before inserting "\n".
Juanma Barranquero <lekktu@gmail.com>
parents:
69327
diff
changeset
|
477 (when (search-forward " " nil t) |
e7e05b5e771f
(view-lossage): Remove trailing whitespace before inserting "\n".
Juanma Barranquero <lekktu@gmail.com>
parents:
69327
diff
changeset
|
478 (delete-char -1)) |
86005
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
479 (insert "\n")) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
480 ;; jidanni wants to see the last keystrokes immediately. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
481 (set-marker help-window-point-marker (point))))) |
409 | 482 |
39728
570d86d34c32
Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents:
39659
diff
changeset
|
483 |
570d86d34c32
Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents:
39659
diff
changeset
|
484 ;; Key bindings |
409 | 485 |
22325
baef082e5d6d
(help-setup-xref): Change all callers to
Karl Heuer <kwzh@gnu.org>
parents:
22234
diff
changeset
|
486 (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
|
487 "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
|
488 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
|
489 |
4c3e62fe8898
(describe-bindings): New command (formerly in keymap.c).
Richard M. Stallman <rms@gnu.org>
parents:
20290
diff
changeset
|
490 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
|
491 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
|
492 The optional argument BUFFER specifies which buffer's bindings |
56637
4ea7f10f1b53
(describe-bindings): Doc fix.
Luc Teirlinck <teirllm@auburn.edu>
parents:
55172
diff
changeset
|
493 to display (default, the current buffer). BUFFER can be a buffer |
4ea7f10f1b53
(describe-bindings): Doc fix.
Luc Teirlinck <teirllm@auburn.edu>
parents:
55172
diff
changeset
|
494 or a buffer name." |
39789
e511f555920c
(view-lossage): Call help-setup-xref correctly and earlier.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39786
diff
changeset
|
495 (interactive) |
22325
baef082e5d6d
(help-setup-xref): Change all callers to
Karl Heuer <kwzh@gnu.org>
parents:
22234
diff
changeset
|
496 (or buffer (setq buffer (current-buffer))) |
105372
bd2966850aac
Use `called-interactively-p' instead of `interactive-p'.
Juanma Barranquero <lekktu@gmail.com>
parents:
105216
diff
changeset
|
497 (help-setup-xref (list #'describe-bindings prefix buffer) |
bd2966850aac
Use `called-interactively-p' instead of `interactive-p'.
Juanma Barranquero <lekktu@gmail.com>
parents:
105216
diff
changeset
|
498 (called-interactively-p 'interactive)) |
22325
baef082e5d6d
(help-setup-xref): Change all callers to
Karl Heuer <kwzh@gnu.org>
parents:
22234
diff
changeset
|
499 (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
|
500 (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
|
501 |
39786
f50214c096af
(describe-bindings-internal): New fun moved from keymap.c.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39728
diff
changeset
|
502 ;; 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
|
503 (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
|
504 "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
|
505 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
|
506 |
f50214c096af
(describe-bindings-internal): New fun moved from keymap.c.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39728
diff
changeset
|
507 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
|
508 \(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
|
509 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
|
510 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
|
511 (let ((buf (current-buffer))) |
86005
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
512 (with-help-window "*Help*" |
39786
f50214c096af
(describe-bindings-internal): New fun moved from keymap.c.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39728
diff
changeset
|
513 (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
|
514 (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
|
515 |
17917
2a41f677885f
(describe-key-briefly, where-is): Prefix arg means
Richard M. Stallman <rms@gnu.org>
parents:
17756
diff
changeset
|
516 (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
|
517 "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
|
518 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
|
519 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
|
520 (interactive |
2e28b96d5b64
(where-is): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6433
diff
changeset
|
521 (let ((fn (function-called-at-point)) |
39728
570d86d34c32
Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents:
39659
diff
changeset
|
522 (enable-recursive-minibuffers t) |
6476
2e28b96d5b64
(where-is): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6433
diff
changeset
|
523 val) |
48202
50c0685806fb
(where-is): Rename map to defs (a list of syms is not a map).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48193
diff
changeset
|
524 (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>
parents:
48193
diff
changeset
|
525 (if fn |
50c0685806fb
(where-is): Rename map to defs (a list of syms is not a map).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48193
diff
changeset
|
526 (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>
parents:
48193
diff
changeset
|
527 "Where is command: ") |
50c0685806fb
(where-is): Rename map to defs (a list of syms is not a map).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48193
diff
changeset
|
528 obarray 'commandp t)) |
50c0685806fb
(where-is): Rename map to defs (a list of syms is not a map).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48193
diff
changeset
|
529 (list (if (equal val "") fn (intern val)) current-prefix-arg))) |
76232
2806691576cd
(where-is): Fail gracefully when not passed a command.
Juanma Barranquero <lekktu@gmail.com>
parents:
75347
diff
changeset
|
530 (unless definition (error "No command")) |
48193
0afe1465ac57
(where-is): Repport also aliases of the passed command.
Juanma Barranquero <lekktu@gmail.com>
parents:
46438
diff
changeset
|
531 (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>
parents:
48193
diff
changeset
|
532 (defs nil) |
48193
0afe1465ac57
(where-is): Repport also aliases of the passed command.
Juanma Barranquero <lekktu@gmail.com>
parents:
46438
diff
changeset
|
533 (standard-output (if insert (current-buffer) t))) |
60779
456199ab7d27
(where-is): Don't mention aliases with no key bindings.
Richard M. Stallman <rms@gnu.org>
parents:
60644
diff
changeset
|
534 ;; In DEFS, find all symbols that are aliases for DEFINITION. |
48202
50c0685806fb
(where-is): Rename map to defs (a list of syms is not a map).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48193
diff
changeset
|
535 (mapatoms (lambda (symbol) |
50c0685806fb
(where-is): Rename map to defs (a list of syms is not a map).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48193
diff
changeset
|
536 (and (fboundp symbol) |
50c0685806fb
(where-is): Rename map to defs (a list of syms is not a map).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48193
diff
changeset
|
537 (not (eq symbol definition)) |
49188
4e3e9d5a3332
(where-is): Catch errors in indirect-function.
Richard M. Stallman <rms@gnu.org>
parents:
48202
diff
changeset
|
538 (eq func (condition-case () |
4e3e9d5a3332
(where-is): Catch errors in indirect-function.
Richard M. Stallman <rms@gnu.org>
parents:
48202
diff
changeset
|
539 (indirect-function symbol) |
4e3e9d5a3332
(where-is): Catch errors in indirect-function.
Richard M. Stallman <rms@gnu.org>
parents:
48202
diff
changeset
|
540 (error symbol))) |
48202
50c0685806fb
(where-is): Rename map to defs (a list of syms is not a map).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48193
diff
changeset
|
541 (push symbol defs)))) |
60779
456199ab7d27
(where-is): Don't mention aliases with no key bindings.
Richard M. Stallman <rms@gnu.org>
parents:
60644
diff
changeset
|
542 ;; Look at all the symbols--first DEFINITION, |
456199ab7d27
(where-is): Don't mention aliases with no key bindings.
Richard M. Stallman <rms@gnu.org>
parents:
60644
diff
changeset
|
543 ;; then its aliases. |
456199ab7d27
(where-is): Don't mention aliases with no key bindings.
Richard M. Stallman <rms@gnu.org>
parents:
60644
diff
changeset
|
544 (dolist (symbol (cons definition defs)) |
456199ab7d27
(where-is): Don't mention aliases with no key bindings.
Richard M. Stallman <rms@gnu.org>
parents:
60644
diff
changeset
|
545 (let* ((remapped (command-remapping symbol)) |
456199ab7d27
(where-is): Don't mention aliases with no key bindings.
Richard M. Stallman <rms@gnu.org>
parents:
60644
diff
changeset
|
546 (keys (where-is-internal |
456199ab7d27
(where-is): Don't mention aliases with no key bindings.
Richard M. Stallman <rms@gnu.org>
parents:
60644
diff
changeset
|
547 symbol overriding-local-map nil nil remapped)) |
456199ab7d27
(where-is): Don't mention aliases with no key bindings.
Richard M. Stallman <rms@gnu.org>
parents:
60644
diff
changeset
|
548 (keys (mapconcat 'key-description keys ", ")) |
456199ab7d27
(where-is): Don't mention aliases with no key bindings.
Richard M. Stallman <rms@gnu.org>
parents:
60644
diff
changeset
|
549 string) |
456199ab7d27
(where-is): Don't mention aliases with no key bindings.
Richard M. Stallman <rms@gnu.org>
parents:
60644
diff
changeset
|
550 (setq string |
456199ab7d27
(where-is): Don't mention aliases with no key bindings.
Richard M. Stallman <rms@gnu.org>
parents:
60644
diff
changeset
|
551 (if insert |
456199ab7d27
(where-is): Don't mention aliases with no key bindings.
Richard M. Stallman <rms@gnu.org>
parents:
60644
diff
changeset
|
552 (if (> (length keys) 0) |
456199ab7d27
(where-is): Don't mention aliases with no key bindings.
Richard M. Stallman <rms@gnu.org>
parents:
60644
diff
changeset
|
553 (if remapped |
456199ab7d27
(where-is): Don't mention aliases with no key bindings.
Richard M. Stallman <rms@gnu.org>
parents:
60644
diff
changeset
|
554 (format "%s (%s) (remapped from %s)" |
456199ab7d27
(where-is): Don't mention aliases with no key bindings.
Richard M. Stallman <rms@gnu.org>
parents:
60644
diff
changeset
|
555 keys remapped symbol) |
456199ab7d27
(where-is): Don't mention aliases with no key bindings.
Richard M. Stallman <rms@gnu.org>
parents:
60644
diff
changeset
|
556 (format "%s (%s)" keys symbol)) |
456199ab7d27
(where-is): Don't mention aliases with no key bindings.
Richard M. Stallman <rms@gnu.org>
parents:
60644
diff
changeset
|
557 (format "M-x %s RET" symbol)) |
456199ab7d27
(where-is): Don't mention aliases with no key bindings.
Richard M. Stallman <rms@gnu.org>
parents:
60644
diff
changeset
|
558 (if (> (length keys) 0) |
456199ab7d27
(where-is): Don't mention aliases with no key bindings.
Richard M. Stallman <rms@gnu.org>
parents:
60644
diff
changeset
|
559 (if remapped |
456199ab7d27
(where-is): Don't mention aliases with no key bindings.
Richard M. Stallman <rms@gnu.org>
parents:
60644
diff
changeset
|
560 (format "%s is remapped to %s which is on %s" |
68870
9cc0a5b4b6e7
(where-is): Fix displaying of remappings.
Juanma Barranquero <lekktu@gmail.com>
parents:
68855
diff
changeset
|
561 symbol remapped keys) |
60779
456199ab7d27
(where-is): Don't mention aliases with no key bindings.
Richard M. Stallman <rms@gnu.org>
parents:
60644
diff
changeset
|
562 (format "%s is on %s" symbol keys)) |
456199ab7d27
(where-is): Don't mention aliases with no key bindings.
Richard M. Stallman <rms@gnu.org>
parents:
60644
diff
changeset
|
563 ;; If this is the command the user asked about, |
456199ab7d27
(where-is): Don't mention aliases with no key bindings.
Richard M. Stallman <rms@gnu.org>
parents:
60644
diff
changeset
|
564 ;; and it is not on any key, say so. |
456199ab7d27
(where-is): Don't mention aliases with no key bindings.
Richard M. Stallman <rms@gnu.org>
parents:
60644
diff
changeset
|
565 ;; For other symbols, its aliases, say nothing |
456199ab7d27
(where-is): Don't mention aliases with no key bindings.
Richard M. Stallman <rms@gnu.org>
parents:
60644
diff
changeset
|
566 ;; about them unless they are on keys. |
456199ab7d27
(where-is): Don't mention aliases with no key bindings.
Richard M. Stallman <rms@gnu.org>
parents:
60644
diff
changeset
|
567 (if (eq symbol definition) |
456199ab7d27
(where-is): Don't mention aliases with no key bindings.
Richard M. Stallman <rms@gnu.org>
parents:
60644
diff
changeset
|
568 (format "%s is not on any key" symbol))))) |
456199ab7d27
(where-is): Don't mention aliases with no key bindings.
Richard M. Stallman <rms@gnu.org>
parents:
60644
diff
changeset
|
569 (when string |
456199ab7d27
(where-is): Don't mention aliases with no key bindings.
Richard M. Stallman <rms@gnu.org>
parents:
60644
diff
changeset
|
570 (unless (eq symbol definition) |
456199ab7d27
(where-is): Don't mention aliases with no key bindings.
Richard M. Stallman <rms@gnu.org>
parents:
60644
diff
changeset
|
571 (princ ";\n its alias ")) |
456199ab7d27
(where-is): Don't mention aliases with no key bindings.
Richard M. Stallman <rms@gnu.org>
parents:
60644
diff
changeset
|
572 (princ string))))) |
6476
2e28b96d5b64
(where-is): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6433
diff
changeset
|
573 nil) |
2e28b96d5b64
(where-is): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6433
diff
changeset
|
574 |
44332
bdf6c2baa447
(help-key-description): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43697
diff
changeset
|
575 (defun help-key-description (key untranslated) |
bdf6c2baa447
(help-key-description): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43697
diff
changeset
|
576 (let ((string (key-description key))) |
46438
fd2419f6c4d9
(help-key-description): Show the untranslated keys
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46329
diff
changeset
|
577 (if (or (not untranslated) |
fd2419f6c4d9
(help-key-description): Show the untranslated keys
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
46329
diff
changeset
|
578 (and (eq (aref untranslated 0) ?\e) (not (eq (aref key 0) ?\e)))) |
44332
bdf6c2baa447
(help-key-description): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43697
diff
changeset
|
579 string |
bdf6c2baa447
(help-key-description): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43697
diff
changeset
|
580 (let ((otherstring (key-description untranslated))) |
bdf6c2baa447
(help-key-description): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43697
diff
changeset
|
581 (if (equal string otherstring) |
bdf6c2baa447
(help-key-description): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43697
diff
changeset
|
582 string |
bdf6c2baa447
(help-key-description): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43697
diff
changeset
|
583 (format "%s (translated from %s)" string otherstring)))))) |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49188
diff
changeset
|
584 |
68793
71c7af923901
(describe-key-briefly): Now a wrapper for describe-key-briefly-internal.
Eli Zaretskii <eliz@gnu.org>
parents:
68651
diff
changeset
|
585 (defun describe-key-briefly (&optional key insert untranslated) |
71c7af923901
(describe-key-briefly): Now a wrapper for describe-key-briefly-internal.
Eli Zaretskii <eliz@gnu.org>
parents:
68651
diff
changeset
|
586 "Print the name of the function KEY invokes. KEY is a string. |
71c7af923901
(describe-key-briefly): Now a wrapper for describe-key-briefly-internal.
Eli Zaretskii <eliz@gnu.org>
parents:
68651
diff
changeset
|
587 If INSERT (the prefix arg) is non-nil, insert the message in the buffer. |
71c7af923901
(describe-key-briefly): Now a wrapper for describe-key-briefly-internal.
Eli Zaretskii <eliz@gnu.org>
parents:
68651
diff
changeset
|
588 If non-nil, UNTRANSLATED is a vector of the untranslated events. |
71c7af923901
(describe-key-briefly): Now a wrapper for describe-key-briefly-internal.
Eli Zaretskii <eliz@gnu.org>
parents:
68651
diff
changeset
|
589 It can also be a number in which case the untranslated events from |
71c7af923901
(describe-key-briefly): Now a wrapper for describe-key-briefly-internal.
Eli Zaretskii <eliz@gnu.org>
parents:
68651
diff
changeset
|
590 the last key hit are used. |
71c7af923901
(describe-key-briefly): Now a wrapper for describe-key-briefly-internal.
Eli Zaretskii <eliz@gnu.org>
parents:
68651
diff
changeset
|
591 |
71c7af923901
(describe-key-briefly): Now a wrapper for describe-key-briefly-internal.
Eli Zaretskii <eliz@gnu.org>
parents:
68651
diff
changeset
|
592 If KEY is a menu item or a tool-bar button that is disabled, this command |
68795
687ce2ace7b8
(describe-key-briefly, describe-key): Populate yank-menu if empty.
Eli Zaretskii <eliz@gnu.org>
parents:
68793
diff
changeset
|
593 temporarily enables it to allow getting help on disabled items and buttons." |
68855
284c53bcc6bf
(describe-key-briefly, describe-key):
Richard M. Stallman <rms@gnu.org>
parents:
68795
diff
changeset
|
594 (interactive |
284c53bcc6bf
(describe-key-briefly, describe-key):
Richard M. Stallman <rms@gnu.org>
parents:
68795
diff
changeset
|
595 (let ((enable-disabled-menus-and-buttons t) |
284c53bcc6bf
(describe-key-briefly, describe-key):
Richard M. Stallman <rms@gnu.org>
parents:
68795
diff
changeset
|
596 (cursor-in-echo-area t) |
284c53bcc6bf
(describe-key-briefly, describe-key):
Richard M. Stallman <rms@gnu.org>
parents:
68795
diff
changeset
|
597 saved-yank-menu) |
284c53bcc6bf
(describe-key-briefly, describe-key):
Richard M. Stallman <rms@gnu.org>
parents:
68795
diff
changeset
|
598 (unwind-protect |
284c53bcc6bf
(describe-key-briefly, describe-key):
Richard M. Stallman <rms@gnu.org>
parents:
68795
diff
changeset
|
599 (let (key) |
284c53bcc6bf
(describe-key-briefly, describe-key):
Richard M. Stallman <rms@gnu.org>
parents:
68795
diff
changeset
|
600 ;; If yank-menu is empty, populate it temporarily, so that |
284c53bcc6bf
(describe-key-briefly, describe-key):
Richard M. Stallman <rms@gnu.org>
parents:
68795
diff
changeset
|
601 ;; "Select and Paste" menu can generate a complete event. |
284c53bcc6bf
(describe-key-briefly, describe-key):
Richard M. Stallman <rms@gnu.org>
parents:
68795
diff
changeset
|
602 (when (null (cdr yank-menu)) |
284c53bcc6bf
(describe-key-briefly, describe-key):
Richard M. Stallman <rms@gnu.org>
parents:
68795
diff
changeset
|
603 (setq saved-yank-menu (copy-sequence yank-menu)) |
284c53bcc6bf
(describe-key-briefly, describe-key):
Richard M. Stallman <rms@gnu.org>
parents:
68795
diff
changeset
|
604 (menu-bar-update-yank-menu "(any string)" nil)) |
284c53bcc6bf
(describe-key-briefly, describe-key):
Richard M. Stallman <rms@gnu.org>
parents:
68795
diff
changeset
|
605 (setq key (read-key-sequence "Describe key (or click or menu item): ")) |
69327
f309eed94981
* help.el (describe-key-briefly): If KEY is a down event, read and
Chong Yidong <cyd@stupidchicken.com>
parents:
69317
diff
changeset
|
606 ;; If KEY is a down-event, read and discard the |
72890
5ba1cd1da822
* mouse-sel.el (mouse-sel-follow-link-p): Use event position
David Kastrup <dak@gnu.org>
parents:
72804
diff
changeset
|
607 ;; corresponding up-event. Note that there are also |
5ba1cd1da822
* mouse-sel.el (mouse-sel-follow-link-p): Use event position
David Kastrup <dak@gnu.org>
parents:
72804
diff
changeset
|
608 ;; down-events on scroll bars and mode lines: the actual |
5ba1cd1da822
* mouse-sel.el (mouse-sel-follow-link-p): Use event position
David Kastrup <dak@gnu.org>
parents:
72804
diff
changeset
|
609 ;; event then is in the second element of the vector. |
5ba1cd1da822
* mouse-sel.el (mouse-sel-follow-link-p): Use event position
David Kastrup <dak@gnu.org>
parents:
72804
diff
changeset
|
610 (and (vectorp key) |
73105
8a999db76eda
(describe-key, describe-key-briefly): Test last event for being a down-event.
Richard M. Stallman <rms@gnu.org>
parents:
73082
diff
changeset
|
611 (let ((last-idx (1- (length key)))) |
8a999db76eda
(describe-key, describe-key-briefly): Test last event for being a down-event.
Richard M. Stallman <rms@gnu.org>
parents:
73082
diff
changeset
|
612 (and (eventp (aref key last-idx)) |
8a999db76eda
(describe-key, describe-key-briefly): Test last event for being a down-event.
Richard M. Stallman <rms@gnu.org>
parents:
73082
diff
changeset
|
613 (memq 'down (event-modifiers (aref key last-idx))))) |
72890
5ba1cd1da822
* mouse-sel.el (mouse-sel-follow-link-p): Use event position
David Kastrup <dak@gnu.org>
parents:
72804
diff
changeset
|
614 (read-event)) |
68855
284c53bcc6bf
(describe-key-briefly, describe-key):
Richard M. Stallman <rms@gnu.org>
parents:
68795
diff
changeset
|
615 (list |
284c53bcc6bf
(describe-key-briefly, describe-key):
Richard M. Stallman <rms@gnu.org>
parents:
68795
diff
changeset
|
616 key |
69077
f8759a14f4cd
(describe-key-briefly): Compute interactive args
Richard M. Stallman <rms@gnu.org>
parents:
68870
diff
changeset
|
617 (if current-prefix-arg (prefix-numeric-value current-prefix-arg)) |
f8759a14f4cd
(describe-key-briefly): Compute interactive args
Richard M. Stallman <rms@gnu.org>
parents:
68870
diff
changeset
|
618 1)) |
68855
284c53bcc6bf
(describe-key-briefly, describe-key):
Richard M. Stallman <rms@gnu.org>
parents:
68795
diff
changeset
|
619 ;; Put yank-menu back as it was, if we changed it. |
284c53bcc6bf
(describe-key-briefly, describe-key):
Richard M. Stallman <rms@gnu.org>
parents:
68795
diff
changeset
|
620 (when saved-yank-menu |
284c53bcc6bf
(describe-key-briefly, describe-key):
Richard M. Stallman <rms@gnu.org>
parents:
68795
diff
changeset
|
621 (setq yank-menu (copy-sequence saved-yank-menu)) |
284c53bcc6bf
(describe-key-briefly, describe-key):
Richard M. Stallman <rms@gnu.org>
parents:
68795
diff
changeset
|
622 (fset 'yank-menu (cons 'keymap yank-menu)))))) |
44332
bdf6c2baa447
(help-key-description): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43697
diff
changeset
|
623 (if (numberp untranslated) |
bdf6c2baa447
(help-key-description): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43697
diff
changeset
|
624 (setq untranslated (this-single-command-raw-keys))) |
72890
5ba1cd1da822
* mouse-sel.el (mouse-sel-follow-link-p): Use event position
David Kastrup <dak@gnu.org>
parents:
72804
diff
changeset
|
625 (let* ((event (if (and (symbolp (aref key 0)) |
5ba1cd1da822
* mouse-sel.el (mouse-sel-follow-link-p): Use event position
David Kastrup <dak@gnu.org>
parents:
72804
diff
changeset
|
626 (> (length key) 1) |
5ba1cd1da822
* mouse-sel.el (mouse-sel-follow-link-p): Use event position
David Kastrup <dak@gnu.org>
parents:
72804
diff
changeset
|
627 (consp (aref key 1))) |
5ba1cd1da822
* mouse-sel.el (mouse-sel-follow-link-p): Use event position
David Kastrup <dak@gnu.org>
parents:
72804
diff
changeset
|
628 (aref key 1) |
5ba1cd1da822
* mouse-sel.el (mouse-sel-follow-link-p): Use event position
David Kastrup <dak@gnu.org>
parents:
72804
diff
changeset
|
629 (aref key 0))) |
5ba1cd1da822
* mouse-sel.el (mouse-sel-follow-link-p): Use event position
David Kastrup <dak@gnu.org>
parents:
72804
diff
changeset
|
630 (modifiers (event-modifiers event)) |
5ba1cd1da822
* mouse-sel.el (mouse-sel-follow-link-p): Use event position
David Kastrup <dak@gnu.org>
parents:
72804
diff
changeset
|
631 (standard-output (if insert (current-buffer) t)) |
72995
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
632 (mouse-msg (if (or (memq 'click modifiers) (memq 'down modifiers) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
633 (memq 'drag modifiers)) " at that spot" "")) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
634 (defn (key-binding key t)) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
635 key-desc) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
636 ;; Handle the case where we faked an entry in "Select and Paste" menu. |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
637 (if (and (eq defn nil) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
638 (stringp (aref key (1- (length key)))) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
639 (eq (key-binding (substring key 0 -1)) 'yank-menu)) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
640 (setq defn 'menu-bar-select-yank)) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
641 ;; Don't bother user with strings from (e.g.) the select-paste menu. |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
642 (if (stringp (aref key (1- (length key)))) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
643 (aset key (1- (length key)) "(any string)")) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
644 (if (and (> (length untranslated) 0) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
645 (stringp (aref untranslated (1- (length untranslated))))) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
646 (aset untranslated (1- (length untranslated)) "(any string)")) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
647 ;; Now describe the key, perhaps as changed. |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
648 (setq key-desc (help-key-description key untranslated)) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
649 (if (or (null defn) (integerp defn) (equal defn 'undefined)) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
650 (princ (format "%s%s is undefined" key-desc mouse-msg)) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
651 (princ (format "%s%s runs the command %S" key-desc mouse-msg defn))))) |
31243
30007aab98df
(help-xref-mule-regexp): New variable
Kenichi Handa <handa@m17n.org>
parents:
30920
diff
changeset
|
652 |
68793
71c7af923901
(describe-key-briefly): Now a wrapper for describe-key-briefly-internal.
Eli Zaretskii <eliz@gnu.org>
parents:
68651
diff
changeset
|
653 (defun describe-key (&optional key untranslated up-event) |
42357
253eec84f7d3
(describe-key): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
42254
diff
changeset
|
654 "Display documentation of the function invoked by KEY. |
66853
b33c167de495
(help-for-help-internal): Improve doc of C-h a.
Richard M. Stallman <rms@gnu.org>
parents:
66849
diff
changeset
|
655 KEY can be any kind of a key sequence; it can include keyboard events, |
b33c167de495
(help-for-help-internal): Improve doc of C-h a.
Richard M. Stallman <rms@gnu.org>
parents:
66849
diff
changeset
|
656 mouse events, and/or menu events. When calling from a program, |
b33c167de495
(help-for-help-internal): Improve doc of C-h a.
Richard M. Stallman <rms@gnu.org>
parents:
66849
diff
changeset
|
657 pass KEY as a string or a vector. |
b33c167de495
(help-for-help-internal): Improve doc of C-h a.
Richard M. Stallman <rms@gnu.org>
parents:
66849
diff
changeset
|
658 |
67196 | 659 If non-nil, UNTRANSLATED is a vector of the corresponding untranslated events. |
66853
b33c167de495
(help-for-help-internal): Improve doc of C-h a.
Richard M. Stallman <rms@gnu.org>
parents:
66849
diff
changeset
|
660 It can also be a number, in which case the untranslated events from |
68793
71c7af923901
(describe-key-briefly): Now a wrapper for describe-key-briefly-internal.
Eli Zaretskii <eliz@gnu.org>
parents:
68651
diff
changeset
|
661 the last key sequence entered are used. |
71c7af923901
(describe-key-briefly): Now a wrapper for describe-key-briefly-internal.
Eli Zaretskii <eliz@gnu.org>
parents:
68651
diff
changeset
|
662 UP-EVENT is the up-event that was discarded by reading KEY, or nil. |
71c7af923901
(describe-key-briefly): Now a wrapper for describe-key-briefly-internal.
Eli Zaretskii <eliz@gnu.org>
parents:
68651
diff
changeset
|
663 |
71c7af923901
(describe-key-briefly): Now a wrapper for describe-key-briefly-internal.
Eli Zaretskii <eliz@gnu.org>
parents:
68651
diff
changeset
|
664 If KEY is a menu item or a tool-bar button that is disabled, this command |
68795
687ce2ace7b8
(describe-key-briefly, describe-key): Populate yank-menu if empty.
Eli Zaretskii <eliz@gnu.org>
parents:
68793
diff
changeset
|
665 temporarily enables it to allow getting help on disabled items and buttons." |
68855
284c53bcc6bf
(describe-key-briefly, describe-key):
Richard M. Stallman <rms@gnu.org>
parents:
68795
diff
changeset
|
666 (interactive |
284c53bcc6bf
(describe-key-briefly, describe-key):
Richard M. Stallman <rms@gnu.org>
parents:
68795
diff
changeset
|
667 (let ((enable-disabled-menus-and-buttons t) |
284c53bcc6bf
(describe-key-briefly, describe-key):
Richard M. Stallman <rms@gnu.org>
parents:
68795
diff
changeset
|
668 (cursor-in-echo-area t) |
284c53bcc6bf
(describe-key-briefly, describe-key):
Richard M. Stallman <rms@gnu.org>
parents:
68795
diff
changeset
|
669 saved-yank-menu) |
284c53bcc6bf
(describe-key-briefly, describe-key):
Richard M. Stallman <rms@gnu.org>
parents:
68795
diff
changeset
|
670 (unwind-protect |
284c53bcc6bf
(describe-key-briefly, describe-key):
Richard M. Stallman <rms@gnu.org>
parents:
68795
diff
changeset
|
671 (let (key) |
284c53bcc6bf
(describe-key-briefly, describe-key):
Richard M. Stallman <rms@gnu.org>
parents:
68795
diff
changeset
|
672 ;; If yank-menu is empty, populate it temporarily, so that |
284c53bcc6bf
(describe-key-briefly, describe-key):
Richard M. Stallman <rms@gnu.org>
parents:
68795
diff
changeset
|
673 ;; "Select and Paste" menu can generate a complete event. |
284c53bcc6bf
(describe-key-briefly, describe-key):
Richard M. Stallman <rms@gnu.org>
parents:
68795
diff
changeset
|
674 (when (null (cdr yank-menu)) |
284c53bcc6bf
(describe-key-briefly, describe-key):
Richard M. Stallman <rms@gnu.org>
parents:
68795
diff
changeset
|
675 (setq saved-yank-menu (copy-sequence yank-menu)) |
284c53bcc6bf
(describe-key-briefly, describe-key):
Richard M. Stallman <rms@gnu.org>
parents:
68795
diff
changeset
|
676 (menu-bar-update-yank-menu "(any string)" nil)) |
284c53bcc6bf
(describe-key-briefly, describe-key):
Richard M. Stallman <rms@gnu.org>
parents:
68795
diff
changeset
|
677 (setq key (read-key-sequence "Describe key (or click or menu item): ")) |
284c53bcc6bf
(describe-key-briefly, describe-key):
Richard M. Stallman <rms@gnu.org>
parents:
68795
diff
changeset
|
678 (list |
284c53bcc6bf
(describe-key-briefly, describe-key):
Richard M. Stallman <rms@gnu.org>
parents:
68795
diff
changeset
|
679 key |
284c53bcc6bf
(describe-key-briefly, describe-key):
Richard M. Stallman <rms@gnu.org>
parents:
68795
diff
changeset
|
680 (prefix-numeric-value current-prefix-arg) |
76651
f80b58f9495a
Fix typo in comment.
Chong Yidong <cyd@stupidchicken.com>
parents:
76232
diff
changeset
|
681 ;; If KEY is a down-event, read and include the |
73105
8a999db76eda
(describe-key, describe-key-briefly): Test last event for being a down-event.
Richard M. Stallman <rms@gnu.org>
parents:
73082
diff
changeset
|
682 ;; corresponding up-event. Note that there are also |
8a999db76eda
(describe-key, describe-key-briefly): Test last event for being a down-event.
Richard M. Stallman <rms@gnu.org>
parents:
73082
diff
changeset
|
683 ;; down-events on scroll bars and mode lines: the actual |
8a999db76eda
(describe-key, describe-key-briefly): Test last event for being a down-event.
Richard M. Stallman <rms@gnu.org>
parents:
73082
diff
changeset
|
684 ;; event then is in the second element of the vector. |
72890
5ba1cd1da822
* mouse-sel.el (mouse-sel-follow-link-p): Use event position
David Kastrup <dak@gnu.org>
parents:
72804
diff
changeset
|
685 (and (vectorp key) |
73105
8a999db76eda
(describe-key, describe-key-briefly): Test last event for being a down-event.
Richard M. Stallman <rms@gnu.org>
parents:
73082
diff
changeset
|
686 (let ((last-idx (1- (length key)))) |
8a999db76eda
(describe-key, describe-key-briefly): Test last event for being a down-event.
Richard M. Stallman <rms@gnu.org>
parents:
73082
diff
changeset
|
687 (and (eventp (aref key last-idx)) |
8a999db76eda
(describe-key, describe-key-briefly): Test last event for being a down-event.
Richard M. Stallman <rms@gnu.org>
parents:
73082
diff
changeset
|
688 (memq 'down (event-modifiers (aref key last-idx))))) |
72890
5ba1cd1da822
* mouse-sel.el (mouse-sel-follow-link-p): Use event position
David Kastrup <dak@gnu.org>
parents:
72804
diff
changeset
|
689 (or (and (eventp (aref key 0)) |
73082
40a575bcdf72
* help.el (describe-key-briefly, describe-key): Don't expect an
Chong Yidong <cyd@stupidchicken.com>
parents:
72995
diff
changeset
|
690 (memq 'down (event-modifiers (aref key 0))) |
40a575bcdf72
* help.el (describe-key-briefly, describe-key): Don't expect an
Chong Yidong <cyd@stupidchicken.com>
parents:
72995
diff
changeset
|
691 ;; However, for the C-down-mouse-2 popup |
40a575bcdf72
* help.el (describe-key-briefly, describe-key): Don't expect an
Chong Yidong <cyd@stupidchicken.com>
parents:
72995
diff
changeset
|
692 ;; menu, there is no subsequent up-event. In |
40a575bcdf72
* help.el (describe-key-briefly, describe-key): Don't expect an
Chong Yidong <cyd@stupidchicken.com>
parents:
72995
diff
changeset
|
693 ;; this case, the up-event is the next |
40a575bcdf72
* help.el (describe-key-briefly, describe-key): Don't expect an
Chong Yidong <cyd@stupidchicken.com>
parents:
72995
diff
changeset
|
694 ;; element in the supplied vector. |
40a575bcdf72
* help.el (describe-key-briefly, describe-key): Don't expect an
Chong Yidong <cyd@stupidchicken.com>
parents:
72995
diff
changeset
|
695 (= (length key) 1)) |
72890
5ba1cd1da822
* mouse-sel.el (mouse-sel-follow-link-p): Use event position
David Kastrup <dak@gnu.org>
parents:
72804
diff
changeset
|
696 (and (> (length key) 1) |
5ba1cd1da822
* mouse-sel.el (mouse-sel-follow-link-p): Use event position
David Kastrup <dak@gnu.org>
parents:
72804
diff
changeset
|
697 (eventp (aref key 1)) |
5ba1cd1da822
* mouse-sel.el (mouse-sel-follow-link-p): Use event position
David Kastrup <dak@gnu.org>
parents:
72804
diff
changeset
|
698 (memq 'down (event-modifiers (aref key 1))))) |
5ba1cd1da822
* mouse-sel.el (mouse-sel-follow-link-p): Use event position
David Kastrup <dak@gnu.org>
parents:
72804
diff
changeset
|
699 (read-event)))) |
68855
284c53bcc6bf
(describe-key-briefly, describe-key):
Richard M. Stallman <rms@gnu.org>
parents:
68795
diff
changeset
|
700 ;; Put yank-menu back as it was, if we changed it. |
284c53bcc6bf
(describe-key-briefly, describe-key):
Richard M. Stallman <rms@gnu.org>
parents:
68795
diff
changeset
|
701 (when saved-yank-menu |
284c53bcc6bf
(describe-key-briefly, describe-key):
Richard M. Stallman <rms@gnu.org>
parents:
68795
diff
changeset
|
702 (setq yank-menu (copy-sequence saved-yank-menu)) |
284c53bcc6bf
(describe-key-briefly, describe-key):
Richard M. Stallman <rms@gnu.org>
parents:
68795
diff
changeset
|
703 (fset 'yank-menu (cons 'keymap yank-menu)))))) |
44332
bdf6c2baa447
(help-key-description): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43697
diff
changeset
|
704 (if (numberp untranslated) |
bdf6c2baa447
(help-key-description): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43697
diff
changeset
|
705 (setq untranslated (this-single-command-raw-keys))) |
72911
21cdd33b2649
(describe-key): Handle C-h k in *Help* buffer; collect
Kim F. Storm <storm@cua.dk>
parents:
72890
diff
changeset
|
706 (let* ((event (aref key (if (and (symbolp (aref key 0)) |
21cdd33b2649
(describe-key): Handle C-h k in *Help* buffer; collect
Kim F. Storm <storm@cua.dk>
parents:
72890
diff
changeset
|
707 (> (length key) 1) |
21cdd33b2649
(describe-key): Handle C-h k in *Help* buffer; collect
Kim F. Storm <storm@cua.dk>
parents:
72890
diff
changeset
|
708 (consp (aref key 1))) |
21cdd33b2649
(describe-key): Handle C-h k in *Help* buffer; collect
Kim F. Storm <storm@cua.dk>
parents:
72890
diff
changeset
|
709 1 |
21cdd33b2649
(describe-key): Handle C-h k in *Help* buffer; collect
Kim F. Storm <storm@cua.dk>
parents:
72890
diff
changeset
|
710 0))) |
72890
5ba1cd1da822
* mouse-sel.el (mouse-sel-follow-link-p): Use event position
David Kastrup <dak@gnu.org>
parents:
72804
diff
changeset
|
711 (modifiers (event-modifiers event)) |
72995
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
712 (mouse-msg (if (or (memq 'click modifiers) (memq 'down modifiers) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
713 (memq 'drag modifiers)) " at that spot" "")) |
72911
21cdd33b2649
(describe-key): Handle C-h k in *Help* buffer; collect
Kim F. Storm <storm@cua.dk>
parents:
72890
diff
changeset
|
714 (defn (key-binding key t)) |
21cdd33b2649
(describe-key): Handle C-h k in *Help* buffer; collect
Kim F. Storm <storm@cua.dk>
parents:
72890
diff
changeset
|
715 defn-up defn-up-tricky ev-type |
21cdd33b2649
(describe-key): Handle C-h k in *Help* buffer; collect
Kim F. Storm <storm@cua.dk>
parents:
72890
diff
changeset
|
716 mouse-1-remapped mouse-1-tricky) |
72890
5ba1cd1da822
* mouse-sel.el (mouse-sel-follow-link-p): Use event position
David Kastrup <dak@gnu.org>
parents:
72804
diff
changeset
|
717 |
72911
21cdd33b2649
(describe-key): Handle C-h k in *Help* buffer; collect
Kim F. Storm <storm@cua.dk>
parents:
72890
diff
changeset
|
718 ;; Handle the case where we faked an entry in "Select and Paste" menu. |
72995
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
719 (when (and (eq defn nil) |
72890
5ba1cd1da822
* mouse-sel.el (mouse-sel-follow-link-p): Use event position
David Kastrup <dak@gnu.org>
parents:
72804
diff
changeset
|
720 (stringp (aref key (1- (length key)))) |
5ba1cd1da822
* mouse-sel.el (mouse-sel-follow-link-p): Use event position
David Kastrup <dak@gnu.org>
parents:
72804
diff
changeset
|
721 (eq (key-binding (substring key 0 -1)) 'yank-menu)) |
72995
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
722 (setq defn 'menu-bar-select-yank)) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
723 (if (or (null defn) (integerp defn) (equal defn 'undefined)) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
724 (message "%s%s is undefined" |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
725 (help-key-description key untranslated) mouse-msg) |
105372
bd2966850aac
Use `called-interactively-p' instead of `interactive-p'.
Juanma Barranquero <lekktu@gmail.com>
parents:
105216
diff
changeset
|
726 (help-setup-xref (list #'describe-function defn) |
bd2966850aac
Use `called-interactively-p' instead of `interactive-p'.
Juanma Barranquero <lekktu@gmail.com>
parents:
105216
diff
changeset
|
727 (called-interactively-p 'interactive)) |
72995
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
728 ;; Don't bother user with strings from (e.g.) the select-paste menu. |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
729 (when (stringp (aref key (1- (length key)))) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
730 (aset key (1- (length key)) "(any string)")) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
731 (when (and untranslated |
72890
5ba1cd1da822
* mouse-sel.el (mouse-sel-follow-link-p): Use event position
David Kastrup <dak@gnu.org>
parents:
72804
diff
changeset
|
732 (stringp (aref untranslated (1- (length untranslated))))) |
72995
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
733 (aset untranslated (1- (length untranslated)) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
734 "(any string)")) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
735 ;; Need to do this before erasing *Help* buffer in case event |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
736 ;; is a mouse click in an existing *Help* buffer. |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
737 (when up-event |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
738 (setq ev-type (event-basic-type up-event)) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
739 (let ((sequence (vector up-event))) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
740 (when (and (eq ev-type 'mouse-1) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
741 mouse-1-click-follows-link |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
742 (not (eq mouse-1-click-follows-link 'double)) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
743 (setq mouse-1-remapped |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
744 (mouse-on-link-p (event-start up-event)))) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
745 (setq mouse-1-tricky (and (integerp mouse-1-click-follows-link) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
746 (> mouse-1-click-follows-link 0))) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
747 (cond ((stringp mouse-1-remapped) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
748 (setq sequence mouse-1-remapped)) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
749 ((vectorp mouse-1-remapped) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
750 (setcar up-event (elt mouse-1-remapped 0))) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
751 (t (setcar up-event 'mouse-2)))) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
752 (setq defn-up (key-binding sequence nil nil (event-start up-event))) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
753 (when mouse-1-tricky |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
754 (setq sequence (vector up-event)) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
755 (aset sequence 0 'mouse-1) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
756 (setq defn-up-tricky (key-binding sequence nil nil (event-start up-event)))))) |
86005
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
757 (with-help-window (help-buffer) |
72995
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
758 (princ (help-key-description key untranslated)) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
759 (princ (format "\ |
91795
bfe257ff864c
2008-02-11 Drew Adams <drew.adams@oracle.com>
Bastien Guerry <bzg@altern.org>
parents:
87789
diff
changeset
|
760 %s runs the command %S, which is " |
72995
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
761 mouse-msg defn)) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
762 (describe-function-1 defn) |
72911
21cdd33b2649
(describe-key): Handle C-h k in *Help* buffer; collect
Kim F. Storm <storm@cua.dk>
parents:
72890
diff
changeset
|
763 (when up-event |
72995
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
764 (unless (or (null defn-up) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
765 (integerp defn-up) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
766 (equal defn-up 'undefined)) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
767 (princ (format " |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
768 |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
769 ----------------- up-event %s---------------- |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
770 |
109298
c145957f7705
Minor fix to describe-key, and a docstring.
Chong Yidong <cyd@stupidchicken.com>
parents:
107913
diff
changeset
|
771 %s%s%s runs the command %S, which is " |
72995
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
772 (if mouse-1-tricky "(short click) " "") |
109298
c145957f7705
Minor fix to describe-key, and a docstring.
Chong Yidong <cyd@stupidchicken.com>
parents:
107913
diff
changeset
|
773 (key-description (vector up-event)) |
c145957f7705
Minor fix to describe-key, and a docstring.
Chong Yidong <cyd@stupidchicken.com>
parents:
107913
diff
changeset
|
774 mouse-msg |
72995
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
775 (if mouse-1-remapped |
91795
bfe257ff864c
2008-02-11 Drew Adams <drew.adams@oracle.com>
Bastien Guerry <bzg@altern.org>
parents:
87789
diff
changeset
|
776 " is remapped to <mouse-2>, which" "") |
72995
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
777 defn-up)) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
778 (describe-function-1 defn-up)) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
779 (unless (or (null defn-up-tricky) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
780 (integerp defn-up-tricky) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
781 (eq defn-up-tricky 'undefined)) |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
782 (princ (format " |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
783 |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
784 ----------------- up-event (long click) ---------------- |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
785 |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
786 Pressing <%S>%s for longer than %d milli-seconds |
91795
bfe257ff864c
2008-02-11 Drew Adams <drew.adams@oracle.com>
Bastien Guerry <bzg@altern.org>
parents:
87789
diff
changeset
|
787 runs the command %S, which is " |
72995
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
788 ev-type mouse-msg |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
789 mouse-1-click-follows-link |
eacc6e3eac06
(describe-key-briefly, describe-key): Simplify printing
Kim F. Storm <storm@cua.dk>
parents:
72920
diff
changeset
|
790 defn-up-tricky)) |
86005
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
791 (describe-function-1 defn-up-tricky))))))) |
21371
22a3be0ae9dc
(help-highlight-face): Use underline.
Richard M. Stallman <rms@gnu.org>
parents:
21210
diff
changeset
|
792 |
39728
570d86d34c32
Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents:
39659
diff
changeset
|
793 (defun describe-mode (&optional buffer) |
570d86d34c32
Don't require `view' when compiling.
Miles Bader <miles@gnu.org>
parents:
39659
diff
changeset
|
794 "Display documentation of current major mode and minor modes. |
54815
d13dc0c5f80d
(describe-mode): Doc fix.
John Paul Wallington <jpw@pobox.com>
parents:
53204
diff
changeset
|
795 A brief summary of the minor modes comes first, followed by the |
d13dc0c5f80d
(describe-mode): Doc fix.
John Paul Wallington <jpw@pobox.com>
parents:
53204
diff
changeset
|
796 major mode description. This is followed by detailed |
d13dc0c5f80d
(describe-mode): Doc fix.
John Paul Wallington <jpw@pobox.com>
parents:
53204
diff
changeset
|
797 descriptions of the minor modes, each on a separate page. |
d13dc0c5f80d
(describe-mode): Doc fix.
John Paul Wallington <jpw@pobox.com>
parents:
53204
diff
changeset
|
798 |
d13dc0c5f80d
(describe-mode): Doc fix.
John Paul Wallington <jpw@pobox.com>
parents:
53204
diff
changeset
|
799 For this to work correctly for a minor mode, the mode's indicator |
d13dc0c5f80d
(describe-mode): Doc fix.
John Paul Wallington <jpw@pobox.com>
parents:
53204
diff
changeset
|
800 variable \(listed in `minor-mode-alist') must also be a function |
d13dc0c5f80d
(describe-mode): Doc fix.
John Paul Wallington <jpw@pobox.com>
parents:
53204
diff
changeset
|
801 whose documentation describes the minor mode." |
73233
b4697c34c8fd
* help.el (describe-mode): For clicks on mode-line, use "@"
David Kastrup <dak@gnu.org>
parents:
73105
diff
changeset
|
802 (interactive "@") |
60559
e886078cad44
(describe-mode): Properly handle non-trivial lighters.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60006
diff
changeset
|
803 (unless buffer (setq buffer (current-buffer))) |
e886078cad44
(describe-mode): Properly handle non-trivial lighters.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60006
diff
changeset
|
804 (help-setup-xref (list #'describe-mode buffer) |
105372
bd2966850aac
Use `called-interactively-p' instead of `interactive-p'.
Juanma Barranquero <lekktu@gmail.com>
parents:
105216
diff
changeset
|
805 (called-interactively-p 'interactive)) |
42679
8e00fb340b95
(describe-mode): Call help-setup-xref in the help buffer.
Richard M. Stallman <rms@gnu.org>
parents:
42357
diff
changeset
|
806 ;; For the sake of help-do-xref and help-xref-go-back, |
8e00fb340b95
(describe-mode): Call help-setup-xref in the help buffer.
Richard M. Stallman <rms@gnu.org>
parents:
42357
diff
changeset
|
807 ;; don't switch buffers before calling `help-buffer'. |
86005
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
808 (with-help-window (help-buffer) |
60559
e886078cad44
(describe-mode): Properly handle non-trivial lighters.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60006
diff
changeset
|
809 (with-current-buffer buffer |
52690
212969e10f09
(describe-mode): Start with a brief list of minor modes.
Richard M. Stallman <rms@gnu.org>
parents:
52401
diff
changeset
|
810 (let (minor-modes) |
60559
e886078cad44
(describe-mode): Properly handle non-trivial lighters.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60006
diff
changeset
|
811 ;; Older packages do not register in minor-mode-list but only in |
e886078cad44
(describe-mode): Properly handle non-trivial lighters.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60006
diff
changeset
|
812 ;; minor-mode-alist. |
e886078cad44
(describe-mode): Properly handle non-trivial lighters.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60006
diff
changeset
|
813 (dolist (x minor-mode-alist) |
e886078cad44
(describe-mode): Properly handle non-trivial lighters.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60006
diff
changeset
|
814 (setq x (car x)) |
e886078cad44
(describe-mode): Properly handle non-trivial lighters.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60006
diff
changeset
|
815 (unless (memq x minor-mode-list) |
e886078cad44
(describe-mode): Properly handle non-trivial lighters.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60006
diff
changeset
|
816 (push x minor-mode-list))) |
52690
212969e10f09
(describe-mode): Start with a brief list of minor modes.
Richard M. Stallman <rms@gnu.org>
parents:
52401
diff
changeset
|
817 ;; Find enabled minor mode we will want to mention. |
212969e10f09
(describe-mode): Start with a brief list of minor modes.
Richard M. Stallman <rms@gnu.org>
parents:
52401
diff
changeset
|
818 (dolist (mode minor-mode-list) |
212969e10f09
(describe-mode): Start with a brief list of minor modes.
Richard M. Stallman <rms@gnu.org>
parents:
52401
diff
changeset
|
819 ;; Document a minor mode if it is listed in minor-mode-alist, |
212969e10f09
(describe-mode): Start with a brief list of minor modes.
Richard M. Stallman <rms@gnu.org>
parents:
52401
diff
changeset
|
820 ;; non-nil, and has a function definition. |
60644
9b106d739bf9
(describe-mode): Allow minor mode toggles to use a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60559
diff
changeset
|
821 (let ((fmode (or (get mode :minor-mode-function) mode))) |
9b106d739bf9
(describe-mode): Allow minor mode toggles to use a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60559
diff
changeset
|
822 (and (boundp mode) (symbol-value mode) |
9b106d739bf9
(describe-mode): Allow minor mode toggles to use a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60559
diff
changeset
|
823 (fboundp fmode) |
9b106d739bf9
(describe-mode): Allow minor mode toggles to use a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60559
diff
changeset
|
824 (let ((pretty-minor-mode |
9b106d739bf9
(describe-mode): Allow minor mode toggles to use a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60559
diff
changeset
|
825 (if (string-match "\\(\\(-minor\\)?-mode\\)?\\'" |
9b106d739bf9
(describe-mode): Allow minor mode toggles to use a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60559
diff
changeset
|
826 (symbol-name fmode)) |
9b106d739bf9
(describe-mode): Allow minor mode toggles to use a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60559
diff
changeset
|
827 (capitalize |
9b106d739bf9
(describe-mode): Allow minor mode toggles to use a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60559
diff
changeset
|
828 (substring (symbol-name fmode) |
9b106d739bf9
(describe-mode): Allow minor mode toggles to use a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60559
diff
changeset
|
829 0 (match-beginning 0))) |
9b106d739bf9
(describe-mode): Allow minor mode toggles to use a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60559
diff
changeset
|
830 fmode))) |
9b106d739bf9
(describe-mode): Allow minor mode toggles to use a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60559
diff
changeset
|
831 (push (list fmode pretty-minor-mode |
9b106d739bf9
(describe-mode): Allow minor mode toggles to use a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60559
diff
changeset
|
832 (format-mode-line (assq mode minor-mode-alist))) |
9b106d739bf9
(describe-mode): Allow minor mode toggles to use a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60559
diff
changeset
|
833 minor-modes))))) |
52690
212969e10f09
(describe-mode): Start with a brief list of minor modes.
Richard M. Stallman <rms@gnu.org>
parents:
52401
diff
changeset
|
834 (setq minor-modes |
212969e10f09
(describe-mode): Start with a brief list of minor modes.
Richard M. Stallman <rms@gnu.org>
parents:
52401
diff
changeset
|
835 (sort minor-modes |
60644
9b106d739bf9
(describe-mode): Allow minor mode toggles to use a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60559
diff
changeset
|
836 (lambda (a b) (string-lessp (cadr a) (cadr b))))) |
52690
212969e10f09
(describe-mode): Start with a brief list of minor modes.
Richard M. Stallman <rms@gnu.org>
parents:
52401
diff
changeset
|
837 (when minor-modes |
72295
12d2238c31b3
(describe-mode): Make minor mode list more concise.
Richard M. Stallman <rms@gnu.org>
parents:
71487
diff
changeset
|
838 (princ "Enabled minor modes:\n") |
57485
32dab1aa8b9a
(describe-mode): Use marker buttons to make minor mode list into hyperlinks.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
56883
diff
changeset
|
839 (make-local-variable 'help-button-cache) |
32dab1aa8b9a
(describe-mode): Use marker buttons to make minor mode list into hyperlinks.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
56883
diff
changeset
|
840 (with-current-buffer standard-output |
32dab1aa8b9a
(describe-mode): Use marker buttons to make minor mode list into hyperlinks.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
56883
diff
changeset
|
841 (dolist (mode minor-modes) |
60644
9b106d739bf9
(describe-mode): Allow minor mode toggles to use a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60559
diff
changeset
|
842 (let ((mode-function (nth 0 mode)) |
9b106d739bf9
(describe-mode): Allow minor mode toggles to use a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60559
diff
changeset
|
843 (pretty-minor-mode (nth 1 mode)) |
57485
32dab1aa8b9a
(describe-mode): Use marker buttons to make minor mode list into hyperlinks.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
56883
diff
changeset
|
844 (indicator (nth 2 mode))) |
32dab1aa8b9a
(describe-mode): Use marker buttons to make minor mode list into hyperlinks.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
56883
diff
changeset
|
845 (add-text-properties 0 (length pretty-minor-mode) |
32dab1aa8b9a
(describe-mode): Use marker buttons to make minor mode list into hyperlinks.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
56883
diff
changeset
|
846 '(face bold) pretty-minor-mode) |
32dab1aa8b9a
(describe-mode): Use marker buttons to make minor mode list into hyperlinks.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
56883
diff
changeset
|
847 (save-excursion |
32dab1aa8b9a
(describe-mode): Use marker buttons to make minor mode list into hyperlinks.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
56883
diff
changeset
|
848 (goto-char (point-max)) |
32dab1aa8b9a
(describe-mode): Use marker buttons to make minor mode list into hyperlinks.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
56883
diff
changeset
|
849 (princ "\n\f\n") |
32dab1aa8b9a
(describe-mode): Use marker buttons to make minor mode list into hyperlinks.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
56883
diff
changeset
|
850 (push (point-marker) help-button-cache) |
32dab1aa8b9a
(describe-mode): Use marker buttons to make minor mode list into hyperlinks.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
56883
diff
changeset
|
851 ;; Document the minor modes fully. |
32dab1aa8b9a
(describe-mode): Use marker buttons to make minor mode list into hyperlinks.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
56883
diff
changeset
|
852 (insert pretty-minor-mode) |
72295
12d2238c31b3
(describe-mode): Make minor mode list more concise.
Richard M. Stallman <rms@gnu.org>
parents:
71487
diff
changeset
|
853 (princ (format " minor mode (%s):\n" |
12d2238c31b3
(describe-mode): Make minor mode list more concise.
Richard M. Stallman <rms@gnu.org>
parents:
71487
diff
changeset
|
854 (if (zerop (length indicator)) |
12d2238c31b3
(describe-mode): Make minor mode list more concise.
Richard M. Stallman <rms@gnu.org>
parents:
71487
diff
changeset
|
855 "no indicator" |
12d2238c31b3
(describe-mode): Make minor mode list more concise.
Richard M. Stallman <rms@gnu.org>
parents:
71487
diff
changeset
|
856 (format "indicator%s" |
72321 | 857 indicator)))) |
57485
32dab1aa8b9a
(describe-mode): Use marker buttons to make minor mode list into hyperlinks.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
56883
diff
changeset
|
858 (princ (documentation mode-function))) |
32dab1aa8b9a
(describe-mode): Use marker buttons to make minor mode list into hyperlinks.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
56883
diff
changeset
|
859 (insert-button pretty-minor-mode |
32dab1aa8b9a
(describe-mode): Use marker buttons to make minor mode list into hyperlinks.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
56883
diff
changeset
|
860 'action (car help-button-cache) |
59018
52e86589c83a
(describe-key): Report effective and original binding
Kim F. Storm <storm@cua.dk>
parents:
58992
diff
changeset
|
861 'follow-link t |
57485
32dab1aa8b9a
(describe-mode): Use marker buttons to make minor mode list into hyperlinks.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
56883
diff
changeset
|
862 'help-echo "mouse-2, RET: show full information") |
72295
12d2238c31b3
(describe-mode): Make minor mode list more concise.
Richard M. Stallman <rms@gnu.org>
parents:
71487
diff
changeset
|
863 (newline))) |
12d2238c31b3
(describe-mode): Make minor mode list more concise.
Richard M. Stallman <rms@gnu.org>
parents:
71487
diff
changeset
|
864 (forward-line -1) |
12d2238c31b3
(describe-mode): Make minor mode list more concise.
Richard M. Stallman <rms@gnu.org>
parents:
71487
diff
changeset
|
865 (fill-paragraph nil) |
12d2238c31b3
(describe-mode): Make minor mode list more concise.
Richard M. Stallman <rms@gnu.org>
parents:
71487
diff
changeset
|
866 (forward-line 1)) |
12d2238c31b3
(describe-mode): Make minor mode list more concise.
Richard M. Stallman <rms@gnu.org>
parents:
71487
diff
changeset
|
867 |
12d2238c31b3
(describe-mode): Make minor mode list more concise.
Richard M. Stallman <rms@gnu.org>
parents:
71487
diff
changeset
|
868 (princ "\n(Information about these minor modes follows the major mode info.)\n\n")) |
52690
212969e10f09
(describe-mode): Start with a brief list of minor modes.
Richard M. Stallman <rms@gnu.org>
parents:
52401
diff
changeset
|
869 ;; Document the major mode. |
57485
32dab1aa8b9a
(describe-mode): Use marker buttons to make minor mode list into hyperlinks.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
56883
diff
changeset
|
870 (let ((mode mode-name)) |
32dab1aa8b9a
(describe-mode): Use marker buttons to make minor mode list into hyperlinks.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
56883
diff
changeset
|
871 (with-current-buffer standard-output |
69125
2d354b7c7fb4
(describe-mode): Pass `mode-name' to format-mode-line.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69077
diff
changeset
|
872 (let ((start (point))) |
87789
16e347bbe4ce
(describe-mode): Pass the right buffer to format-mode-line.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
873 (insert (format-mode-line mode nil nil buffer)) |
69125
2d354b7c7fb4
(describe-mode): Pass `mode-name' to format-mode-line.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69077
diff
changeset
|
874 (add-text-properties start (point) '(face bold))))) |
52690
212969e10f09
(describe-mode): Start with a brief list of minor modes.
Richard M. Stallman <rms@gnu.org>
parents:
52401
diff
changeset
|
875 (princ " mode:\n") |
107782
2acfb2283cec
* help.el (describe-mode): Return nil (for IELM's sake).
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
876 (princ (documentation major-mode))))) |
107783
3b312d7aa88e
lisp/help.el: Turn ChangeLog comment into source comment.
Juanma Barranquero <lekktu@gmail.com>
parents:
107782
diff
changeset
|
877 ;; For the sake of IELM and maybe others |
107782
2acfb2283cec
* help.el (describe-mode): Return nil (for IELM's sake).
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
878 nil) |
21371
22a3be0ae9dc
(help-highlight-face): Use underline.
Richard M. Stallman <rms@gnu.org>
parents:
21210
diff
changeset
|
879 |
52690
212969e10f09
(describe-mode): Start with a brief list of minor modes.
Richard M. Stallman <rms@gnu.org>
parents:
52401
diff
changeset
|
880 |
50353
e5761fbf195f
(describe-minor-mode, describe-minor-mode-from-indicator,
Juanma Barranquero <lekktu@gmail.com>
parents:
49757
diff
changeset
|
881 (defun describe-minor-mode (minor-mode) |
50565
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
882 "Display documentation of a minor mode given as MINOR-MODE. |
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
883 MINOR-MODE can be a minor mode symbol or a minor mode indicator string |
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
884 appeared on the mode-line." |
53204
0fd777e399e3
(help-map): Bind `display-local-help' to `C-h .'.
Luc Teirlinck <teirllm@auburn.edu>
parents:
52690
diff
changeset
|
885 (interactive (list (completing-read |
50565
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
886 "Minor mode: " |
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
887 (nconc |
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
888 (describe-minor-mode-completion-table-for-symbol) |
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
889 (describe-minor-mode-completion-table-for-indicator) |
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
890 )))) |
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
891 (if (symbolp minor-mode) |
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
892 (setq minor-mode (symbol-name minor-mode))) |
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
893 (let ((symbols (describe-minor-mode-completion-table-for-symbol)) |
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
894 (indicators (describe-minor-mode-completion-table-for-indicator))) |
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
895 (cond |
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
896 ((member minor-mode symbols) |
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
897 (describe-minor-mode-from-symbol (intern minor-mode))) |
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
898 ((member minor-mode indicators) |
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
899 (describe-minor-mode-from-indicator minor-mode)) |
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
900 (t |
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
901 (error "No such minor mode: %s" minor-mode))))) |
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
902 |
53204
0fd777e399e3
(help-map): Bind `display-local-help' to `C-h .'.
Luc Teirlinck <teirllm@auburn.edu>
parents:
52690
diff
changeset
|
903 ;; symbol |
50565
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
904 (defun describe-minor-mode-completion-table-for-symbol () |
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
905 ;; In order to list up all minor modes, minor-mode-list |
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
906 ;; is used here instead of minor-mode-alist. |
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
907 (delq nil (mapcar 'symbol-name minor-mode-list))) |
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
908 (defun describe-minor-mode-from-symbol (symbol) |
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
909 "Display documentation of a minor mode given as a symbol, SYMBOL" |
53204
0fd777e399e3
(help-map): Bind `display-local-help' to `C-h .'.
Luc Teirlinck <teirllm@auburn.edu>
parents:
52690
diff
changeset
|
910 (interactive (list (intern (completing-read |
50565
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
911 "Minor mode symbol: " |
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
912 (describe-minor-mode-completion-table-for-symbol))))) |
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
913 (if (fboundp symbol) |
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
914 (describe-function symbol) |
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
915 (describe-variable symbol))) |
50353
e5761fbf195f
(describe-minor-mode, describe-minor-mode-from-indicator,
Juanma Barranquero <lekktu@gmail.com>
parents:
49757
diff
changeset
|
916 |
50565
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
917 ;; indicator |
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
918 (defun describe-minor-mode-completion-table-for-indicator () |
53204
0fd777e399e3
(help-map): Bind `display-local-help' to `C-h .'.
Luc Teirlinck <teirllm@auburn.edu>
parents:
52690
diff
changeset
|
919 (delq nil |
50565
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
920 (mapcar (lambda (x) |
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
921 (let ((i (format-mode-line x))) |
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
922 ;; remove first space if existed |
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
923 (cond |
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
924 ((= 0 (length i)) |
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
925 nil) |
74230
274336dd0ead
(describe-minor-mode-completion-table-for-indicator,
Juanma Barranquero <lekktu@gmail.com>
parents:
73759
diff
changeset
|
926 ((eq (aref i 0) ?\s) |
50565
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
927 (substring i 1)) |
53204
0fd777e399e3
(help-map): Bind `display-local-help' to `C-h .'.
Luc Teirlinck <teirllm@auburn.edu>
parents:
52690
diff
changeset
|
928 (t |
50565
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
929 i)))) |
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
930 minor-mode-alist))) |
50353
e5761fbf195f
(describe-minor-mode, describe-minor-mode-from-indicator,
Juanma Barranquero <lekktu@gmail.com>
parents:
49757
diff
changeset
|
931 (defun describe-minor-mode-from-indicator (indicator) |
50565
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
932 "Display documentation of a minor mode specified by INDICATOR. |
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
933 If you call this function interactively, you can give indicator which |
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
934 is currently activated with completion." |
53204
0fd777e399e3
(help-map): Bind `display-local-help' to `C-h .'.
Luc Teirlinck <teirllm@auburn.edu>
parents:
52690
diff
changeset
|
935 (interactive (list |
0fd777e399e3
(help-map): Bind `display-local-help' to `C-h .'.
Luc Teirlinck <teirllm@auburn.edu>
parents:
52690
diff
changeset
|
936 (completing-read |
50353
e5761fbf195f
(describe-minor-mode, describe-minor-mode-from-indicator,
Juanma Barranquero <lekktu@gmail.com>
parents:
49757
diff
changeset
|
937 "Minor mode indicator: " |
50565
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
938 (describe-minor-mode-completion-table-for-indicator)))) |
50353
e5761fbf195f
(describe-minor-mode, describe-minor-mode-from-indicator,
Juanma Barranquero <lekktu@gmail.com>
parents:
49757
diff
changeset
|
939 (let ((minor-mode (lookup-minor-mode-from-indicator indicator))) |
e5761fbf195f
(describe-minor-mode, describe-minor-mode-from-indicator,
Juanma Barranquero <lekktu@gmail.com>
parents:
49757
diff
changeset
|
940 (if minor-mode |
50565
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
941 (describe-minor-mode-from-symbol minor-mode) |
50353
e5761fbf195f
(describe-minor-mode, describe-minor-mode-from-indicator,
Juanma Barranquero <lekktu@gmail.com>
parents:
49757
diff
changeset
|
942 (error "Cannot find minor mode for `%s'" indicator)))) |
e5761fbf195f
(describe-minor-mode, describe-minor-mode-from-indicator,
Juanma Barranquero <lekktu@gmail.com>
parents:
49757
diff
changeset
|
943 |
e5761fbf195f
(describe-minor-mode, describe-minor-mode-from-indicator,
Juanma Barranquero <lekktu@gmail.com>
parents:
49757
diff
changeset
|
944 (defun lookup-minor-mode-from-indicator (indicator) |
e5761fbf195f
(describe-minor-mode, describe-minor-mode-from-indicator,
Juanma Barranquero <lekktu@gmail.com>
parents:
49757
diff
changeset
|
945 "Return a minor mode symbol from its indicator on the modeline." |
50565
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
946 ;; remove first space if existed |
53204
0fd777e399e3
(help-map): Bind `display-local-help' to `C-h .'.
Luc Teirlinck <teirllm@auburn.edu>
parents:
52690
diff
changeset
|
947 (if (and (< 0 (length indicator)) |
74230
274336dd0ead
(describe-minor-mode-completion-table-for-indicator,
Juanma Barranquero <lekktu@gmail.com>
parents:
73759
diff
changeset
|
948 (eq (aref indicator 0) ?\s)) |
50565
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
949 (setq indicator (substring indicator 1))) |
50353
e5761fbf195f
(describe-minor-mode, describe-minor-mode-from-indicator,
Juanma Barranquero <lekktu@gmail.com>
parents:
49757
diff
changeset
|
950 (let ((minor-modes minor-mode-alist) |
e5761fbf195f
(describe-minor-mode, describe-minor-mode-from-indicator,
Juanma Barranquero <lekktu@gmail.com>
parents:
49757
diff
changeset
|
951 result) |
e5761fbf195f
(describe-minor-mode, describe-minor-mode-from-indicator,
Juanma Barranquero <lekktu@gmail.com>
parents:
49757
diff
changeset
|
952 (while minor-modes |
e5761fbf195f
(describe-minor-mode, describe-minor-mode-from-indicator,
Juanma Barranquero <lekktu@gmail.com>
parents:
49757
diff
changeset
|
953 (let* ((minor-mode (car (car minor-modes))) |
53204
0fd777e399e3
(help-map): Bind `display-local-help' to `C-h .'.
Luc Teirlinck <teirllm@auburn.edu>
parents:
52690
diff
changeset
|
954 (anindicator (format-mode-line |
50565
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
955 (car (cdr (car minor-modes)))))) |
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
956 ;; remove first space if existed |
53204
0fd777e399e3
(help-map): Bind `display-local-help' to `C-h .'.
Luc Teirlinck <teirllm@auburn.edu>
parents:
52690
diff
changeset
|
957 (if (and (stringp anindicator) |
50565
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
958 (> (length anindicator) 0) |
74230
274336dd0ead
(describe-minor-mode-completion-table-for-indicator,
Juanma Barranquero <lekktu@gmail.com>
parents:
73759
diff
changeset
|
959 (eq (aref anindicator 0) ?\s)) |
50565
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
960 (setq anindicator (substring anindicator 1))) |
cd863af50ea1
* help.el (describe-minor-mode): New function implementation.
Masatake YAMATO <jet@gyve.org>
parents:
50353
diff
changeset
|
961 (if (equal indicator anindicator) |
50353
e5761fbf195f
(describe-minor-mode, describe-minor-mode-from-indicator,
Juanma Barranquero <lekktu@gmail.com>
parents:
49757
diff
changeset
|
962 (setq result minor-mode |
e5761fbf195f
(describe-minor-mode, describe-minor-mode-from-indicator,
Juanma Barranquero <lekktu@gmail.com>
parents:
49757
diff
changeset
|
963 minor-modes nil) |
e5761fbf195f
(describe-minor-mode, describe-minor-mode-from-indicator,
Juanma Barranquero <lekktu@gmail.com>
parents:
49757
diff
changeset
|
964 (setq minor-modes (cdr minor-modes))))) |
e5761fbf195f
(describe-minor-mode, describe-minor-mode-from-indicator,
Juanma Barranquero <lekktu@gmail.com>
parents:
49757
diff
changeset
|
965 result)) |
e5761fbf195f
(describe-minor-mode, describe-minor-mode-from-indicator,
Juanma Barranquero <lekktu@gmail.com>
parents:
49757
diff
changeset
|
966 |
23747
fb3963445995
Add resizing of temporary buffers.
Richard M. Stallman <rms@gnu.org>
parents:
23742
diff
changeset
|
967 |
fb3963445995
Add resizing of temporary buffers.
Richard M. Stallman <rms@gnu.org>
parents:
23742
diff
changeset
|
968 ;;; Automatic resizing of temporary buffers. |
fb3963445995
Add resizing of temporary buffers.
Richard M. Stallman <rms@gnu.org>
parents:
23742
diff
changeset
|
969 |
23749
ea095fa15fb9
Rename function and variables added in previous change:
Richard M. Stallman <rms@gnu.org>
parents:
23747
diff
changeset
|
970 (defcustom temp-buffer-max-height (lambda (buffer) (/ (- (frame-height) 2) 2)) |
69125
2d354b7c7fb4
(describe-mode): Pass `mode-name' to format-mode-line.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
69077
diff
changeset
|
971 "Maximum height of a window displaying a temporary buffer. |
71080
83ec7285ed6c
(temp-buffer-max-height): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
69674
diff
changeset
|
972 This is effective only when Temp Buffer Resize mode is enabled. |
83ec7285ed6c
(temp-buffer-max-height): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
69674
diff
changeset
|
973 The value is the maximum height (in lines) which `resize-temp-buffer-window' |
23747
fb3963445995
Add resizing of temporary buffers.
Richard M. Stallman <rms@gnu.org>
parents:
23742
diff
changeset
|
974 will give to a window displaying a temporary buffer. |
71080
83ec7285ed6c
(temp-buffer-max-height): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
69674
diff
changeset
|
975 It can also be a function to be called to choose the height for such a buffer. |
83ec7285ed6c
(temp-buffer-max-height): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
69674
diff
changeset
|
976 It gets one argumemt, the buffer, and should return a positive integer." |
23747
fb3963445995
Add resizing of temporary buffers.
Richard M. Stallman <rms@gnu.org>
parents:
23742
diff
changeset
|
977 :type '(choice integer function) |
fb3963445995
Add resizing of temporary buffers.
Richard M. Stallman <rms@gnu.org>
parents:
23742
diff
changeset
|
978 :group 'help |
fb3963445995
Add resizing of temporary buffers.
Richard M. Stallman <rms@gnu.org>
parents:
23742
diff
changeset
|
979 :version "20.4") |
fb3963445995
Add resizing of temporary buffers.
Richard M. Stallman <rms@gnu.org>
parents:
23742
diff
changeset
|
980 |
32183
3e4bdf7c90c4
(help-xref-on-pp): Use match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31491
diff
changeset
|
981 (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
|
982 "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
|
983 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
|
984 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
|
985 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
|
986 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
|
987 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
|
988 :global t :group 'help |
32183
3e4bdf7c90c4
(help-xref-on-pp): Use match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31491
diff
changeset
|
989 (if temp-buffer-resize-mode |
36249 | 990 ;; `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
|
991 ;; 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
|
992 (add-hook 'temp-buffer-show-hook 'resize-temp-buffer-window 'append) |
32184 | 993 (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
|
994 |
fb3963445995
Add resizing of temporary buffers.
Richard M. Stallman <rms@gnu.org>
parents:
23742
diff
changeset
|
995 (defun resize-temp-buffer-window () |
78418
c43bd3dbaa93
(resize-temp-buffer-window): Use window-full-width-p
Martin Rudalics <rudalics@gmx.at>
parents:
78236
diff
changeset
|
996 "Resize the selected 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
|
997 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
|
998 `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
|
999 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
|
1000 out of view." |
fb3963445995
Add resizing of temporary buffers.
Richard M. Stallman <rms@gnu.org>
parents:
23742
diff
changeset
|
1001 (unless (or (one-window-p 'nomini) |
fb3963445995
Add resizing of temporary buffers.
Richard M. Stallman <rms@gnu.org>
parents:
23742
diff
changeset
|
1002 (not (pos-visible-in-window-p (point-min))) |
78418
c43bd3dbaa93
(resize-temp-buffer-window): Use window-full-width-p
Martin Rudalics <rudalics@gmx.at>
parents:
78236
diff
changeset
|
1003 (not (window-full-width-p))) |
32706
605eabd04a57
(resize-temp-buffer-window): Use `fit-window-to-buffer'.
Miles Bader <miles@gnu.org>
parents:
32690
diff
changeset
|
1004 (fit-window-to-buffer |
605eabd04a57
(resize-temp-buffer-window): Use `fit-window-to-buffer'.
Miles Bader <miles@gnu.org>
parents:
32690
diff
changeset
|
1005 (selected-window) |
605eabd04a57
(resize-temp-buffer-window): Use `fit-window-to-buffer'.
Miles Bader <miles@gnu.org>
parents:
32690
diff
changeset
|
1006 (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
|
1007 (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
|
1008 temp-buffer-max-height)))) |
23747
fb3963445995
Add resizing of temporary buffers.
Richard M. Stallman <rms@gnu.org>
parents:
23742
diff
changeset
|
1009 |
69131
aa9f0a1e543f
(help): Revert last part of 2006-02-23 change (deletion of the `provide' call).
Juanma Barranquero <lekktu@gmail.com>
parents:
69125
diff
changeset
|
1010 |
86005
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1011 ;;; help-window |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1012 |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1013 (defcustom help-window-select 'other |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1014 "Non-nil means select help window for viewing. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1015 Choices are: |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1016 never (nil) Select help window only if there is no other window |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1017 on its frame. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1018 other Select help window unless the selected window is the |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1019 only other window on its frame. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1020 always (t) Always select the help window. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1021 |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1022 This option has effect if and only if the help window was created |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1023 by `with-help-window'" |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1024 :type '(choice (const :tag "never (nil)" nil) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1025 (const :tag "other" other) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1026 (const :tag "always (t)" t)) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1027 :group 'help |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1028 :version "23.1") |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1029 |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1030 (defun help-window-display-message (quit-part window &optional other) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1031 "Display message telling how to quit and scroll help window. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1032 QUIT-PART is a string telling how to quit the help window WINDOW. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1033 Optional argument OTHER non-nil means return text telling how to |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1034 scroll the \"other\" window." |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1035 (let ((scroll-part |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1036 (cond |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1037 ((pos-visible-in-window-p |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1038 (with-current-buffer (window-buffer window) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1039 (point-max)) window) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1040 ;; Buffer end is visible. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1041 ".") |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1042 (other ", \\[scroll-other-window] to scroll help.") |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1043 (t ", \\[scroll-up] to scroll help.")))) |
87096
a99a2e8bc21e
Fix possibly buggy calls to `message'.
Deepak Goel <deego@gnufans.org>
parents:
86005
diff
changeset
|
1044 (message "%s" |
86005
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1045 (substitute-command-keys (concat quit-part scroll-part))))) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1046 |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1047 (defun help-window-setup-finish (window &optional reuse keep-frame) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1048 "Finish setting up help window WINDOW. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1049 Select WINDOW according to the value of `help-window-select'. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1050 Display message telling how to scroll and eventually quit WINDOW. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1051 |
107913
4a06b9752df5
* help.el (help-window-setup-finish): Doc fix (Bug#5830).
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1052 Optional argument REUSE non-nil means WINDOW has been reused by |
4a06b9752df5
* help.el (help-window-setup-finish): Doc fix (Bug#5830).
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1053 `display-buffer'. Optional argument KEEP-FRAME non-nil means |
4a06b9752df5
* help.el (help-window-setup-finish): Doc fix (Bug#5830).
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
1054 that quitting should not delete WINDOW's frame." |
86005
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1055 (let ((number-of-windows |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1056 (length (window-list (window-frame window) 'no-mini window)))) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1057 (cond |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1058 ((eq window (selected-window)) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1059 ;; The help window is the selected window, probably the |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1060 ;; `pop-up-windows' nil case. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1061 (help-window-display-message |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1062 (if reuse |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1063 "Type \"q\" to restore this window" |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1064 ;; This should not be taken. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1065 "Type \"q\" to quit") window)) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1066 ((= number-of-windows 1) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1067 ;; The help window is alone on a frame and not the selected |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1068 ;; window, could be the `pop-up-frames' t case. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1069 (help-window-display-message |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1070 (cond |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1071 (keep-frame "Type \"q\" to delete this window") |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1072 (reuse "Type \"q\" to restore this window") |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1073 (view-remove-frame-by-deleting "Type \"q\" to delete this frame") |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1074 (t "Type \"q\" to iconify this frame")) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1075 window)) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1076 ((and (= number-of-windows 2) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1077 (eq (window-frame window) (window-frame (selected-window)))) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1078 ;; There are two windows on the help window's frame and the other |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1079 ;; window is the selected one. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1080 (if (memq help-window-select '(nil other)) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1081 ;; Do not select the help window. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1082 (help-window-display-message |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1083 (if reuse |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1084 ;; Offer `display-buffer' for consistency with |
104367
13e0436a968a
(help-print-return-message): Rename from print-help-return-message.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
101182
diff
changeset
|
1085 ;; `help-print-return-message'. This is hardly TRT when |
86005
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1086 ;; the other window and the selected window display the |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1087 ;; same buffer but has been handled this way ever since. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1088 "Type \\[display-buffer] RET to restore the other window" |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1089 ;; The classic "two windows" configuration. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1090 "Type \\[delete-other-windows] to delete the help window") |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1091 window t) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1092 ;; Select help window and tell how to quit. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1093 (select-window window) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1094 (help-window-display-message |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1095 (if reuse |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1096 "Type \"q\" to restore this window" |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1097 "Type \"q\" to delete this window") window))) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1098 (help-window-select |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1099 ;; Issuing a message with 3 or more windows on the same frame |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1100 ;; without selecting the help window doesn't make any sense. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1101 (select-window window) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1102 (help-window-display-message |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1103 (if reuse |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1104 "Type \"q\" to restore this window" |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1105 "Type \"q\" to delete this window") window))))) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1106 |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1107 (defun help-window-setup (list-of-frames list-of-window-tuples) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1108 "Set up help window. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1109 LIST-OF-FRAMES and LIST-OF-WINDOW-TUPLES are the lists of frames |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1110 and window quadruples built by `with-help-window'. The help |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1111 window itself is specified by the variable `help-window'." |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1112 (let* ((help-buffer (window-buffer help-window)) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1113 ;; `help-buffer' now denotes the help window's buffer. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1114 (view-entry |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1115 (assq help-window |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1116 (buffer-local-value 'view-return-to-alist help-buffer))) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1117 (help-entry (assq help-window list-of-window-tuples))) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1118 |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1119 ;; Handle `help-window-point-marker'. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1120 (when (eq (marker-buffer help-window-point-marker) help-buffer) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1121 (set-window-point help-window help-window-point-marker) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1122 ;; Reset `help-window-point-marker'. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1123 (set-marker help-window-point-marker nil)) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1124 |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1125 (cond |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1126 (view-entry |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1127 ;; `view-return-to-alist' has an entry for the help window. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1128 (cond |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1129 ((eq help-window (selected-window)) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1130 ;; The help window is the selected window, probably because the |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1131 ;; user followed a backward/forward button or a cross reference. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1132 ;; In this case just purge stale entries from |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1133 ;; `view-return-to-alist' but leave the entry alone and don't |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1134 ;; display a message. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1135 (view-return-to-alist-update help-buffer)) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1136 ((and help-entry (eq (cadr help-entry) help-buffer)) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1137 ;; The help window was not selected but displayed the help |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1138 ;; buffer. In this case reuse existing exit information but try |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1139 ;; to get back to the selected window when quitting. Don't |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1140 ;; display a message since the user must have seen one before. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1141 (view-return-to-alist-update |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1142 help-buffer (cons help-window |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1143 (cons (selected-window) (cddr view-entry))))) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1144 (help-entry |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1145 ;; The help window was not selected, did display the help buffer |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1146 ;; earlier, but displayed another buffer when help was invoked. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1147 ;; Set up things so that quitting will show that buffer again. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1148 (view-return-to-alist-update |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1149 help-buffer (cons help-window |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1150 (cons (selected-window) (cdr help-entry)))) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1151 (help-window-setup-finish help-window t)) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1152 (t |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1153 ;; The help window is new but `view-return-to-alist' had an |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1154 ;; entry for it. This should never happen. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1155 (view-return-to-alist-update |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1156 help-buffer (cons help-window |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1157 (cons (selected-window) 'quit-window))) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1158 (help-window-setup-finish help-window t)))) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1159 (help-entry |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1160 ;; `view-return-to-alist' does not have an entry for help window |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1161 ;; but `list-of-window-tuples' does. Hence `display-buffer' must |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1162 ;; have reused an existing window. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1163 (if (eq (cadr help-entry) help-buffer) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1164 ;; The help window displayed `help-buffer' before but no |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1165 ;; `view-return-to-alist' entry was found probably because the |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1166 ;; user manually switched to the help buffer. Set up things |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1167 ;; for `quit-window' although `view-exit-action' should be |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1168 ;; able to handle this case all by itself. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1169 (progn |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1170 (view-return-to-alist-update |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1171 help-buffer (cons help-window |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1172 (cons (selected-window) 'quit-window))) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1173 (help-window-setup-finish help-window t)) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1174 ;; The help window displayed another buffer before. Set up |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1175 ;; things in a way that quitting can orderly show that buffer |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1176 ;; again. The window-start and window-point information from |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1177 ;; `list-of-window-tuples' provide the necessary information. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1178 (view-return-to-alist-update |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1179 help-buffer (cons help-window |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1180 (cons (selected-window) (cdr help-entry)))) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1181 (help-window-setup-finish help-window t))) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1182 ((memq (window-frame help-window) list-of-frames) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1183 ;; The help window is a new window on an existing frame. This |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1184 ;; case must be handled specially by `help-window-setup-finish' |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1185 ;; and `view-mode-exit' to ascertain that quitting does _not_ |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1186 ;; inadvertently delete the frame. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1187 (view-return-to-alist-update |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1188 help-buffer (cons help-window |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1189 (cons (selected-window) 'keep-frame))) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1190 (help-window-setup-finish help-window nil t)) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1191 (t |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1192 ;; The help window is shown on a new frame. In this case quitting |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1193 ;; shall handle both, the help window _and_ its frame. We changed |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1194 ;; the default of `view-remove-frame-by-deleting' to t in order to |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1195 ;; intuitively DTRT here. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1196 (view-return-to-alist-update |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1197 help-buffer (cons help-window (cons (selected-window) t))) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1198 (help-window-setup-finish help-window))))) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1199 |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1200 ;; `with-help-window' is a wrapper for `with-output-to-temp-buffer' |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1201 ;; providing the following additional twists: |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1202 |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1203 ;; (1) Issue more accurate messages telling how to scroll and quit the |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1204 ;; help window. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1205 |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1206 ;; (2) Make `view-mode-exit' DTRT in more cases. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1207 |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1208 ;; (3) An option (customizable via `help-window-select') to select the |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1209 ;; help window automatically. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1210 |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1211 ;; (4) A marker (`help-window-point-marker') to move point in the help |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1212 ;; window to an arbitrary buffer position. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1213 |
104367
13e0436a968a
(help-print-return-message): Rename from print-help-return-message.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
101182
diff
changeset
|
1214 ;; Note: It's usually always wrong to use `help-print-return-message' in |
86005
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1215 ;; the body of `with-help-window'. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1216 (defmacro with-help-window (buffer-name &rest body) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1217 "Display buffer BUFFER-NAME in a help window evaluating BODY. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1218 Select help window if the actual value of the user option |
97457
430e9c7bf60d
(with-help-window): Return last value in BODY.
Martin Rudalics <rudalics@gmx.at>
parents:
95601
diff
changeset
|
1219 `help-window-select' says so. Return last value in BODY." |
86005
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1220 (declare (indent 1) (debug t)) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1221 ;; Bind list-of-frames to `frame-list' and list-of-window-tuples to a |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1222 ;; list of one <window window-buffer window-start window-point> tuple |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1223 ;; for each live window. |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1224 `(let ((list-of-frames (frame-list)) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1225 (list-of-window-tuples |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1226 (let (list) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1227 (walk-windows |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1228 (lambda (window) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1229 (push (list window (window-buffer window) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1230 (window-start window) (window-point window)) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1231 list)) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1232 'no-mini t) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1233 list))) |
97457
430e9c7bf60d
(with-help-window): Return last value in BODY.
Martin Rudalics <rudalics@gmx.at>
parents:
95601
diff
changeset
|
1234 ;; Make `help-window' t to trigger `help-mode-finish' to set |
430e9c7bf60d
(with-help-window): Return last value in BODY.
Martin Rudalics <rudalics@gmx.at>
parents:
95601
diff
changeset
|
1235 ;; `help-window' to the actual help window. |
86005
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1236 (setq help-window t) |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1237 ;; Make `help-window-point-marker' point nowhere (the only place |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1238 ;; where this should be set to a buffer position is within BODY). |
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1239 (set-marker help-window-point-marker nil) |
97457
430e9c7bf60d
(with-help-window): Return last value in BODY.
Martin Rudalics <rudalics@gmx.at>
parents:
95601
diff
changeset
|
1240 (prog1 |
430e9c7bf60d
(with-help-window): Return last value in BODY.
Martin Rudalics <rudalics@gmx.at>
parents:
95601
diff
changeset
|
1241 ;; Return value returned by `with-output-to-temp-buffer'. |
430e9c7bf60d
(with-help-window): Return last value in BODY.
Martin Rudalics <rudalics@gmx.at>
parents:
95601
diff
changeset
|
1242 (with-output-to-temp-buffer ,buffer-name |
430e9c7bf60d
(with-help-window): Return last value in BODY.
Martin Rudalics <rudalics@gmx.at>
parents:
95601
diff
changeset
|
1243 (progn ,@body)) |
430e9c7bf60d
(with-help-window): Return last value in BODY.
Martin Rudalics <rudalics@gmx.at>
parents:
95601
diff
changeset
|
1244 (when (windowp help-window) |
430e9c7bf60d
(with-help-window): Return last value in BODY.
Martin Rudalics <rudalics@gmx.at>
parents:
95601
diff
changeset
|
1245 ;; Set up help window. |
430e9c7bf60d
(with-help-window): Return last value in BODY.
Martin Rudalics <rudalics@gmx.at>
parents:
95601
diff
changeset
|
1246 (help-window-setup list-of-frames list-of-window-tuples)) |
430e9c7bf60d
(with-help-window): Return last value in BODY.
Martin Rudalics <rudalics@gmx.at>
parents:
95601
diff
changeset
|
1247 ;; Reset `help-window' to nil to avoid confusing future calls of |
430e9c7bf60d
(with-help-window): Return last value in BODY.
Martin Rudalics <rudalics@gmx.at>
parents:
95601
diff
changeset
|
1248 ;; `help-mode-finish' with plain `with-output-to-temp-buffer'. |
430e9c7bf60d
(with-help-window): Return last value in BODY.
Martin Rudalics <rudalics@gmx.at>
parents:
95601
diff
changeset
|
1249 (setq help-window nil)))) |
86005
42a6cbfb84e6
(help-window, help-window-point-marker): New variables.
Martin Rudalics <rudalics@gmx.at>
parents:
84871
diff
changeset
|
1250 |
69131
aa9f0a1e543f
(help): Revert last part of 2006-02-23 change (deletion of the `provide' call).
Juanma Barranquero <lekktu@gmail.com>
parents:
69125
diff
changeset
|
1251 (provide 'help) |
aa9f0a1e543f
(help): Revert last part of 2006-02-23 change (deletion of the `provide' call).
Juanma Barranquero <lekktu@gmail.com>
parents:
69125
diff
changeset
|
1252 |
660
08eb386dd0f3
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
444
diff
changeset
|
1253 ;;; help.el ends here |