Mercurial > emacs
annotate lisp/emacs-lisp/eldoc.el @ 17803:906dcb974266
Don't include term.el.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Wed, 14 May 1997 19:51:33 +0000 |
parents | f2db4e8bb6ed |
children | 161cc8316f98 |
rev | line source |
---|---|
13530 | 1 ;;; eldoc.el --- show function arglist or variable docstring in echo area |
2 | |
16969
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
3 ;; Copyright (C) 1996, 1997 Free Software Foundation, Inc. |
13530 | 4 |
5 ;; Author: Noah Friedman <friedman@prep.ai.mit.edu> | |
6 ;; Maintainer: friedman@prep.ai.mit.edu | |
7 ;; Keywords: extensions | |
8 ;; Created: 1995-10-06 | |
9 | |
17445
f2db4e8bb6ed
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17253
diff
changeset
|
10 ;; $Id: eldoc.el,v 1.11 1997/03/27 10:44:56 friedman Exp rms $ |
13530 | 11 |
16969
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
12 ;; This file is part of GNU Emacs. |
13530 | 13 |
16969
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
14 ;; GNU Emacs is free software; you can redistribute it and/or modify |
13530 | 15 ;; it under the terms of the GNU General Public License as published by |
16 ;; the Free Software Foundation; either version 2, or (at your option) | |
17 ;; any later version. | |
16969
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
18 |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
19 ;; GNU Emacs is distributed in the hope that it will be useful, |
13530 | 20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
22 ;; GNU General Public License for more details. | |
16969
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
23 |
13530 | 24 ;; You should have received a copy of the GNU General Public License |
16969
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
25 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
26 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
27 ;; Boston, MA 02111-1307, USA. |
13530 | 28 |
29 ;;; Commentary: | |
30 | |
16969
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
31 ;; This program was inspired by the behavior of the "mouse documentation |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
32 ;; window" on many Lisp Machine systems; as you type a function's symbol |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
33 ;; name as part of a sexp, it will print the argument list for that |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
34 ;; function. Behavior is not identical; for example, you need not actually |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
35 ;; type the function name, you need only move point around in a sexp that |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
36 ;; calls it. Also, if point is over a documented variable, it will print |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
37 ;; the one-line documentation for that variable instead, to remind you of |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
38 ;; that variable's meaning. |
13530 | 39 |
40 ;; One useful way to enable this minor mode is to put the following in your | |
41 ;; .emacs: | |
42 ;; | |
43 ;; (autoload 'turn-on-eldoc-mode "eldoc" nil t) | |
44 ;; (add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode) | |
45 ;; (add-hook 'lisp-interaction-mode-hook 'turn-on-eldoc-mode) | |
16975
188c4da9bf5d
(eldoc-display-message-p): New function.
Noah Friedman <friedman@splode.com>
parents:
16969
diff
changeset
|
46 ;; (add-hook 'ielm-mode-hook 'turn-on-eldoc-mode) |
13530 | 47 |
48 ;;; Code: | |
49 | |
16969
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
50 ;; Use idle timers if available in the version of emacs running. |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
51 ;; Please don't change this to use `require'; this package works as-is in |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
52 ;; XEmacs (which doesn't have timer.el as of 19.14), and I would like to |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
53 ;; maintain compatibility with that since I must use it sometimes. --Noah |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
54 (or (featurep 'timer) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
55 (load "timer" t)) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
56 |
17445
f2db4e8bb6ed
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17253
diff
changeset
|
57 (defgroup eldoc nil |
f2db4e8bb6ed
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17253
diff
changeset
|
58 "Show function arglist or variable docstring in echo area." |
f2db4e8bb6ed
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17253
diff
changeset
|
59 :group 'extensions) |
f2db4e8bb6ed
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17253
diff
changeset
|
60 |
13530 | 61 ;;;###autoload |
17445
f2db4e8bb6ed
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17253
diff
changeset
|
62 (defcustom eldoc-mode nil |
13530 | 63 "*If non-nil, show the defined parameters for the elisp function near point. |
64 | |
65 For the emacs lisp function at the beginning of the sexp which point is | |
66 within, show the defined parameters for the function in the echo area. | |
67 This information is extracted directly from the function or macro if it is | |
16969
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
68 in pure lisp. If the emacs function is a subr, the parameters are obtained |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
69 from the documentation string if possible. |
13530 | 70 |
71 If point is over a documented variable, print that variable's docstring | |
16969
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
72 instead. |
13530 | 73 |
17445
f2db4e8bb6ed
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17253
diff
changeset
|
74 This variable is buffer-local." |
f2db4e8bb6ed
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17253
diff
changeset
|
75 :type 'boolean |
f2db4e8bb6ed
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17253
diff
changeset
|
76 :group 'eldoc) |
13530 | 77 (make-variable-buffer-local 'eldoc-mode) |
78 | |
17445
f2db4e8bb6ed
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17253
diff
changeset
|
79 (defcustom eldoc-idle-delay 0.50 |
13530 | 80 "*Number of seconds of idle time to wait before printing. |
81 If user input arrives before this interval of time has elapsed after the | |
82 last input, no documentation will be printed. | |
83 | |
17445
f2db4e8bb6ed
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17253
diff
changeset
|
84 If this variable is set to 0, no idle time is required." |
f2db4e8bb6ed
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17253
diff
changeset
|
85 :type 'number |
f2db4e8bb6ed
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17253
diff
changeset
|
86 :group 'eldoc) |
13530 | 87 |
17445
f2db4e8bb6ed
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17253
diff
changeset
|
88 (defcustom eldoc-minor-mode-string " ElDoc" |
f2db4e8bb6ed
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17253
diff
changeset
|
89 "*String to display in mode line when Eldoc Mode is enabled." |
f2db4e8bb6ed
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17253
diff
changeset
|
90 :type 'string |
f2db4e8bb6ed
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17253
diff
changeset
|
91 :group 'eldoc) |
16969
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
92 |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
93 ;; Put this minor mode on the global minor-mode-alist. |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
94 (or (assq 'eldoc-mode (default-value 'minor-mode-alist)) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
95 (setq-default minor-mode-alist |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
96 (append (default-value 'minor-mode-alist) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
97 '((eldoc-mode eldoc-minor-mode-string))))) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
98 |
17445
f2db4e8bb6ed
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17253
diff
changeset
|
99 (defcustom eldoc-argument-case 'upcase |
13530 | 100 "Case to display argument names of functions, as a symbol. |
101 This has two preferred values: `upcase' or `downcase'. | |
102 Actually, any name of a function which takes a string as an argument and | |
17445
f2db4e8bb6ed
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17253
diff
changeset
|
103 returns another string is acceptable." |
f2db4e8bb6ed
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17253
diff
changeset
|
104 :type '(choice (const upcase) (const downcase)) |
f2db4e8bb6ed
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17253
diff
changeset
|
105 :group 'eldoc) |
13530 | 106 |
16996
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
107 ;; No user options below here. |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
108 |
16969
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
109 (defvar eldoc-message-commands nil |
16996
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
110 "Commands after which it is appropriate to print in the echo area. |
16969
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
111 |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
112 Eldoc does not try to print function arglists, etc. after just any command, |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
113 because some commands print their own messages in the echo area and these |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
114 functions would instantly overwrite them. But self-insert-command as well |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
115 as most motion commands are good candidates. |
13530 | 116 |
16996
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
117 This variable contains an obarray of symbols; do not manipulate it |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
118 directly. Instead, use the functions `eldoc-add-command' and |
16969
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
119 `eldoc-remove-command'.") |
13530 | 120 |
16996
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
121 ;; This is used by eldoc-add-command to initialize eldoc-message-commands |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
122 ;; as an obarray. |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
123 ;; If you increase the number of buckets, keep it a prime number. |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
124 (defconst eldoc-message-commands-table-size 31) |
13530 | 125 |
126 ;; Bookkeeping; the car contains the last symbol read from the buffer. | |
127 ;; The cdr contains the string last displayed in the echo area, so it can | |
128 ;; be printed again if necessary without reconsing. | |
129 (defvar eldoc-last-data '(nil . nil)) | |
16996
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
130 (defvar eldoc-last-message nil) |
13530 | 131 |
16969
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
132 ;; Idle timers are supported in Emacs 19.31 and later. |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
133 (defconst eldoc-use-idle-timer-p (fboundp 'run-with-idle-timer)) |
13591
b2fb0109006d
(eldoc-minor-mode-string): New variable.
Noah Friedman <friedman@splode.com>
parents:
13532
diff
changeset
|
134 |
16969
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
135 ;; eldoc's timer object, if using idle timers |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
136 (defvar eldoc-timer nil) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
137 |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
138 ;; idle time delay currently in use by timer. |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
139 ;; This is used to determine if eldoc-idle-delay is changed by the user. |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
140 (defvar eldoc-current-idle-delay eldoc-idle-delay) |
13530 | 141 |
142 | |
143 ;;;###autoload | |
144 (defun eldoc-mode (&optional prefix) | |
16969
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
145 "*Enable or disable eldoc mode. |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
146 See documentation for the variable of the same name for more details. |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
147 |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
148 If called interactively with no prefix argument, toggle current condition |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
149 of the mode. |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
150 If called with a positive or negative prefix argument, enable or disable |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
151 the mode, respectively." |
13530 | 152 (interactive "P") |
16996
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
153 (setq eldoc-last-message nil) |
16969
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
154 (cond (eldoc-use-idle-timer-p |
16996
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
155 (add-hook 'post-command-hook 'eldoc-schedule-timer) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
156 (add-hook 'pre-command-hook 'eldoc-pre-command-refresh-echo-area)) |
16969
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
157 (t |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
158 ;; Use post-command-idle-hook if defined, otherwise use |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
159 ;; post-command-hook. The former is only proper to use in Emacs |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
160 ;; 19.30; that is the first version in which it appeared, but it |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
161 ;; was obsolesced by idle timers in Emacs 19.31. |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
162 (add-hook (if (boundp 'post-command-idle-hook) |
16996
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
163 'post-command-idle-hook |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
164 'post-command-hook) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
165 'eldoc-print-current-symbol-info) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
166 ;; quick and dirty hack for seeing if this is XEmacs |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
167 (and (fboundp 'display-message) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
168 (add-hook 'pre-command-hook |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
169 'eldoc-pre-command-refresh-echo-area)))) |
15671
27e6b6f4f1b6
(eldoc-mode): Toggle eldoc-mode if no prefix given.
Noah Friedman <friedman@splode.com>
parents:
13647
diff
changeset
|
170 (setq eldoc-mode (if prefix |
27e6b6f4f1b6
(eldoc-mode): Toggle eldoc-mode if no prefix given.
Noah Friedman <friedman@splode.com>
parents:
13647
diff
changeset
|
171 (>= (prefix-numeric-value prefix) 0) |
27e6b6f4f1b6
(eldoc-mode): Toggle eldoc-mode if no prefix given.
Noah Friedman <friedman@splode.com>
parents:
13647
diff
changeset
|
172 (not eldoc-mode))) |
13530 | 173 (and (interactive-p) |
174 (if eldoc-mode | |
175 (message "eldoc-mode is enabled") | |
176 (message "eldoc-mode is disabled"))) | |
177 eldoc-mode) | |
178 | |
179 ;;;###autoload | |
180 (defun turn-on-eldoc-mode () | |
181 "Unequivocally turn on eldoc-mode (see variable documentation)." | |
182 (interactive) | |
183 (eldoc-mode 1)) | |
184 | |
16969
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
185 ;; Idle timers are part of Emacs 19.31 and later. |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
186 (defun eldoc-schedule-timer () |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
187 (or (and eldoc-timer |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
188 (memq eldoc-timer timer-idle-list)) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
189 (setq eldoc-timer |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
190 (run-with-idle-timer eldoc-idle-delay t |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
191 'eldoc-print-current-symbol-info))) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
192 |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
193 ;; If user has changed the idle delay, update the timer. |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
194 (cond ((not (= eldoc-idle-delay eldoc-current-idle-delay)) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
195 (setq eldoc-current-idle-delay eldoc-idle-delay) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
196 (timer-set-idle-time eldoc-timer eldoc-idle-delay t)))) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
197 |
16996
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
198 ;; This function goes on pre-command-hook for XEmacs or when using idle |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
199 ;; timers in Emacs. Motion commands clear the echo area for some reason, |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
200 ;; which make eldoc messages flicker or disappear just before motion |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
201 ;; begins. This function reprints the last eldoc message immediately |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
202 ;; before the next command executes, which does away with the flicker. |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
203 ;; This doesn't seem to be required for Emacs 19.28 and earlier. |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
204 (defun eldoc-pre-command-refresh-echo-area () |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
205 (and eldoc-last-message |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
206 (if (eldoc-display-message-no-interference-p) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
207 (eldoc-message eldoc-last-message) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
208 (setq eldoc-last-message nil)))) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
209 |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
210 (defun eldoc-message (&rest args) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
211 (let ((omessage eldoc-last-message)) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
212 (cond ((eq (car args) eldoc-last-message)) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
213 ((or (null args) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
214 (null (car args))) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
215 (setq eldoc-last-message nil)) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
216 (t |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
217 (setq eldoc-last-message (apply 'format args)))) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
218 ;; In emacs 19.29 and later, and XEmacs 19.13 and later, all messages |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
219 ;; are recorded in a log. Do not put eldoc messages in that log since |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
220 ;; they are Legion. |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
221 (if (fboundp 'display-message) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
222 ;; XEmacs 19.13 way of preventing log messages. |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
223 (if eldoc-last-message |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
224 (display-message 'no-log eldoc-last-message) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
225 (and omessage |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
226 (clear-message 'no-log))) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
227 (let ((message-log-max nil)) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
228 (if eldoc-last-message |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
229 (message "%s" eldoc-last-message) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
230 (and omessage |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
231 (message nil)))))) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
232 eldoc-last-message) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
233 |
16969
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
234 |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
235 (defun eldoc-print-current-symbol-info () |
16975
188c4da9bf5d
(eldoc-display-message-p): New function.
Noah Friedman <friedman@splode.com>
parents:
16969
diff
changeset
|
236 (and (eldoc-display-message-p) |
188c4da9bf5d
(eldoc-display-message-p): New function.
Noah Friedman <friedman@splode.com>
parents:
16969
diff
changeset
|
237 (let ((current-symbol (eldoc-current-symbol)) |
188c4da9bf5d
(eldoc-display-message-p): New function.
Noah Friedman <friedman@splode.com>
parents:
16969
diff
changeset
|
238 (current-fnsym (eldoc-fnsym-in-current-sexp))) |
16996
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
239 (or (cond ((eq current-symbol current-fnsym) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
240 (or (eldoc-print-fnsym-args current-fnsym) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
241 (eldoc-print-var-docstring current-symbol))) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
242 (t |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
243 (or (eldoc-print-var-docstring current-symbol) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
244 (eldoc-print-fnsym-args current-fnsym)))) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
245 (eldoc-message nil))))) |
16975
188c4da9bf5d
(eldoc-display-message-p): New function.
Noah Friedman <friedman@splode.com>
parents:
16969
diff
changeset
|
246 |
188c4da9bf5d
(eldoc-display-message-p): New function.
Noah Friedman <friedman@splode.com>
parents:
16969
diff
changeset
|
247 ;; Decide whether now is a good time to display a message. |
188c4da9bf5d
(eldoc-display-message-p): New function.
Noah Friedman <friedman@splode.com>
parents:
16969
diff
changeset
|
248 (defun eldoc-display-message-p () |
16996
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
249 (and (eldoc-display-message-no-interference-p) |
16969
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
250 (cond (eldoc-use-idle-timer-p |
16975
188c4da9bf5d
(eldoc-display-message-p): New function.
Noah Friedman <friedman@splode.com>
parents:
16969
diff
changeset
|
251 ;; If this-command is non-nil while running via an idle |
188c4da9bf5d
(eldoc-display-message-p): New function.
Noah Friedman <friedman@splode.com>
parents:
16969
diff
changeset
|
252 ;; timer, we're still in the middle of executing a command, |
188c4da9bf5d
(eldoc-display-message-p): New function.
Noah Friedman <friedman@splode.com>
parents:
16969
diff
changeset
|
253 ;; e.g. a query-replace where it would be annoying to |
188c4da9bf5d
(eldoc-display-message-p): New function.
Noah Friedman <friedman@splode.com>
parents:
16969
diff
changeset
|
254 ;; overwrite the echo area. |
188c4da9bf5d
(eldoc-display-message-p): New function.
Noah Friedman <friedman@splode.com>
parents:
16969
diff
changeset
|
255 (and (not this-command) |
188c4da9bf5d
(eldoc-display-message-p): New function.
Noah Friedman <friedman@splode.com>
parents:
16969
diff
changeset
|
256 (symbolp last-command) |
16969
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
257 (intern-soft (symbol-name last-command) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
258 eldoc-message-commands))) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
259 (t |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
260 ;; If we don't have idle timers, this function is |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
261 ;; running on post-command-hook directly; that means the |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
262 ;; user's last command is still on `this-command', and we |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
263 ;; must wait briefly for input to see whether to do display. |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
264 (and (symbolp this-command) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
265 (intern-soft (symbol-name this-command) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
266 eldoc-message-commands) |
16975
188c4da9bf5d
(eldoc-display-message-p): New function.
Noah Friedman <friedman@splode.com>
parents:
16969
diff
changeset
|
267 (sit-for eldoc-idle-delay)))))) |
13530 | 268 |
16996
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
269 (defun eldoc-display-message-no-interference-p () |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
270 (and eldoc-mode |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
271 (not executing-kbd-macro) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
272 ;; Having this mode operate in an active minibuffer/echo area causes |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
273 ;; interference with what's going on there. |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
274 (not cursor-in-echo-area) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
275 (not (eq (selected-window) (minibuffer-window))))) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
276 |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
277 (defun eldoc-print-fnsym-args (sym) |
13530 | 278 (interactive) |
16996
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
279 (let ((args nil)) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
280 (cond ((not (and sym |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
281 (symbolp sym) |
13530 | 282 (fboundp sym)))) |
283 ((eq sym (car eldoc-last-data)) | |
284 (setq args (cdr eldoc-last-data))) | |
285 ((subrp (eldoc-symbol-function sym)) | |
16969
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
286 (setq args (or (eldoc-function-argstring-from-docstring sym) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
287 (eldoc-docstring-first-line (documentation sym t)))) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
288 (setcar eldoc-last-data sym) |
13530 | 289 (setcdr eldoc-last-data args)) |
290 (t | |
291 (setq args (eldoc-function-argstring sym)) | |
16969
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
292 (setcar eldoc-last-data sym) |
13530 | 293 (setcdr eldoc-last-data args))) |
294 (and args | |
13647
40e469e13255
(eldoc-message): New macro.
Noah Friedman <friedman@splode.com>
parents:
13614
diff
changeset
|
295 (eldoc-message "%s: %s" sym args)))) |
13530 | 296 |
297 (defun eldoc-fnsym-in-current-sexp () | |
16996
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
298 (let ((p (point))) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
299 (eldoc-beginning-of-sexp) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
300 (prog1 |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
301 ;; Don't do anything if current word is inside a string. |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
302 (if (= (or (char-after (1- (point))) 0) ?\") |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
303 nil |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
304 (eldoc-current-symbol)) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
305 (goto-char p)))) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
306 |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
307 (defun eldoc-beginning-of-sexp () |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
308 (let ((parse-sexp-ignore-comments t)) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
309 (condition-case err |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
310 (while (progn |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
311 (forward-sexp -1) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
312 (or (= (or (char-after (1- (point)))) ?\") |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
313 (> (point) (point-min))))) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
314 (error nil)))) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
315 |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
316 ;; returns nil unless current word is an interned symbol. |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
317 (defun eldoc-current-symbol () |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
318 (let ((c (char-after (point)))) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
319 (and c |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
320 (memq (char-syntax c) '(?w ?_)) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
321 (intern-soft (current-word))))) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
322 |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
323 ;; Do indirect function resolution if possible. |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
324 (defun eldoc-symbol-function (fsym) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
325 (let ((defn (and (fboundp fsym) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
326 (symbol-function fsym)))) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
327 (and (symbolp defn) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
328 (condition-case err |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
329 (setq defn (indirect-function fsym)) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
330 (error (setq defn nil)))) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
331 defn)) |
13530 | 332 |
333 (defun eldoc-function-argstring (fn) | |
13532
37fdd3664658
(top level): Make sure to set global minor-mode-alist, not local one.
Noah Friedman <friedman@splode.com>
parents:
13530
diff
changeset
|
334 (let* ((prelim-def (eldoc-symbol-function fn)) |
37fdd3664658
(top level): Make sure to set global minor-mode-alist, not local one.
Noah Friedman <friedman@splode.com>
parents:
13530
diff
changeset
|
335 (def (if (eq (car-safe prelim-def) 'macro) |
37fdd3664658
(top level): Make sure to set global minor-mode-alist, not local one.
Noah Friedman <friedman@splode.com>
parents:
13530
diff
changeset
|
336 (cdr prelim-def) |
37fdd3664658
(top level): Make sure to set global minor-mode-alist, not local one.
Noah Friedman <friedman@splode.com>
parents:
13530
diff
changeset
|
337 prelim-def)) |
13530 | 338 (arglist (cond ((null def) nil) |
13532
37fdd3664658
(top level): Make sure to set global minor-mode-alist, not local one.
Noah Friedman <friedman@splode.com>
parents:
13530
diff
changeset
|
339 ((byte-code-function-p def) |
13530 | 340 (if (fboundp 'compiled-function-arglist) |
341 (funcall 'compiled-function-arglist def) | |
13532
37fdd3664658
(top level): Make sure to set global minor-mode-alist, not local one.
Noah Friedman <friedman@splode.com>
parents:
13530
diff
changeset
|
342 (aref def 0))) |
13530 | 343 ((eq (car-safe def) 'lambda) |
344 (nth 1 def)) | |
345 (t t)))) | |
346 (eldoc-function-argstring-format arglist))) | |
347 | |
348 (defun eldoc-function-argstring-format (arglist) | |
349 (cond ((not (listp arglist)) | |
350 (setq arglist nil)) | |
351 ((symbolp (car arglist)) | |
352 (setq arglist | |
353 (mapcar (function (lambda (s) | |
354 (if (memq s '(&optional &rest)) | |
355 (symbol-name s) | |
356 (funcall eldoc-argument-case | |
357 (symbol-name s))))) | |
358 arglist))) | |
359 ((stringp (car arglist)) | |
360 (setq arglist | |
361 (mapcar (function (lambda (s) | |
362 (if (member s '("&optional" "&rest")) | |
363 s | |
364 (funcall eldoc-argument-case s)))) | |
365 arglist)))) | |
366 (concat "(" (mapconcat 'identity arglist " ") ")")) | |
367 | |
368 | |
16996
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
369 (defun eldoc-print-var-docstring (sym) |
16969
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
370 (eldoc-print-docstring sym (documentation-property |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
371 sym 'variable-documentation t))) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
372 |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
373 ;; Print the brief (one-line) documentation string for the symbol. |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
374 (defun eldoc-print-docstring (symbol doc) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
375 (and doc |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
376 (eldoc-message "%s" (eldoc-docstring-message symbol doc)))) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
377 |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
378 ;; If the entire line cannot fit in the echo area, the variable name may be |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
379 ;; truncated or eliminated entirely from the output to make room. |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
380 ;; Any leading `*' in the docstring (which indicates the variable is a user |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
381 ;; option) is not printed." |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
382 (defun eldoc-docstring-message (symbol doc) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
383 (and doc |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
384 (let ((name (symbol-name symbol))) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
385 (setq doc (eldoc-docstring-first-line doc)) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
386 (save-match-data |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
387 (let* ((doclen (+ (length name) (length ": ") (length doc))) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
388 ;; Subtract 1 from window width since emacs seems not to |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
389 ;; write any chars to the last column, at least for some |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
390 ;; terminal types. |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
391 (strip (- doclen (1- (window-width (minibuffer-window)))))) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
392 (cond ((> strip 0) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
393 (let* ((len (length name))) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
394 (cond ((>= strip len) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
395 (format "%s" doc)) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
396 (t |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
397 (setq name (substring name 0 (- len strip))) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
398 (format "%s: %s" name doc))))) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
399 (t |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
400 (format "%s: %s" symbol doc)))))))) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
401 |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
402 (defun eldoc-docstring-first-line (doc) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
403 (save-match-data |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
404 (and (string-match "\n" doc) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
405 (setq doc (substring doc 0 (match-beginning 0)))) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
406 (and (string-match "^\\*" doc) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
407 (setq doc (substring doc 1)))) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
408 doc) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
409 |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
410 |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
411 ;; Alist of predicate/action pairs. |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
412 ;; Each member of the list is a sublist consisting of a predicate function |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
413 ;; used to determine if the arglist for a function can be found using a |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
414 ;; certain pattern, and a function which returns the actual arglist from |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
415 ;; that docstring. |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
416 ;; |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
417 ;; The order in this table is significant, since later predicates may be |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
418 ;; more general than earlier ones. |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
419 ;; |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
420 ;; Compiler note for Emacs 19.29 and later: these functions will be |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
421 ;; compiled to bytecode, but can't be lazy-loaded even if you set |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
422 ;; byte-compile-dynamic; to do that would require making them named |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
423 ;; top-level defuns, and that's not particularly desirable either. |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
424 (defconst eldoc-function-argstring-from-docstring-method-table |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
425 (list |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
426 ;; Try first searching for args starting with symbol name. |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
427 ;; This is to avoid matching parenthetical remarks in e.g. sit-for. |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
428 (list (function (lambda (doc fn) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
429 (string-match (format "^(%s[^\n)]*)$" fn) doc))) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
430 (function (lambda (doc) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
431 ;; end does not include trailing ")" sequence. |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
432 (let ((end (- (match-end 0) 1))) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
433 (if (string-match " +" doc (match-beginning 0)) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
434 (substring doc (match-end 0) end) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
435 ""))))) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
436 |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
437 ;; Try again not requiring this symbol name in the docstring. |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
438 ;; This will be the case when looking up aliases. |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
439 (list (function (lambda (doc fn) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
440 (string-match "^([^\n)]+)$" doc))) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
441 (function (lambda (doc) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
442 ;; end does not include trailing ")" sequence. |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
443 (let ((end (- (match-end 0) 1))) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
444 (and (string-match " +" doc (match-beginning 0)) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
445 (substring doc (match-end 0) end)))))) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
446 |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
447 ;; Emacs subr docstring style: |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
448 ;; (fn arg1 arg2 ...): description... |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
449 (list (function (lambda (doc fn) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
450 (string-match "^([^\n)]+):" doc))) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
451 (function (lambda (doc) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
452 ;; end does not include trailing "):" sequence. |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
453 (let ((end (- (match-end 0) 2))) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
454 (and (string-match " +" doc (match-beginning 0)) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
455 (substring doc (match-end 0) end)))))) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
456 |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
457 ;; XEmacs subr docstring style: |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
458 ;; "arguments: (arg1 arg2 ...) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
459 (list (function (lambda (doc fn) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
460 (string-match "^arguments: (\\([^\n)]+\\))" doc))) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
461 (function (lambda (doc) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
462 ;; also skip leading paren, but the first word is |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
463 ;; actually an argument, not the function name. |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
464 (substring doc (match-beginning 1) (match-end 1))))) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
465 |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
466 ;; This finds the argstring for `condition-case'. Any others? |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
467 (list (function (lambda (doc fn) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
468 (string-match |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
469 (format "^Usage looks like \\((%s[^\n)]*)\\)\\.$" fn) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
470 doc))) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
471 (function (lambda (doc) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
472 ;; end does not include trailing ")" sequence. |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
473 (let ((end (- (match-end 1) 1))) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
474 (and (string-match " +" doc (match-beginning 1)) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
475 (substring doc (match-end 0) end)))))) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
476 |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
477 ;; This finds the argstring for `setq-default'. Any others? |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
478 (list (function (lambda (doc fn) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
479 (string-match (format "^[ \t]+\\((%s[^\n)]*)\\)$" fn) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
480 doc))) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
481 (function (lambda (doc) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
482 ;; end does not include trailing ")" sequence. |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
483 (let ((end (- (match-end 1) 1))) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
484 (and (string-match " +" doc (match-beginning 1)) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
485 (substring doc (match-end 0) end)))))) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
486 |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
487 ;; This finds the argstring for `start-process'. Any others? |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
488 (list (function (lambda (doc fn) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
489 (string-match "^Args are +\\([^\n]+\\)$" doc))) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
490 (function (lambda (doc) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
491 (substring doc (match-beginning 1) (match-end 1))))) |
16996
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
492 |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
493 ;; These subrs don't have arglists in their docstrings. |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
494 ;; This is cheating. |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
495 (list (function (lambda (doc fn) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
496 (memq fn '(and or list + -)))) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
497 (function (lambda (doc) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
498 ;; The value nil is a placeholder; otherwise, the |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
499 ;; following string may be compiled as a docstring, |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
500 ;; and not a return value for the function. |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
501 ;; In interpreted lisp form they are |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
502 ;; indistinguishable; it only matters for compiled |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
503 ;; forms. |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
504 nil |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
505 "&rest args"))) |
16969
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
506 )) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
507 |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
508 (defun eldoc-function-argstring-from-docstring (fn) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
509 (let ((docstring (documentation fn 'raw)) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
510 (table eldoc-function-argstring-from-docstring-method-table) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
511 (doc nil) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
512 (doclist nil)) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
513 (save-match-data |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
514 (while table |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
515 (cond ((funcall (car (car table)) docstring fn) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
516 (setq doc (funcall (car (cdr (car table))) docstring)) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
517 (setq table nil)) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
518 (t |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
519 (setq table (cdr table))))) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
520 |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
521 (cond ((not (stringp doc)) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
522 nil) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
523 ((string-match "&" doc) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
524 (let ((p 0) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
525 (l (length doc))) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
526 (while (< p l) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
527 (cond ((string-match "[ \t\n]+" doc p) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
528 (setq doclist |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
529 (cons (substring doc p (match-beginning 0)) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
530 doclist)) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
531 (setq p (match-end 0))) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
532 (t |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
533 (setq doclist (cons (substring doc p) doclist)) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
534 (setq p l)))) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
535 (eldoc-function-argstring-format (nreverse doclist)))) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
536 (t |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
537 (concat "(" (funcall eldoc-argument-case doc) ")")))))) |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
538 |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
539 |
16996
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
540 ;; When point is in a sexp, the function args are not reprinted in the echo |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
541 ;; area after every possible interactive command because some of them print |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
542 ;; their own messages in the echo area; the eldoc functions would instantly |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
543 ;; overwrite them unless it is more restrained. |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
544 ;; These functions do display-command table management. |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
545 |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
546 (defun eldoc-add-command (&rest cmds) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
547 (or eldoc-message-commands |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
548 (setq eldoc-message-commands |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
549 (make-vector eldoc-message-commands-table-size 0))) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
550 |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
551 (let (name sym) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
552 (while cmds |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
553 (setq name (car cmds)) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
554 (setq cmds (cdr cmds)) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
555 |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
556 (cond ((symbolp name) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
557 (setq sym name) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
558 (setq name (symbol-name sym))) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
559 ((stringp name) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
560 (setq sym (intern-soft name)))) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
561 |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
562 (and (symbolp sym) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
563 (fboundp sym) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
564 (set (intern name eldoc-message-commands) t))))) |
13530 | 565 |
16996
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
566 (defun eldoc-add-command-completions (&rest names) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
567 (while names |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
568 (apply 'eldoc-add-command |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
569 (all-completions (car names) obarray 'fboundp)) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
570 (setq names (cdr names)))) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
571 |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
572 (defun eldoc-remove-command (&rest cmds) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
573 (let (name) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
574 (while cmds |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
575 (setq name (car cmds)) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
576 (setq cmds (cdr cmds)) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
577 |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
578 (and (symbolp name) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
579 (setq name (symbol-name name))) |
13530 | 580 |
16996
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
581 (if (fboundp 'unintern) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
582 (unintern name eldoc-message-commands) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
583 (let ((s (intern-soft name eldoc-message-commands))) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
584 (and s |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
585 (makunbound s))))))) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
586 |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
587 (defun eldoc-remove-command-completions (&rest names) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
588 (while names |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
589 (apply 'eldoc-remove-command |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
590 (all-completions (car names) eldoc-message-commands)) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
591 (setq names (cdr names)))) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
592 |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
593 ;; Prime the command list. |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
594 (eldoc-add-command-completions |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
595 "backward-" "beginning-of-" "delete-other-windows" "delete-window" |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
596 "end-of-" "forward-" "goto-" "mouse-set-point" "next-" "other-window" |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
597 "previous-" "recenter" "scroll-" "self-insert-command" "split-window-") |
13530 | 598 |
599 (provide 'eldoc) | |
600 | |
601 ;;; eldoc.el ends here |