139 |
;;;###autoload |
;;;###autoload |
140 |
(define-minor-mode eldoc-mode |
(define-minor-mode eldoc-mode |
141 |
"Toggle ElDoc mode on or off. |
"Toggle ElDoc mode on or off. |
142 |
Show the defined parameters for the elisp function near point. |
In ElDoc mode, the echo area displays information about a |
143 |
|
function or variable in the text where point is. If point is |
144 |
For the emacs lisp function at the beginning of the sexp which point is |
on a documented variable, it displays that variable's doc string. |
145 |
within, show the defined parameters for the function in the echo area. |
Otherwise it displays the argument list of the function called |
146 |
This information is extracted directly from the function or macro if it is |
in the expression point is on. |
|
in pure lisp. If the emacs function is a subr, the parameters are obtained |
|
|
from the documentation string if possible. |
|
|
|
|
|
If point is over a documented variable, print that variable's docstring |
|
|
instead. |
|
147 |
|
|
148 |
With prefix ARG, turn ElDoc mode on if and only if ARG is positive." |
With prefix ARG, turn ElDoc mode on if and only if ARG is positive." |
149 |
:group 'eldoc :lighter eldoc-minor-mode-string |
:group 'eldoc :lighter eldoc-minor-mode-string |
162 |
(eldoc-mode 1)) |
(eldoc-mode 1)) |
163 |
|
|
164 |
|
|
|
;; Idle timers are part of Emacs 19.31 and later. |
|
165 |
(defun eldoc-schedule-timer () |
(defun eldoc-schedule-timer () |
166 |
(or (and eldoc-timer |
(or (and eldoc-timer |
167 |
(memq eldoc-timer timer-idle-list)) |
(memq eldoc-timer timer-idle-list)) |
229 |
(not (eq (selected-window) (minibuffer-window))))) |
(not (eq (selected-window) (minibuffer-window))))) |
230 |
|
|
231 |
|
|
232 |
(defvar eldoc-print-current-symbol-info-function nil |
(defvar eldoc-documentation-function nil |
233 |
"If non-nil, function to call to return doc string. |
"If non-nil, function to call to return doc string. |
234 |
The function of no args should return a one-line string for displaying |
The function of no args should return a one-line string for displaying |
235 |
doc about a function etc. appropriate to the context around point. |
doc about a function etc. appropriate to the context around point. |
243 |
(defun eldoc-print-current-symbol-info () |
(defun eldoc-print-current-symbol-info () |
244 |
(condition-case err |
(condition-case err |
245 |
(and (eldoc-display-message-p) |
(and (eldoc-display-message-p) |
246 |
(if eldoc-print-current-symbol-info-function |
(if eldoc-documentation-function |
247 |
(eldoc-message (funcall eldoc-print-current-symbol-info-function)) |
(eldoc-message (funcall eldoc-documentation-function)) |
248 |
(let* ((current-symbol (eldoc-current-symbol)) |
(let* ((current-symbol (eldoc-current-symbol)) |
249 |
(current-fnsym (eldoc-fnsym-in-current-sexp)) |
(current-fnsym (eldoc-fnsym-in-current-sexp)) |
250 |
(doc (cond |
(doc (cond |