Mercurial > emacs
annotate lisp/emacs-lisp/eldoc.el @ 104522:2a2b8ae24b17
* cedet/semantic/symref/list.el: Require semantic/complete.
(semantic-symref-symbol): Use
semantic-complete-read-tag-buffer-deep.
* cedet/semantic/ia.el (semantic-ia-complete-symbol-menu): Remove.
(semantic-ia-complete-symbol): Use semantic-complete-symbol.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Sun, 27 Sep 2009 03:59:51 +0000 |
parents | 57e8989174eb |
children | f004275b4271 |
rev | line source |
---|---|
13530 | 1 ;;; eldoc.el --- show function arglist or variable docstring in echo area |
2 | |
74466 | 3 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, |
100908 | 4 ;; 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. |
13530 | 5 |
23283
2442a5dce1a8
(eldoc-message): Check for 1-arg case, and store string in
Noah Friedman <friedman@splode.com>
parents:
18699
diff
changeset
|
6 ;; Author: Noah Friedman <friedman@splode.com> |
2442a5dce1a8
(eldoc-message): Check for 1-arg case, and store string in
Noah Friedman <friedman@splode.com>
parents:
18699
diff
changeset
|
7 ;; Maintainer: friedman@splode.com |
13530 | 8 ;; Keywords: extensions |
9 ;; Created: 1995-10-06 | |
10 | |
16969
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
11 ;; This file is part of GNU Emacs. |
13530 | 12 |
94655
90a2847062be
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
13 ;; GNU Emacs is free software: you can redistribute it and/or modify |
13530 | 14 ;; it under the terms of the GNU General Public License as published by |
94655
90a2847062be
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
15 ;; the Free Software Foundation, either version 3 of the License, or |
90a2847062be
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
16 ;; (at your option) any later version. |
16969
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
17 |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
18 ;; GNU Emacs is distributed in the hope that it will be useful, |
13530 | 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. | |
16969
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
22 |
13530 | 23 ;; You should have received a copy of the GNU General Public License |
94655
90a2847062be
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
24 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
13530 | 25 |
26 ;;; Commentary: | |
27 | |
16969
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
28 ;; 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
|
29 ;; 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
|
30 ;; 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
|
31 ;; 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
|
32 ;; 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
|
33 ;; 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
|
34 ;; 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
|
35 ;; that variable's meaning. |
13530 | 36 |
37 ;; One useful way to enable this minor mode is to put the following in your | |
38 ;; .emacs: | |
39 ;; | |
40 ;; (add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode) | |
41 ;; (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
|
42 ;; (add-hook 'ielm-mode-hook 'turn-on-eldoc-mode) |
13530 | 43 |
101270
652c25392003
(eldoc-minor-mode-string, eldoc-message-commands)
Glenn Morris <rgm@gnu.org>
parents:
101225
diff
changeset
|
44 ;; Major modes for other languages may use ElDoc by defining an |
52445
d776a9884cef
(eldoc-print-current-symbol-info-function):
Dave Love <fx@gnu.org>
parents:
52401
diff
changeset
|
45 ;; appropriate function as the buffer-local value of |
61856 | 46 ;; `eldoc-documentation-function'. |
52445
d776a9884cef
(eldoc-print-current-symbol-info-function):
Dave Love <fx@gnu.org>
parents:
52401
diff
changeset
|
47 |
13530 | 48 ;;; Code: |
49 | |
48470
5a25c61f2c8b
(eldoc-print-current-symbol-info):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42623
diff
changeset
|
50 (require 'help-fns) ;For fundoc-usage handling functions. |
5a25c61f2c8b
(eldoc-print-current-symbol-info):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42623
diff
changeset
|
51 |
17445
f2db4e8bb6ed
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17253
diff
changeset
|
52 (defgroup eldoc nil |
f2db4e8bb6ed
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17253
diff
changeset
|
53 "Show function arglist or variable docstring in echo area." |
30389
38f19553e93d
(eldoc-minor-mode-string): Add autoload cookie; otherwise autoloaded
Noah Friedman <friedman@splode.com>
parents:
23586
diff
changeset
|
54 :group 'lisp |
17445
f2db4e8bb6ed
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17253
diff
changeset
|
55 :group 'extensions) |
f2db4e8bb6ed
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17253
diff
changeset
|
56 |
f2db4e8bb6ed
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17253
diff
changeset
|
57 (defcustom eldoc-idle-delay 0.50 |
101225
84ba7288e2c7
Remove leading `*' from defcustoms.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
58 "Number of seconds of idle time to wait before printing. |
13530 | 59 If user input arrives before this interval of time has elapsed after the |
60 last input, no documentation will be printed. | |
61 | |
17445
f2db4e8bb6ed
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17253
diff
changeset
|
62 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
|
63 :type 'number |
f2db4e8bb6ed
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17253
diff
changeset
|
64 :group 'eldoc) |
13530 | 65 |
30389
38f19553e93d
(eldoc-minor-mode-string): Add autoload cookie; otherwise autoloaded
Noah Friedman <friedman@splode.com>
parents:
23586
diff
changeset
|
66 ;;;###autoload |
17445
f2db4e8bb6ed
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17253
diff
changeset
|
67 (defcustom eldoc-minor-mode-string " ElDoc" |
101270
652c25392003
(eldoc-minor-mode-string, eldoc-message-commands)
Glenn Morris <rgm@gnu.org>
parents:
101225
diff
changeset
|
68 "String to display in mode line when ElDoc Mode is enabled; nil for none." |
42623
365f0cb0170e
(eldoc-minor-mode-string): Fix custom type.
Richard M. Stallman <rms@gnu.org>
parents:
41167
diff
changeset
|
69 :type '(choice string (const :tag "None" nil)) |
17445
f2db4e8bb6ed
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17253
diff
changeset
|
70 :group 'eldoc) |
16969
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
71 |
17445
f2db4e8bb6ed
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17253
diff
changeset
|
72 (defcustom eldoc-argument-case 'upcase |
13530 | 73 "Case to display argument names of functions, as a symbol. |
74 This has two preferred values: `upcase' or `downcase'. | |
75 Actually, any name of a function which takes a string as an argument and | |
101225
84ba7288e2c7
Remove leading `*' from defcustoms.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
76 returns another string is acceptable. |
84ba7288e2c7
Remove leading `*' from defcustoms.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
77 |
84ba7288e2c7
Remove leading `*' from defcustoms.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
78 Note that if `eldoc-documentation-function' is non-nil, this variable |
84ba7288e2c7
Remove leading `*' from defcustoms.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
79 has no effect, unless the function handles it explicitly." |
30389
38f19553e93d
(eldoc-minor-mode-string): Add autoload cookie; otherwise autoloaded
Noah Friedman <friedman@splode.com>
parents:
23586
diff
changeset
|
80 :type '(radio (function-item upcase) |
38f19553e93d
(eldoc-minor-mode-string): Add autoload cookie; otherwise autoloaded
Noah Friedman <friedman@splode.com>
parents:
23586
diff
changeset
|
81 (function-item downcase) |
38f19553e93d
(eldoc-minor-mode-string): Add autoload cookie; otherwise autoloaded
Noah Friedman <friedman@splode.com>
parents:
23586
diff
changeset
|
82 function) |
17445
f2db4e8bb6ed
Add defgroup; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17253
diff
changeset
|
83 :group 'eldoc) |
13530 | 84 |
30389
38f19553e93d
(eldoc-minor-mode-string): Add autoload cookie; otherwise autoloaded
Noah Friedman <friedman@splode.com>
parents:
23586
diff
changeset
|
85 (defcustom eldoc-echo-area-use-multiline-p 'truncate-sym-name-if-fit |
101225
84ba7288e2c7
Remove leading `*' from defcustoms.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
86 "Allow long ElDoc messages to resize echo area display. |
50853
3a65ede5c70c
(eldoc-echo-area-use-multiline-p): Don't quote nil and t in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
49697
diff
changeset
|
87 If value is t, never attempt to truncate messages; complete symbol name |
30389
38f19553e93d
(eldoc-minor-mode-string): Add autoload cookie; otherwise autoloaded
Noah Friedman <friedman@splode.com>
parents:
23586
diff
changeset
|
88 and function arglist or 1-line variable documentation will be displayed |
38f19553e93d
(eldoc-minor-mode-string): Add autoload cookie; otherwise autoloaded
Noah Friedman <friedman@splode.com>
parents:
23586
diff
changeset
|
89 even if echo area must be resized to fit. |
38f19553e93d
(eldoc-minor-mode-string): Add autoload cookie; otherwise autoloaded
Noah Friedman <friedman@splode.com>
parents:
23586
diff
changeset
|
90 |
50853
3a65ede5c70c
(eldoc-echo-area-use-multiline-p): Don't quote nil and t in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
49697
diff
changeset
|
91 If value is any non-nil value other than t, symbol name may be truncated |
30389
38f19553e93d
(eldoc-minor-mode-string): Add autoload cookie; otherwise autoloaded
Noah Friedman <friedman@splode.com>
parents:
23586
diff
changeset
|
92 if it will enable the function arglist or documentation string to fit on a |
38f19553e93d
(eldoc-minor-mode-string): Add autoload cookie; otherwise autoloaded
Noah Friedman <friedman@splode.com>
parents:
23586
diff
changeset
|
93 single line without resizing window. Otherwise, behavior is just like |
38f19553e93d
(eldoc-minor-mode-string): Add autoload cookie; otherwise autoloaded
Noah Friedman <friedman@splode.com>
parents:
23586
diff
changeset
|
94 former case. |
38f19553e93d
(eldoc-minor-mode-string): Add autoload cookie; otherwise autoloaded
Noah Friedman <friedman@splode.com>
parents:
23586
diff
changeset
|
95 |
38f19553e93d
(eldoc-minor-mode-string): Add autoload cookie; otherwise autoloaded
Noah Friedman <friedman@splode.com>
parents:
23586
diff
changeset
|
96 If value is nil, messages are always truncated to fit in a single line of |
38f19553e93d
(eldoc-minor-mode-string): Add autoload cookie; otherwise autoloaded
Noah Friedman <friedman@splode.com>
parents:
23586
diff
changeset
|
97 display in the echo area. Function or variable symbol name may be |
101225
84ba7288e2c7
Remove leading `*' from defcustoms.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
98 truncated to make more of the arglist or documentation string visible. |
84ba7288e2c7
Remove leading `*' from defcustoms.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
99 |
84ba7288e2c7
Remove leading `*' from defcustoms.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
100 Note that if `eldoc-documentation-function' is non-nil, this variable |
84ba7288e2c7
Remove leading `*' from defcustoms.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
101 has no effect, unless the function handles it explicitly." |
30389
38f19553e93d
(eldoc-minor-mode-string): Add autoload cookie; otherwise autoloaded
Noah Friedman <friedman@splode.com>
parents:
23586
diff
changeset
|
102 :type '(radio (const :tag "Always" t) |
38f19553e93d
(eldoc-minor-mode-string): Add autoload cookie; otherwise autoloaded
Noah Friedman <friedman@splode.com>
parents:
23586
diff
changeset
|
103 (const :tag "Never" nil) |
38f19553e93d
(eldoc-minor-mode-string): Add autoload cookie; otherwise autoloaded
Noah Friedman <friedman@splode.com>
parents:
23586
diff
changeset
|
104 (const :tag "Yes, but truncate symbol names if it will\ |
38f19553e93d
(eldoc-minor-mode-string): Add autoload cookie; otherwise autoloaded
Noah Friedman <friedman@splode.com>
parents:
23586
diff
changeset
|
105 enable argument list to fit on one line" truncate-sym-name-if-fit)) |
38f19553e93d
(eldoc-minor-mode-string): Add autoload cookie; otherwise autoloaded
Noah Friedman <friedman@splode.com>
parents:
23586
diff
changeset
|
106 :group 'eldoc) |
38f19553e93d
(eldoc-minor-mode-string): Add autoload cookie; otherwise autoloaded
Noah Friedman <friedman@splode.com>
parents:
23586
diff
changeset
|
107 |
82797
46c1137c9130
Nikolaj Schumacher <n_schumacher at web.de> (tiny change)
Glenn Morris <rgm@gnu.org>
parents:
82465
diff
changeset
|
108 (defface eldoc-highlight-function-argument |
46c1137c9130
Nikolaj Schumacher <n_schumacher at web.de> (tiny change)
Glenn Morris <rgm@gnu.org>
parents:
82465
diff
changeset
|
109 '((t (:inherit bold))) |
101225
84ba7288e2c7
Remove leading `*' from defcustoms.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
110 "Face used for the argument at point in a function's argument list. |
84ba7288e2c7
Remove leading `*' from defcustoms.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
111 Note that if `eldoc-documentation-function' is non-nil, this face |
84ba7288e2c7
Remove leading `*' from defcustoms.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
112 has no effect, unless the function handles it explicitly." |
82797
46c1137c9130
Nikolaj Schumacher <n_schumacher at web.de> (tiny change)
Glenn Morris <rgm@gnu.org>
parents:
82465
diff
changeset
|
113 :group 'eldoc) |
46c1137c9130
Nikolaj Schumacher <n_schumacher at web.de> (tiny change)
Glenn Morris <rgm@gnu.org>
parents:
82465
diff
changeset
|
114 |
30389
38f19553e93d
(eldoc-minor-mode-string): Add autoload cookie; otherwise autoloaded
Noah Friedman <friedman@splode.com>
parents:
23586
diff
changeset
|
115 ;;; No user options below here. |
38f19553e93d
(eldoc-minor-mode-string): Add autoload cookie; otherwise autoloaded
Noah Friedman <friedman@splode.com>
parents:
23586
diff
changeset
|
116 |
65843
e28dd6224eb2
Move comments into docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64933
diff
changeset
|
117 (defvar eldoc-message-commands-table-size 31 |
101225
84ba7288e2c7
Remove leading `*' from defcustoms.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
118 "Used by `eldoc-add-command' to initialize `eldoc-message-commands' obarray. |
65843
e28dd6224eb2
Move comments into docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64933
diff
changeset
|
119 It should probably never be necessary to do so, but if you |
e28dd6224eb2
Move comments into docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64933
diff
changeset
|
120 choose to increase the number of buckets, you must do so before loading |
e28dd6224eb2
Move comments into docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64933
diff
changeset
|
121 this file since the obarray is initialized at load time. |
e28dd6224eb2
Move comments into docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64933
diff
changeset
|
122 Remember to keep it a prime number to improve hash performance.") |
13530 | 123 |
65843
e28dd6224eb2
Move comments into docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64933
diff
changeset
|
124 (defconst eldoc-message-commands |
e28dd6224eb2
Move comments into docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64933
diff
changeset
|
125 (make-vector eldoc-message-commands-table-size 0) |
e28dd6224eb2
Move comments into docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64933
diff
changeset
|
126 "Commands after which it is appropriate to print in the echo area. |
101270
652c25392003
(eldoc-minor-mode-string, eldoc-message-commands)
Glenn Morris <rgm@gnu.org>
parents:
101225
diff
changeset
|
127 ElDoc does not try to print function arglists, etc., after just any command, |
65843
e28dd6224eb2
Move comments into docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64933
diff
changeset
|
128 because some commands print their own messages in the echo area and these |
78898
150f6e38877a
(eldoc-message-commands-table-size, eldoc-message-commands,
Juanma Barranquero <lekktu@gmail.com>
parents:
78217
diff
changeset
|
129 functions would instantly overwrite them. But `self-insert-command' as well |
65843
e28dd6224eb2
Move comments into docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64933
diff
changeset
|
130 as most motion commands are good candidates. |
e28dd6224eb2
Move comments into docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64933
diff
changeset
|
131 This variable contains an obarray of symbols; do not manipulate it |
e28dd6224eb2
Move comments into docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64933
diff
changeset
|
132 directly. Instead, use `eldoc-add-command' and `eldoc-remove-command'.") |
13530 | 133 |
101270
652c25392003
(eldoc-minor-mode-string, eldoc-message-commands)
Glenn Morris <rgm@gnu.org>
parents:
101225
diff
changeset
|
134 ;; Not a constant. |
65843
e28dd6224eb2
Move comments into docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64933
diff
changeset
|
135 (defconst eldoc-last-data (make-vector 3 nil) |
e28dd6224eb2
Move comments into docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64933
diff
changeset
|
136 "Bookkeeping; elements are as follows: |
e28dd6224eb2
Move comments into docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64933
diff
changeset
|
137 0 - contains the last symbol read from the buffer. |
81819
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
138 1 - contains the string last displayed in the echo area for variables, |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
139 or argument string for functions. |
65843
e28dd6224eb2
Move comments into docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64933
diff
changeset
|
140 2 - 'function if function args, 'variable if variable documentation.") |
101270
652c25392003
(eldoc-minor-mode-string, eldoc-message-commands)
Glenn Morris <rgm@gnu.org>
parents:
101225
diff
changeset
|
141 |
16996
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
142 (defvar eldoc-last-message nil) |
13530 | 143 |
101225
84ba7288e2c7
Remove leading `*' from defcustoms.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
144 (defvar eldoc-timer nil "ElDoc's timer object.") |
16969
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
145 |
65843
e28dd6224eb2
Move comments into docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64933
diff
changeset
|
146 (defvar eldoc-current-idle-delay eldoc-idle-delay |
78898
150f6e38877a
(eldoc-message-commands-table-size, eldoc-message-commands,
Juanma Barranquero <lekktu@gmail.com>
parents:
78217
diff
changeset
|
147 "Idle time delay currently in use by timer. |
65843
e28dd6224eb2
Move comments into docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64933
diff
changeset
|
148 This is used to determine if `eldoc-idle-delay' is changed by the user.") |
13530 | 149 |
150 | |
151 ;;;###autoload | |
41167
ae8862effdf5
(eldoc-mode): Use define-minor-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34127
diff
changeset
|
152 (define-minor-mode eldoc-mode |
ae8862effdf5
(eldoc-mode): Use define-minor-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34127
diff
changeset
|
153 "Toggle ElDoc mode on or off. |
61855 | 154 In ElDoc mode, the echo area displays information about a |
155 function or variable in the text where point is. If point is | |
62486
8c229cb5f3ef
(eldoc-mode): Doc fix.
Luc Teirlinck <teirllm@auburn.edu>
parents:
62313
diff
changeset
|
156 on a documented variable, it displays the first line of that |
8c229cb5f3ef
(eldoc-mode): Doc fix.
Luc Teirlinck <teirllm@auburn.edu>
parents:
62313
diff
changeset
|
157 variable's doc string. Otherwise it displays the argument list |
8c229cb5f3ef
(eldoc-mode): Doc fix.
Luc Teirlinck <teirllm@auburn.edu>
parents:
62313
diff
changeset
|
158 of the function called in the expression point is on. |
41167
ae8862effdf5
(eldoc-mode): Use define-minor-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34127
diff
changeset
|
159 |
ae8862effdf5
(eldoc-mode): Use define-minor-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
34127
diff
changeset
|
160 With prefix ARG, turn ElDoc mode on if and only if ARG is positive." |
61278
83d73d728418
(eldoc-mode): Specify :group.
Lute Kamstra <lute@gnu.org>
parents:
54770
diff
changeset
|
161 :group 'eldoc :lighter eldoc-minor-mode-string |
16996
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
162 (setq eldoc-last-message nil) |
49697
eb34aebd1084
(eldoc-echo-area-multiline-supported-p, eldoc-use-idle-timer-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49018
diff
changeset
|
163 (if eldoc-mode |
eb34aebd1084
(eldoc-echo-area-multiline-supported-p, eldoc-use-idle-timer-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49018
diff
changeset
|
164 (progn |
eb34aebd1084
(eldoc-echo-area-multiline-supported-p, eldoc-use-idle-timer-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49018
diff
changeset
|
165 (add-hook 'post-command-hook 'eldoc-schedule-timer nil t) |
eb34aebd1084
(eldoc-echo-area-multiline-supported-p, eldoc-use-idle-timer-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49018
diff
changeset
|
166 (add-hook 'pre-command-hook 'eldoc-pre-command-refresh-echo-area t)) |
eb34aebd1084
(eldoc-echo-area-multiline-supported-p, eldoc-use-idle-timer-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49018
diff
changeset
|
167 (remove-hook 'post-command-hook 'eldoc-schedule-timer) |
eb34aebd1084
(eldoc-echo-area-multiline-supported-p, eldoc-use-idle-timer-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49018
diff
changeset
|
168 (remove-hook 'pre-command-hook 'eldoc-pre-command-refresh-echo-area))) |
13530 | 169 |
170 ;;;###autoload | |
171 (defun turn-on-eldoc-mode () | |
77657
6215cae6109e
(turn-on-eldoc-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
75346
diff
changeset
|
172 "Unequivocally turn on ElDoc mode (see command `eldoc-mode')." |
13530 | 173 (interactive) |
174 (eldoc-mode 1)) | |
175 | |
23283
2442a5dce1a8
(eldoc-message): Check for 1-arg case, and store string in
Noah Friedman <friedman@splode.com>
parents:
18699
diff
changeset
|
176 |
16969
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
177 (defun eldoc-schedule-timer () |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
178 (or (and eldoc-timer |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
179 (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
|
180 (setq eldoc-timer |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
181 (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
|
182 '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
|
183 |
436fd36233d1
Update copyright notice to reflect assignment to FSF and incorporation
Noah Friedman <friedman@splode.com>
parents:
16385
diff
changeset
|
184 ;; 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
|
185 (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
|
186 (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
|
187 (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
|
188 |
23283
2442a5dce1a8
(eldoc-message): Check for 1-arg case, and store string in
Noah Friedman <friedman@splode.com>
parents:
18699
diff
changeset
|
189 (defun eldoc-message (&rest args) |
2442a5dce1a8
(eldoc-message): Check for 1-arg case, and store string in
Noah Friedman <friedman@splode.com>
parents:
18699
diff
changeset
|
190 (let ((omessage eldoc-last-message)) |
50853
3a65ede5c70c
(eldoc-echo-area-use-multiline-p): Don't quote nil and t in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
49697
diff
changeset
|
191 (setq eldoc-last-message |
49697
eb34aebd1084
(eldoc-echo-area-multiline-supported-p, eldoc-use-idle-timer-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49018
diff
changeset
|
192 (cond ((eq (car args) eldoc-last-message) eldoc-last-message) |
eb34aebd1084
(eldoc-echo-area-multiline-supported-p, eldoc-use-idle-timer-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49018
diff
changeset
|
193 ((null (car args)) nil) |
eb34aebd1084
(eldoc-echo-area-multiline-supported-p, eldoc-use-idle-timer-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49018
diff
changeset
|
194 ;; If only one arg, no formatting to do, so put it in |
eb34aebd1084
(eldoc-echo-area-multiline-supported-p, eldoc-use-idle-timer-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49018
diff
changeset
|
195 ;; eldoc-last-message so eq test above might succeed on |
eb34aebd1084
(eldoc-echo-area-multiline-supported-p, eldoc-use-idle-timer-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49018
diff
changeset
|
196 ;; subsequent calls. |
eb34aebd1084
(eldoc-echo-area-multiline-supported-p, eldoc-use-idle-timer-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49018
diff
changeset
|
197 ((null (cdr args)) (car args)) |
eb34aebd1084
(eldoc-echo-area-multiline-supported-p, eldoc-use-idle-timer-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49018
diff
changeset
|
198 (t (apply 'format args)))) |
23283
2442a5dce1a8
(eldoc-message): Check for 1-arg case, and store string in
Noah Friedman <friedman@splode.com>
parents:
18699
diff
changeset
|
199 ;; In emacs 19.29 and later, and XEmacs 19.13 and later, all messages |
2442a5dce1a8
(eldoc-message): Check for 1-arg case, and store string in
Noah Friedman <friedman@splode.com>
parents:
18699
diff
changeset
|
200 ;; are recorded in a log. Do not put eldoc messages in that log since |
2442a5dce1a8
(eldoc-message): Check for 1-arg case, and store string in
Noah Friedman <friedman@splode.com>
parents:
18699
diff
changeset
|
201 ;; they are Legion. |
49697
eb34aebd1084
(eldoc-echo-area-multiline-supported-p, eldoc-use-idle-timer-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49018
diff
changeset
|
202 ;; Emacs way of preventing log messages. |
eb34aebd1084
(eldoc-echo-area-multiline-supported-p, eldoc-use-idle-timer-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49018
diff
changeset
|
203 (let ((message-log-max nil)) |
eb34aebd1084
(eldoc-echo-area-multiline-supported-p, eldoc-use-idle-timer-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49018
diff
changeset
|
204 (cond (eldoc-last-message (message "%s" eldoc-last-message)) |
eb34aebd1084
(eldoc-echo-area-multiline-supported-p, eldoc-use-idle-timer-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49018
diff
changeset
|
205 (omessage (message nil))))) |
23283
2442a5dce1a8
(eldoc-message): Check for 1-arg case, and store string in
Noah Friedman <friedman@splode.com>
parents:
18699
diff
changeset
|
206 eldoc-last-message) |
2442a5dce1a8
(eldoc-message): Check for 1-arg case, and store string in
Noah Friedman <friedman@splode.com>
parents:
18699
diff
changeset
|
207 |
16996
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
208 ;; 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
|
209 ;; 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
|
210 ;; 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
|
211 ;; begins. This function reprints the last eldoc message immediately |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
212 ;; 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
|
213 ;; 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
|
214 (defun eldoc-pre-command-refresh-echo-area () |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
215 (and eldoc-last-message |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
216 (if (eldoc-display-message-no-interference-p) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
217 (eldoc-message eldoc-last-message) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
218 (setq eldoc-last-message nil)))) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
219 |
16975
188c4da9bf5d
(eldoc-display-message-p): New function.
Noah Friedman <friedman@splode.com>
parents:
16969
diff
changeset
|
220 ;; 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
|
221 (defun eldoc-display-message-p () |
16996
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
222 (and (eldoc-display-message-no-interference-p) |
49697
eb34aebd1084
(eldoc-echo-area-multiline-supported-p, eldoc-use-idle-timer-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49018
diff
changeset
|
223 ;; If this-command is non-nil while running via an idle |
eb34aebd1084
(eldoc-echo-area-multiline-supported-p, eldoc-use-idle-timer-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49018
diff
changeset
|
224 ;; timer, we're still in the middle of executing a command, |
eb34aebd1084
(eldoc-echo-area-multiline-supported-p, eldoc-use-idle-timer-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49018
diff
changeset
|
225 ;; e.g. a query-replace where it would be annoying to |
eb34aebd1084
(eldoc-echo-area-multiline-supported-p, eldoc-use-idle-timer-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49018
diff
changeset
|
226 ;; overwrite the echo area. |
eb34aebd1084
(eldoc-echo-area-multiline-supported-p, eldoc-use-idle-timer-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49018
diff
changeset
|
227 (and (not this-command) |
eb34aebd1084
(eldoc-echo-area-multiline-supported-p, eldoc-use-idle-timer-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49018
diff
changeset
|
228 (symbolp last-command) |
eb34aebd1084
(eldoc-echo-area-multiline-supported-p, eldoc-use-idle-timer-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49018
diff
changeset
|
229 (intern-soft (symbol-name last-command) |
eb34aebd1084
(eldoc-echo-area-multiline-supported-p, eldoc-use-idle-timer-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49018
diff
changeset
|
230 eldoc-message-commands)))) |
13530 | 231 |
30389
38f19553e93d
(eldoc-minor-mode-string): Add autoload cookie; otherwise autoloaded
Noah Friedman <friedman@splode.com>
parents:
23586
diff
changeset
|
232 ;; Check various conditions about the current environment that might make |
38f19553e93d
(eldoc-minor-mode-string): Add autoload cookie; otherwise autoloaded
Noah Friedman <friedman@splode.com>
parents:
23586
diff
changeset
|
233 ;; it undesirable to print eldoc messages right this instant. |
16996
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
234 (defun eldoc-display-message-no-interference-p () |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
235 (and eldoc-mode |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
236 (not executing-kbd-macro) |
30389
38f19553e93d
(eldoc-minor-mode-string): Add autoload cookie; otherwise autoloaded
Noah Friedman <friedman@splode.com>
parents:
23586
diff
changeset
|
237 (not (and (boundp 'edebug-active) edebug-active)) |
16996
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
238 ;; 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
|
239 ;; interference with what's going on there. |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
240 (not cursor-in-echo-area) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
241 (not (eq (selected-window) (minibuffer-window))))) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
242 |
23283
2442a5dce1a8
(eldoc-message): Check for 1-arg case, and store string in
Noah Friedman <friedman@splode.com>
parents:
18699
diff
changeset
|
243 |
62313
6ee2b2667bce
(eldoc-documentation-function): Add autoload.
Richard M. Stallman <rms@gnu.org>
parents:
61856
diff
changeset
|
244 ;;;###autoload |
61855 | 245 (defvar eldoc-documentation-function nil |
52445
d776a9884cef
(eldoc-print-current-symbol-info-function):
Dave Love <fx@gnu.org>
parents:
52401
diff
changeset
|
246 "If non-nil, function to call to return doc string. |
d776a9884cef
(eldoc-print-current-symbol-info-function):
Dave Love <fx@gnu.org>
parents:
52401
diff
changeset
|
247 The function of no args should return a one-line string for displaying |
d776a9884cef
(eldoc-print-current-symbol-info-function):
Dave Love <fx@gnu.org>
parents:
52401
diff
changeset
|
248 doc about a function etc. appropriate to the context around point. |
d776a9884cef
(eldoc-print-current-symbol-info-function):
Dave Love <fx@gnu.org>
parents:
52401
diff
changeset
|
249 It should return nil if there's no doc appropriate for the context. |
d776a9884cef
(eldoc-print-current-symbol-info-function):
Dave Love <fx@gnu.org>
parents:
52401
diff
changeset
|
250 Typically doc is returned if point is on a function-like name or in its |
d776a9884cef
(eldoc-print-current-symbol-info-function):
Dave Love <fx@gnu.org>
parents:
52401
diff
changeset
|
251 arg list. |
d776a9884cef
(eldoc-print-current-symbol-info-function):
Dave Love <fx@gnu.org>
parents:
52401
diff
changeset
|
252 |
101225
84ba7288e2c7
Remove leading `*' from defcustoms.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
253 The result is used as is, so the function must explicitly handle |
84ba7288e2c7
Remove leading `*' from defcustoms.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
254 the variables `eldoc-argument-case' and `eldoc-echo-area-use-multiline-p', |
84ba7288e2c7
Remove leading `*' from defcustoms.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
255 and the face `eldoc-highlight-function-argument', if they are to have any |
84ba7288e2c7
Remove leading `*' from defcustoms.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
256 effect. |
84ba7288e2c7
Remove leading `*' from defcustoms.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
257 |
52445
d776a9884cef
(eldoc-print-current-symbol-info-function):
Dave Love <fx@gnu.org>
parents:
52401
diff
changeset
|
258 This variable is expected to be made buffer-local by modes (other than |
101270
652c25392003
(eldoc-minor-mode-string, eldoc-message-commands)
Glenn Morris <rgm@gnu.org>
parents:
101225
diff
changeset
|
259 Emacs Lisp mode) that support ElDoc.") |
52445
d776a9884cef
(eldoc-print-current-symbol-info-function):
Dave Love <fx@gnu.org>
parents:
52401
diff
changeset
|
260 |
23283
2442a5dce1a8
(eldoc-message): Check for 1-arg case, and store string in
Noah Friedman <friedman@splode.com>
parents:
18699
diff
changeset
|
261 (defun eldoc-print-current-symbol-info () |
48470
5a25c61f2c8b
(eldoc-print-current-symbol-info):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42623
diff
changeset
|
262 (condition-case err |
5a25c61f2c8b
(eldoc-print-current-symbol-info):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42623
diff
changeset
|
263 (and (eldoc-display-message-p) |
61855 | 264 (if eldoc-documentation-function |
265 (eldoc-message (funcall eldoc-documentation-function)) | |
52445
d776a9884cef
(eldoc-print-current-symbol-info-function):
Dave Love <fx@gnu.org>
parents:
52401
diff
changeset
|
266 (let* ((current-symbol (eldoc-current-symbol)) |
d776a9884cef
(eldoc-print-current-symbol-info-function):
Dave Love <fx@gnu.org>
parents:
52401
diff
changeset
|
267 (current-fnsym (eldoc-fnsym-in-current-sexp)) |
d776a9884cef
(eldoc-print-current-symbol-info-function):
Dave Love <fx@gnu.org>
parents:
52401
diff
changeset
|
268 (doc (cond |
81819
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
269 ((null current-fnsym) |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
270 nil) |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
271 ((eq current-symbol (car current-fnsym)) |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
272 (or (apply 'eldoc-get-fnsym-args-string |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
273 current-fnsym) |
52445
d776a9884cef
(eldoc-print-current-symbol-info-function):
Dave Love <fx@gnu.org>
parents:
52401
diff
changeset
|
274 (eldoc-get-var-docstring current-symbol))) |
d776a9884cef
(eldoc-print-current-symbol-info-function):
Dave Love <fx@gnu.org>
parents:
52401
diff
changeset
|
275 (t |
d776a9884cef
(eldoc-print-current-symbol-info-function):
Dave Love <fx@gnu.org>
parents:
52401
diff
changeset
|
276 (or (eldoc-get-var-docstring current-symbol) |
81819
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
277 (apply 'eldoc-get-fnsym-args-string |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
278 current-fnsym)))))) |
52445
d776a9884cef
(eldoc-print-current-symbol-info-function):
Dave Love <fx@gnu.org>
parents:
52401
diff
changeset
|
279 (eldoc-message doc)))) |
48470
5a25c61f2c8b
(eldoc-print-current-symbol-info):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42623
diff
changeset
|
280 ;; This is run from post-command-hook or some idle timer thing, |
5a25c61f2c8b
(eldoc-print-current-symbol-info):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42623
diff
changeset
|
281 ;; so we need to be careful that errors aren't ignored. |
5a25c61f2c8b
(eldoc-print-current-symbol-info):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42623
diff
changeset
|
282 (error (message "eldoc error: %s" err)))) |
23283
2442a5dce1a8
(eldoc-message): Check for 1-arg case, and store string in
Noah Friedman <friedman@splode.com>
parents:
18699
diff
changeset
|
283 |
82465
0b0688e8eda7
(eldoc-get-fnsym-args-string): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
82456
diff
changeset
|
284 (defun eldoc-get-fnsym-args-string (sym &optional index) |
82456
943f0b2ad6bb
(eldoc-get-fnsym-args-string): Convert
Glenn Morris <rgm@gnu.org>
parents:
82329
diff
changeset
|
285 "Return a string containing the parameter list of the function SYM. |
943f0b2ad6bb
(eldoc-get-fnsym-args-string): Convert
Glenn Morris <rgm@gnu.org>
parents:
82329
diff
changeset
|
286 If SYM is a subr and no arglist is obtainable from the docstring |
82465
0b0688e8eda7
(eldoc-get-fnsym-args-string): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
82456
diff
changeset
|
287 or elsewhere, return a 1-line docstring. Calls the functions |
0b0688e8eda7
(eldoc-get-fnsym-args-string): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
82456
diff
changeset
|
288 `eldoc-function-argstring-format' and |
0b0688e8eda7
(eldoc-get-fnsym-args-string): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
82456
diff
changeset
|
289 `eldoc-highlight-function-argument' to format the result. The |
0b0688e8eda7
(eldoc-get-fnsym-args-string): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
82456
diff
changeset
|
290 former calls `eldoc-argument-case'; the latter gives the |
0b0688e8eda7
(eldoc-get-fnsym-args-string): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
82456
diff
changeset
|
291 function name `font-lock-function-name-face', and optionally |
101225
84ba7288e2c7
Remove leading `*' from defcustoms.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
292 highlights argument number INDEX." |
82456
943f0b2ad6bb
(eldoc-get-fnsym-args-string): Convert
Glenn Morris <rgm@gnu.org>
parents:
82329
diff
changeset
|
293 (let (args doc) |
49697
eb34aebd1084
(eldoc-echo-area-multiline-supported-p, eldoc-use-idle-timer-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49018
diff
changeset
|
294 (cond ((not (and sym (symbolp sym) (fboundp sym)))) |
82456
943f0b2ad6bb
(eldoc-get-fnsym-args-string): Convert
Glenn Morris <rgm@gnu.org>
parents:
82329
diff
changeset
|
295 ((and (eq sym (aref eldoc-last-data 0)) |
943f0b2ad6bb
(eldoc-get-fnsym-args-string): Convert
Glenn Morris <rgm@gnu.org>
parents:
82329
diff
changeset
|
296 (eq 'function (aref eldoc-last-data 2))) |
943f0b2ad6bb
(eldoc-get-fnsym-args-string): Convert
Glenn Morris <rgm@gnu.org>
parents:
82329
diff
changeset
|
297 (setq doc (aref eldoc-last-data 1))) |
48470
5a25c61f2c8b
(eldoc-print-current-symbol-info):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42623
diff
changeset
|
298 ((setq doc (help-split-fundoc (documentation sym t) sym)) |
5a25c61f2c8b
(eldoc-print-current-symbol-info):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42623
diff
changeset
|
299 (setq args (car doc)) |
82456
943f0b2ad6bb
(eldoc-get-fnsym-args-string): Convert
Glenn Morris <rgm@gnu.org>
parents:
82329
diff
changeset
|
300 ;; Remove any enclosing (), since e-function-argstring adds them. |
48470
5a25c61f2c8b
(eldoc-print-current-symbol-info):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42623
diff
changeset
|
301 (string-match "\\`[^ )]* ?" args) |
82456
943f0b2ad6bb
(eldoc-get-fnsym-args-string): Convert
Glenn Morris <rgm@gnu.org>
parents:
82329
diff
changeset
|
302 (setq args (substring args (match-end 0))) |
101429
57e8989174eb
* emacs-lisp/eldoc.el (eldoc-function-argstring-format):
Juanma Barranquero <lekktu@gmail.com>
parents:
101270
diff
changeset
|
303 (if (string-match-p ")\\'" args) |
82456
943f0b2ad6bb
(eldoc-get-fnsym-args-string): Convert
Glenn Morris <rgm@gnu.org>
parents:
82329
diff
changeset
|
304 (setq args (substring args 0 -1)))) |
943f0b2ad6bb
(eldoc-get-fnsym-args-string): Convert
Glenn Morris <rgm@gnu.org>
parents:
82329
diff
changeset
|
305 (t |
943f0b2ad6bb
(eldoc-get-fnsym-args-string): Convert
Glenn Morris <rgm@gnu.org>
parents:
82329
diff
changeset
|
306 (setq args (help-function-arglist sym)))) |
943f0b2ad6bb
(eldoc-get-fnsym-args-string): Convert
Glenn Morris <rgm@gnu.org>
parents:
82329
diff
changeset
|
307 (if args |
943f0b2ad6bb
(eldoc-get-fnsym-args-string): Convert
Glenn Morris <rgm@gnu.org>
parents:
82329
diff
changeset
|
308 ;; Stringify, and store before highlighting, downcasing, etc. |
943f0b2ad6bb
(eldoc-get-fnsym-args-string): Convert
Glenn Morris <rgm@gnu.org>
parents:
82329
diff
changeset
|
309 ;; FIXME should truncate before storing. |
943f0b2ad6bb
(eldoc-get-fnsym-args-string): Convert
Glenn Morris <rgm@gnu.org>
parents:
82329
diff
changeset
|
310 (eldoc-last-data-store sym (setq args (eldoc-function-argstring args)) |
943f0b2ad6bb
(eldoc-get-fnsym-args-string): Convert
Glenn Morris <rgm@gnu.org>
parents:
82329
diff
changeset
|
311 'function) |
943f0b2ad6bb
(eldoc-get-fnsym-args-string): Convert
Glenn Morris <rgm@gnu.org>
parents:
82329
diff
changeset
|
312 (setq args doc)) ; use stored value |
943f0b2ad6bb
(eldoc-get-fnsym-args-string): Convert
Glenn Morris <rgm@gnu.org>
parents:
82329
diff
changeset
|
313 ;; Change case, highlight, truncate. |
943f0b2ad6bb
(eldoc-get-fnsym-args-string): Convert
Glenn Morris <rgm@gnu.org>
parents:
82329
diff
changeset
|
314 (if args |
943f0b2ad6bb
(eldoc-get-fnsym-args-string): Convert
Glenn Morris <rgm@gnu.org>
parents:
82329
diff
changeset
|
315 (eldoc-highlight-function-argument |
82465
0b0688e8eda7
(eldoc-get-fnsym-args-string): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
82456
diff
changeset
|
316 sym (eldoc-function-argstring-format args) index)))) |
23283
2442a5dce1a8
(eldoc-message): Check for 1-arg case, and store string in
Noah Friedman <friedman@splode.com>
parents:
18699
diff
changeset
|
317 |
82465
0b0688e8eda7
(eldoc-get-fnsym-args-string): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
82456
diff
changeset
|
318 (defun eldoc-highlight-function-argument (sym args index) |
0b0688e8eda7
(eldoc-get-fnsym-args-string): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
82456
diff
changeset
|
319 "Highlight argument INDEX in ARGS list for function SYM. |
0b0688e8eda7
(eldoc-get-fnsym-args-string): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
82456
diff
changeset
|
320 In the absence of INDEX, just call `eldoc-docstring-format-sym-doc'." |
81819
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
321 (let ((start nil) |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
322 (end 0) |
82797
46c1137c9130
Nikolaj Schumacher <n_schumacher at web.de> (tiny change)
Glenn Morris <rgm@gnu.org>
parents:
82465
diff
changeset
|
323 (argument-face 'eldoc-highlight-function-argument)) |
81819
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
324 ;; Find the current argument in the argument string. We need to |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
325 ;; handle `&rest' and informal `...' properly. |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
326 ;; |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
327 ;; FIXME: What to do with optional arguments, like in |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
328 ;; (defun NAME ARGLIST [DOCSTRING] BODY...) case? |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
329 ;; The problem is there is no robust way to determine if |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
330 ;; the current argument is indeed a docstring. |
82456
943f0b2ad6bb
(eldoc-get-fnsym-args-string): Convert
Glenn Morris <rgm@gnu.org>
parents:
82329
diff
changeset
|
331 (while (and index (>= index 1)) |
81819
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
332 (if (string-match "[^ ()]+" args end) |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
333 (progn |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
334 (setq start (match-beginning 0) |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
335 end (match-end 0)) |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
336 (let ((argument (match-string 0 args))) |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
337 (cond ((string= argument "&rest") |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
338 ;; All the rest arguments are the same. |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
339 (setq index 1)) |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
340 ((string= argument "&optional")) |
101429
57e8989174eb
* emacs-lisp/eldoc.el (eldoc-function-argstring-format):
Juanma Barranquero <lekktu@gmail.com>
parents:
101270
diff
changeset
|
341 ((string-match-p "\\.\\.\\.$" argument) |
81819
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
342 (setq index 0)) |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
343 (t |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
344 (setq index (1- index)))))) |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
345 (setq end (length args) |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
346 start (1- end) |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
347 argument-face 'font-lock-warning-face |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
348 index 0))) |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
349 (let ((doc args)) |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
350 (when start |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
351 (setq doc (copy-sequence args)) |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
352 (add-text-properties start end (list 'face argument-face) doc)) |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
353 (setq doc (eldoc-docstring-format-sym-doc |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
354 sym doc 'font-lock-function-name-face)) |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
355 doc))) |
23283
2442a5dce1a8
(eldoc-message): Check for 1-arg case, and store string in
Noah Friedman <friedman@splode.com>
parents:
18699
diff
changeset
|
356 |
2442a5dce1a8
(eldoc-message): Check for 1-arg case, and store string in
Noah Friedman <friedman@splode.com>
parents:
18699
diff
changeset
|
357 ;; Return a string containing a brief (one-line) documentation string for |
2442a5dce1a8
(eldoc-message): Check for 1-arg case, and store string in
Noah Friedman <friedman@splode.com>
parents:
18699
diff
changeset
|
358 ;; the variable. |
2442a5dce1a8
(eldoc-message): Check for 1-arg case, and store string in
Noah Friedman <friedman@splode.com>
parents:
18699
diff
changeset
|
359 (defun eldoc-get-var-docstring (sym) |
49017
09ff6e632947
(eldoc-get-var-docstring): Only return a
John Paul Wallington <jpw@pobox.com>
parents:
48470
diff
changeset
|
360 (when sym |
09ff6e632947
(eldoc-get-var-docstring): Only return a
John Paul Wallington <jpw@pobox.com>
parents:
48470
diff
changeset
|
361 (cond ((and (eq sym (aref eldoc-last-data 0)) |
09ff6e632947
(eldoc-get-var-docstring): Only return a
John Paul Wallington <jpw@pobox.com>
parents:
48470
diff
changeset
|
362 (eq 'variable (aref eldoc-last-data 2))) |
09ff6e632947
(eldoc-get-var-docstring): Only return a
John Paul Wallington <jpw@pobox.com>
parents:
48470
diff
changeset
|
363 (aref eldoc-last-data 1)) |
09ff6e632947
(eldoc-get-var-docstring): Only return a
John Paul Wallington <jpw@pobox.com>
parents:
48470
diff
changeset
|
364 (t |
09ff6e632947
(eldoc-get-var-docstring): Only return a
John Paul Wallington <jpw@pobox.com>
parents:
48470
diff
changeset
|
365 (let ((doc (documentation-property sym 'variable-documentation t))) |
09ff6e632947
(eldoc-get-var-docstring): Only return a
John Paul Wallington <jpw@pobox.com>
parents:
48470
diff
changeset
|
366 (cond (doc |
09ff6e632947
(eldoc-get-var-docstring): Only return a
John Paul Wallington <jpw@pobox.com>
parents:
48470
diff
changeset
|
367 (setq doc (eldoc-docstring-format-sym-doc |
81819
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
368 sym (eldoc-docstring-first-line doc) |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
369 'font-lock-variable-name-face)) |
49017
09ff6e632947
(eldoc-get-var-docstring): Only return a
John Paul Wallington <jpw@pobox.com>
parents:
48470
diff
changeset
|
370 (eldoc-last-data-store sym doc 'variable))) |
09ff6e632947
(eldoc-get-var-docstring): Only return a
John Paul Wallington <jpw@pobox.com>
parents:
48470
diff
changeset
|
371 doc))))) |
23283
2442a5dce1a8
(eldoc-message): Check for 1-arg case, and store string in
Noah Friedman <friedman@splode.com>
parents:
18699
diff
changeset
|
372 |
2442a5dce1a8
(eldoc-message): Check for 1-arg case, and store string in
Noah Friedman <friedman@splode.com>
parents:
18699
diff
changeset
|
373 (defun eldoc-last-data-store (symbol doc type) |
2442a5dce1a8
(eldoc-message): Check for 1-arg case, and store string in
Noah Friedman <friedman@splode.com>
parents:
18699
diff
changeset
|
374 (aset eldoc-last-data 0 symbol) |
2442a5dce1a8
(eldoc-message): Check for 1-arg case, and store string in
Noah Friedman <friedman@splode.com>
parents:
18699
diff
changeset
|
375 (aset eldoc-last-data 1 doc) |
2442a5dce1a8
(eldoc-message): Check for 1-arg case, and store string in
Noah Friedman <friedman@splode.com>
parents:
18699
diff
changeset
|
376 (aset eldoc-last-data 2 type)) |
13530 | 377 |
23283
2442a5dce1a8
(eldoc-message): Check for 1-arg case, and store string in
Noah Friedman <friedman@splode.com>
parents:
18699
diff
changeset
|
378 ;; Note that any leading `*' in the docstring (which indicates the variable |
2442a5dce1a8
(eldoc-message): Check for 1-arg case, and store string in
Noah Friedman <friedman@splode.com>
parents:
18699
diff
changeset
|
379 ;; is a user option) is removed. |
2442a5dce1a8
(eldoc-message): Check for 1-arg case, and store string in
Noah Friedman <friedman@splode.com>
parents:
18699
diff
changeset
|
380 (defun eldoc-docstring-first-line (doc) |
2442a5dce1a8
(eldoc-message): Check for 1-arg case, and store string in
Noah Friedman <friedman@splode.com>
parents:
18699
diff
changeset
|
381 (and (stringp doc) |
2442a5dce1a8
(eldoc-message): Check for 1-arg case, and store string in
Noah Friedman <friedman@splode.com>
parents:
18699
diff
changeset
|
382 (substitute-command-keys |
2442a5dce1a8
(eldoc-message): Check for 1-arg case, and store string in
Noah Friedman <friedman@splode.com>
parents:
18699
diff
changeset
|
383 (save-match-data |
100002
eda94c1ba359
(eldoc-docstring-first-line): Don't match
Martin Rudalics <rudalics@gmx.at>
parents:
94655
diff
changeset
|
384 ;; Don't use "^" in the regexp below since it may match |
eda94c1ba359
(eldoc-docstring-first-line): Don't match
Martin Rudalics <rudalics@gmx.at>
parents:
94655
diff
changeset
|
385 ;; anywhere in the doc-string. |
eda94c1ba359
(eldoc-docstring-first-line): Don't match
Martin Rudalics <rudalics@gmx.at>
parents:
94655
diff
changeset
|
386 (let ((start (if (string-match "\\`\\*" doc) (match-end 0) 0))) |
23283
2442a5dce1a8
(eldoc-message): Check for 1-arg case, and store string in
Noah Friedman <friedman@splode.com>
parents:
18699
diff
changeset
|
387 (cond ((string-match "\n" doc) |
2442a5dce1a8
(eldoc-message): Check for 1-arg case, and store string in
Noah Friedman <friedman@splode.com>
parents:
18699
diff
changeset
|
388 (substring doc start (match-beginning 0))) |
2442a5dce1a8
(eldoc-message): Check for 1-arg case, and store string in
Noah Friedman <friedman@splode.com>
parents:
18699
diff
changeset
|
389 ((zerop start) doc) |
2442a5dce1a8
(eldoc-message): Check for 1-arg case, and store string in
Noah Friedman <friedman@splode.com>
parents:
18699
diff
changeset
|
390 (t (substring doc start)))))))) |
2442a5dce1a8
(eldoc-message): Check for 1-arg case, and store string in
Noah Friedman <friedman@splode.com>
parents:
18699
diff
changeset
|
391 |
2442a5dce1a8
(eldoc-message): Check for 1-arg case, and store string in
Noah Friedman <friedman@splode.com>
parents:
18699
diff
changeset
|
392 ;; If the entire line cannot fit in the echo area, the symbol name may be |
2442a5dce1a8
(eldoc-message): Check for 1-arg case, and store string in
Noah Friedman <friedman@splode.com>
parents:
18699
diff
changeset
|
393 ;; truncated or eliminated entirely from the output to make room for the |
2442a5dce1a8
(eldoc-message): Check for 1-arg case, and store string in
Noah Friedman <friedman@splode.com>
parents:
18699
diff
changeset
|
394 ;; description. |
81819
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
395 (defun eldoc-docstring-format-sym-doc (sym doc face) |
23283
2442a5dce1a8
(eldoc-message): Check for 1-arg case, and store string in
Noah Friedman <friedman@splode.com>
parents:
18699
diff
changeset
|
396 (save-match-data |
2442a5dce1a8
(eldoc-message): Check for 1-arg case, and store string in
Noah Friedman <friedman@splode.com>
parents:
18699
diff
changeset
|
397 (let* ((name (symbol-name sym)) |
49697
eb34aebd1084
(eldoc-echo-area-multiline-supported-p, eldoc-use-idle-timer-p): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49018
diff
changeset
|
398 (ea-multi eldoc-echo-area-use-multiline-p) |
30389
38f19553e93d
(eldoc-minor-mode-string): Add autoload cookie; otherwise autoloaded
Noah Friedman <friedman@splode.com>
parents:
23586
diff
changeset
|
399 ;; Subtract 1 from window width since emacs will not write |
38f19553e93d
(eldoc-minor-mode-string): Add autoload cookie; otherwise autoloaded
Noah Friedman <friedman@splode.com>
parents:
23586
diff
changeset
|
400 ;; any chars to the last column, or in later versions, will |
38f19553e93d
(eldoc-minor-mode-string): Add autoload cookie; otherwise autoloaded
Noah Friedman <friedman@splode.com>
parents:
23586
diff
changeset
|
401 ;; cause a wraparound and resize of the echo area. |
38f19553e93d
(eldoc-minor-mode-string): Add autoload cookie; otherwise autoloaded
Noah Friedman <friedman@splode.com>
parents:
23586
diff
changeset
|
402 (ea-width (1- (window-width (minibuffer-window)))) |
38f19553e93d
(eldoc-minor-mode-string): Add autoload cookie; otherwise autoloaded
Noah Friedman <friedman@splode.com>
parents:
23586
diff
changeset
|
403 (strip (- (+ (length name) (length ": ") (length doc)) ea-width))) |
38f19553e93d
(eldoc-minor-mode-string): Add autoload cookie; otherwise autoloaded
Noah Friedman <friedman@splode.com>
parents:
23586
diff
changeset
|
404 (cond ((or (<= strip 0) |
38f19553e93d
(eldoc-minor-mode-string): Add autoload cookie; otherwise autoloaded
Noah Friedman <friedman@splode.com>
parents:
23586
diff
changeset
|
405 (eq ea-multi t) |
38f19553e93d
(eldoc-minor-mode-string): Add autoload cookie; otherwise autoloaded
Noah Friedman <friedman@splode.com>
parents:
23586
diff
changeset
|
406 (and ea-multi (> (length doc) ea-width))) |
81819
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
407 (format "%s: %s" (propertize name 'face face) doc)) |
30389
38f19553e93d
(eldoc-minor-mode-string): Add autoload cookie; otherwise autoloaded
Noah Friedman <friedman@splode.com>
parents:
23586
diff
changeset
|
408 ((> (length doc) ea-width) |
38f19553e93d
(eldoc-minor-mode-string): Add autoload cookie; otherwise autoloaded
Noah Friedman <friedman@splode.com>
parents:
23586
diff
changeset
|
409 (substring (format "%s" doc) 0 ea-width)) |
38f19553e93d
(eldoc-minor-mode-string): Add autoload cookie; otherwise autoloaded
Noah Friedman <friedman@splode.com>
parents:
23586
diff
changeset
|
410 ((>= strip (length name)) |
38f19553e93d
(eldoc-minor-mode-string): Add autoload cookie; otherwise autoloaded
Noah Friedman <friedman@splode.com>
parents:
23586
diff
changeset
|
411 (format "%s" doc)) |
23283
2442a5dce1a8
(eldoc-message): Check for 1-arg case, and store string in
Noah Friedman <friedman@splode.com>
parents:
18699
diff
changeset
|
412 (t |
30389
38f19553e93d
(eldoc-minor-mode-string): Add autoload cookie; otherwise autoloaded
Noah Friedman <friedman@splode.com>
parents:
23586
diff
changeset
|
413 ;; Show the end of the partial symbol name, rather |
38f19553e93d
(eldoc-minor-mode-string): Add autoload cookie; otherwise autoloaded
Noah Friedman <friedman@splode.com>
parents:
23586
diff
changeset
|
414 ;; than the beginning, since the former is more likely |
38f19553e93d
(eldoc-minor-mode-string): Add autoload cookie; otherwise autoloaded
Noah Friedman <friedman@splode.com>
parents:
23586
diff
changeset
|
415 ;; to be unique given package namespace conventions. |
38f19553e93d
(eldoc-minor-mode-string): Add autoload cookie; otherwise autoloaded
Noah Friedman <friedman@splode.com>
parents:
23586
diff
changeset
|
416 (setq name (substring name strip)) |
81819
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
417 (format "%s: %s" (propertize name 'face face) doc)))))) |
23283
2442a5dce1a8
(eldoc-message): Check for 1-arg case, and store string in
Noah Friedman <friedman@splode.com>
parents:
18699
diff
changeset
|
418 |
2442a5dce1a8
(eldoc-message): Check for 1-arg case, and store string in
Noah Friedman <friedman@splode.com>
parents:
18699
diff
changeset
|
419 |
81819
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
420 ;; Return a list of current function name and argument index. |
13530 | 421 (defun eldoc-fnsym-in-current-sexp () |
81819
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
422 (save-excursion |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
423 (let ((argument-index (1- (eldoc-beginning-of-sexp)))) |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
424 ;; If we are at the beginning of function name, this will be -1. |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
425 (when (< argument-index 0) |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
426 (setq argument-index 0)) |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
427 ;; Don't do anything if current word is inside a string. |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
428 (if (= (or (char-after (1- (point))) 0) ?\") |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
429 nil |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
430 (list (eldoc-current-symbol) argument-index))))) |
16996
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
431 |
81819
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
432 ;; Move to the beginnig of current sexp. Return the number of nested |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
433 ;; sexp the point was over or after. |
16996
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
434 (defun eldoc-beginning-of-sexp () |
81819
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
435 (let ((parse-sexp-ignore-comments t) |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
436 (num-skipped-sexps 0)) |
16996
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
437 (condition-case err |
81819
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
438 (progn |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
439 ;; First account for the case the point is directly over a |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
440 ;; beginning of a nested sexp. |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
441 (condition-case err |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
442 (let ((p (point))) |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
443 (forward-sexp -1) |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
444 (forward-sexp 1) |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
445 (when (< (point) p) |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
446 (setq num-skipped-sexps 1))) |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
447 (error)) |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
448 (while |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
449 (let ((p (point))) |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
450 (forward-sexp -1) |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
451 (when (< (point) p) |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
452 (setq num-skipped-sexps (1+ num-skipped-sexps)))))) |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
453 (error)) |
f6d3d2315f54
(eldoc-last-data): Revise documentation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
77657
diff
changeset
|
454 num-skipped-sexps)) |
16996
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
455 |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
456 ;; returns nil unless current word is an interned symbol. |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
457 (defun eldoc-current-symbol () |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
458 (let ((c (char-after (point)))) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
459 (and c |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
460 (memq (char-syntax c) '(?w ?_)) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
461 (intern-soft (current-word))))) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
462 |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
463 ;; Do indirect function resolution if possible. |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
464 (defun eldoc-symbol-function (fsym) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
465 (let ((defn (and (fboundp fsym) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
466 (symbol-function fsym)))) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
467 (and (symbolp defn) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
468 (condition-case err |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
469 (setq defn (indirect-function fsym)) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
470 (error (setq defn nil)))) |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
471 defn)) |
13530 | 472 |
82456
943f0b2ad6bb
(eldoc-get-fnsym-args-string): Convert
Glenn Morris <rgm@gnu.org>
parents:
82329
diff
changeset
|
473 (defun eldoc-function-argstring (arglist) |
943f0b2ad6bb
(eldoc-get-fnsym-args-string): Convert
Glenn Morris <rgm@gnu.org>
parents:
82329
diff
changeset
|
474 "Return ARGLIST as a string enclosed by (). |
943f0b2ad6bb
(eldoc-get-fnsym-args-string): Convert
Glenn Morris <rgm@gnu.org>
parents:
82329
diff
changeset
|
475 ARGLIST is either a string, or a list of strings or symbols." |
943f0b2ad6bb
(eldoc-get-fnsym-args-string): Convert
Glenn Morris <rgm@gnu.org>
parents:
82329
diff
changeset
|
476 (cond ((stringp arglist)) |
943f0b2ad6bb
(eldoc-get-fnsym-args-string): Convert
Glenn Morris <rgm@gnu.org>
parents:
82329
diff
changeset
|
477 ((not (listp arglist)) |
943f0b2ad6bb
(eldoc-get-fnsym-args-string): Convert
Glenn Morris <rgm@gnu.org>
parents:
82329
diff
changeset
|
478 (setq arglist nil)) |
943f0b2ad6bb
(eldoc-get-fnsym-args-string): Convert
Glenn Morris <rgm@gnu.org>
parents:
82329
diff
changeset
|
479 ((symbolp (car arglist)) |
943f0b2ad6bb
(eldoc-get-fnsym-args-string): Convert
Glenn Morris <rgm@gnu.org>
parents:
82329
diff
changeset
|
480 (setq arglist |
943f0b2ad6bb
(eldoc-get-fnsym-args-string): Convert
Glenn Morris <rgm@gnu.org>
parents:
82329
diff
changeset
|
481 (mapconcat (lambda (s) (symbol-name s)) |
943f0b2ad6bb
(eldoc-get-fnsym-args-string): Convert
Glenn Morris <rgm@gnu.org>
parents:
82329
diff
changeset
|
482 arglist " "))) |
943f0b2ad6bb
(eldoc-get-fnsym-args-string): Convert
Glenn Morris <rgm@gnu.org>
parents:
82329
diff
changeset
|
483 ((stringp (car arglist)) |
943f0b2ad6bb
(eldoc-get-fnsym-args-string): Convert
Glenn Morris <rgm@gnu.org>
parents:
82329
diff
changeset
|
484 (setq arglist |
943f0b2ad6bb
(eldoc-get-fnsym-args-string): Convert
Glenn Morris <rgm@gnu.org>
parents:
82329
diff
changeset
|
485 (mapconcat (lambda (s) s) |
943f0b2ad6bb
(eldoc-get-fnsym-args-string): Convert
Glenn Morris <rgm@gnu.org>
parents:
82329
diff
changeset
|
486 arglist " ")))) |
943f0b2ad6bb
(eldoc-get-fnsym-args-string): Convert
Glenn Morris <rgm@gnu.org>
parents:
82329
diff
changeset
|
487 (if arglist |
943f0b2ad6bb
(eldoc-get-fnsym-args-string): Convert
Glenn Morris <rgm@gnu.org>
parents:
82329
diff
changeset
|
488 (format "(%s)" arglist))) |
13530 | 489 |
82456
943f0b2ad6bb
(eldoc-get-fnsym-args-string): Convert
Glenn Morris <rgm@gnu.org>
parents:
82329
diff
changeset
|
490 (defun eldoc-function-argstring-format (argstring) |
84938
17bdbd096c94
(eldoc-message-commands-table-size, eldoc-message-commands,
Juanma Barranquero <lekktu@gmail.com>
parents:
82797
diff
changeset
|
491 "Apply `eldoc-argument-case' to each word in ARGSTRING. |
82456
943f0b2ad6bb
(eldoc-get-fnsym-args-string): Convert
Glenn Morris <rgm@gnu.org>
parents:
82329
diff
changeset
|
492 The words \"&rest\", \"&optional\" are returned unchanged." |
943f0b2ad6bb
(eldoc-get-fnsym-args-string): Convert
Glenn Morris <rgm@gnu.org>
parents:
82329
diff
changeset
|
493 (mapconcat (lambda (s) |
101429
57e8989174eb
* emacs-lisp/eldoc.el (eldoc-function-argstring-format):
Juanma Barranquero <lekktu@gmail.com>
parents:
101270
diff
changeset
|
494 (if (string-match-p "\\`(?&\\(?:optional\\|rest\\))?\\'" s) |
82456
943f0b2ad6bb
(eldoc-get-fnsym-args-string): Convert
Glenn Morris <rgm@gnu.org>
parents:
82329
diff
changeset
|
495 s |
943f0b2ad6bb
(eldoc-get-fnsym-args-string): Convert
Glenn Morris <rgm@gnu.org>
parents:
82329
diff
changeset
|
496 (funcall eldoc-argument-case s))) |
101429
57e8989174eb
* emacs-lisp/eldoc.el (eldoc-function-argstring-format):
Juanma Barranquero <lekktu@gmail.com>
parents:
101270
diff
changeset
|
497 (split-string argstring) " ")) |
13530 | 498 |
499 | |
16996
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
500 ;; 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
|
501 ;; 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
|
502 ;; 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
|
503 ;; overwrite them unless it is more restrained. |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
504 ;; These functions do display-command table management. |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
505 |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
506 (defun eldoc-add-command (&rest cmds) |
65843
e28dd6224eb2
Move comments into docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64933
diff
changeset
|
507 (dolist (name cmds) |
e28dd6224eb2
Move comments into docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64933
diff
changeset
|
508 (and (symbolp name) |
e28dd6224eb2
Move comments into docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64933
diff
changeset
|
509 (setq name (symbol-name name))) |
e28dd6224eb2
Move comments into docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64933
diff
changeset
|
510 (set (intern name eldoc-message-commands) t))) |
13530 | 511 |
16996
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
512 (defun eldoc-add-command-completions (&rest names) |
65843
e28dd6224eb2
Move comments into docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64933
diff
changeset
|
513 (dolist (name names) |
e28dd6224eb2
Move comments into docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64933
diff
changeset
|
514 (apply 'eldoc-add-command (all-completions name obarray 'commandp)))) |
16996
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
515 |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
516 (defun eldoc-remove-command (&rest cmds) |
65843
e28dd6224eb2
Move comments into docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64933
diff
changeset
|
517 (dolist (name cmds) |
e28dd6224eb2
Move comments into docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64933
diff
changeset
|
518 (and (symbolp name) |
e28dd6224eb2
Move comments into docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64933
diff
changeset
|
519 (setq name (symbol-name name))) |
e28dd6224eb2
Move comments into docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64933
diff
changeset
|
520 (unintern name eldoc-message-commands))) |
16996
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
521 |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
522 (defun eldoc-remove-command-completions (&rest names) |
65843
e28dd6224eb2
Move comments into docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64933
diff
changeset
|
523 (dolist (name names) |
16996
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
524 (apply 'eldoc-remove-command |
65843
e28dd6224eb2
Move comments into docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64933
diff
changeset
|
525 (all-completions name eldoc-message-commands)))) |
16996
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
526 |
23283
2442a5dce1a8
(eldoc-message): Check for 1-arg case, and store string in
Noah Friedman <friedman@splode.com>
parents:
18699
diff
changeset
|
527 |
16996
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
528 ;; Prime the command list. |
2d67501c45b9
(eldoc-message-commands): Doc fixes.
Noah Friedman <friedman@splode.com>
parents:
16975
diff
changeset
|
529 (eldoc-add-command-completions |
65843
e28dd6224eb2
Move comments into docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64933
diff
changeset
|
530 "backward-" "beginning-of-" "move-beginning-of-" "delete-other-windows" |
72737
455031002c62
* window.el (mouse-autoselect-window-timer)
Chong Yidong <cyd@stupidchicken.com>
parents:
68648
diff
changeset
|
531 "delete-window" "handle-select-window" |
65843
e28dd6224eb2
Move comments into docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64933
diff
changeset
|
532 "end-of-" "move-end-of-" "exchange-point-and-mark" "forward-" |
64933
efb3c9d498e7
Add move-beginning-of-line, move-end-of-line, end-of-line,
Eli Zaretskii <eliz@gnu.org>
parents:
64751
diff
changeset
|
533 "indent-for-tab-command" "goto-" "mark-page" "mark-paragraph" |
efb3c9d498e7
Add move-beginning-of-line, move-end-of-line, end-of-line,
Eli Zaretskii <eliz@gnu.org>
parents:
64751
diff
changeset
|
534 "mouse-set-point" "move-" "pop-global-mark" "next-" "other-window" |
efb3c9d498e7
Add move-beginning-of-line, move-end-of-line, end-of-line,
Eli Zaretskii <eliz@gnu.org>
parents:
64751
diff
changeset
|
535 "previous-" "recenter" "scroll-" "self-insert-command" |
efb3c9d498e7
Add move-beginning-of-line, move-end-of-line, end-of-line,
Eli Zaretskii <eliz@gnu.org>
parents:
64751
diff
changeset
|
536 "split-window-" "up-list" "down-list") |
13530 | 537 |
538 (provide 'eldoc) | |
539 | |
65843
e28dd6224eb2
Move comments into docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64933
diff
changeset
|
540 ;; arch-tag: c9a58f9d-2055-46c1-9b82-7248b71a8375 |
13530 | 541 ;;; eldoc.el ends here |