32
32
; ; the one-line documentation for that variable instead, to remind you of
33
33
; ; that variable's meaning.
34
34
35
- ; ; One useful way to enable this minor mode is to put the following in your
36
- ; ; .emacs:
37
- ; ;
38
- ; ; (add-hook 'emacs-lisp-mode-hook 'eldoc-mode)
39
- ; ; (add-hook 'lisp-interaction-mode-hook 'eldoc-mode)
40
- ; ; (add-hook 'ielm-mode-hook 'eldoc-mode)
41
- ; ; (add-hook 'eval-expression-minibuffer-setup-hook 'eldoc-mode)
35
+ ; ; This mode is now enabled by default in all major modes that provide
36
+ ; ; support for it, such as `emacs-lisp-mode' .
37
+ ; ; This is controlled by `global-eldoc-mode' .
42
38
43
39
; ; Major modes for other languages may use ElDoc by adding an
44
40
; ; appropriate function to the buffer-local value of
@@ -57,20 +53,17 @@ If user input arrives before this interval of time has elapsed after the
57
53
last input, no documentation will be printed.
58
54
59
55
If this variable is set to 0, no idle time is required."
60
- :type 'number
61
- :group 'eldoc )
56
+ :type 'number )
62
57
63
58
(defcustom eldoc-print-after-edit nil
64
59
" If non-nil eldoc info is only shown when editing.
65
60
Changing the value requires toggling `eldoc-mode' ."
66
- :type 'boolean
67
- :group 'eldoc )
61
+ :type 'boolean )
68
62
69
63
;;;### autoload
70
64
(defcustom eldoc-minor-mode-string (purecopy " ElDoc" )
71
65
" String to display in mode line when ElDoc Mode is enabled; nil for none."
72
- :type '(choice string (const :tag " None" nil ))
73
- :group 'eldoc )
66
+ :type '(choice string (const :tag " None" nil )))
74
67
75
68
(defcustom eldoc-argument-case #'identity
76
69
" Case to display argument names of functions, as a symbol.
@@ -82,8 +75,7 @@ Note that this variable has no effect, unless
82
75
`eldoc-documentation-function' handles it explicitly."
83
76
:type '(radio (function-item upcase)
84
77
(function-item downcase)
85
- function)
86
- :group 'eldoc )
78
+ function))
87
79
(make-obsolete-variable 'eldoc-argument-case nil " 25.1" )
88
80
89
81
(defcustom eldoc-echo-area-use-multiline-p 'truncate-sym-name-if-fit
@@ -106,15 +98,13 @@ Note that this variable has no effect, unless
106
98
:type '(radio (const :tag " Always" t )
107
99
(const :tag " Never" nil )
108
100
(const :tag " Yes, but truncate symbol names if it will\
109
- enable argument list to fit on one line" truncate-sym-name-if-fit))
110
- :group 'eldoc )
101
+ enable argument list to fit on one line" truncate-sym-name-if-fit)))
111
102
112
103
(defface eldoc-highlight-function-argument
113
104
'((t (:inherit bold )))
114
105
" Face used for the argument at point in a function's argument list.
115
106
Note that this face has no effect unless the `eldoc-documentation-function'
116
- handles it explicitly."
117
- :group 'eldoc )
107
+ handles it explicitly." )
118
108
119
109
; ;; No user options below here.
120
110
@@ -182,8 +172,7 @@ area displays information about a function or variable in the
182
172
text where point is. If point is on a documented variable, it
183
173
displays the first line of that variable's doc string. Otherwise
184
174
it displays the argument list of the function called in the
185
- expression point is on."
186
- :group 'eldoc :lighter eldoc-minor-mode-string
175
+ expression point is on." :lighter eldoc-minor-mode-string
187
176
(setq eldoc-last-message nil )
188
177
(cond
189
178
((not (eldoc--supported-p ))
@@ -193,19 +182,18 @@ expression point is on."
193
182
(eldoc-mode
194
183
(when eldoc-print-after-edit
195
184
(setq-local eldoc-message-commands (eldoc-edit-message-commands )))
196
- (add-hook 'post-command-hook 'eldoc-schedule-timer nil t )
197
- (add-hook 'pre-command-hook 'eldoc-pre-command-refresh-echo-area nil t ))
185
+ (add-hook 'post-command-hook # 'eldoc-schedule-timer nil t )
186
+ (add-hook 'pre-command-hook # 'eldoc-pre-command-refresh-echo-area nil t ))
198
187
(t
199
188
(kill-local-variable 'eldoc-message-commands )
200
- (remove-hook 'post-command-hook 'eldoc-schedule-timer t )
201
- (remove-hook 'pre-command-hook 'eldoc-pre-command-refresh-echo-area t )
189
+ (remove-hook 'post-command-hook # 'eldoc-schedule-timer t )
190
+ (remove-hook 'pre-command-hook # 'eldoc-pre-command-refresh-echo-area t )
202
191
(when eldoc-timer
203
192
(cancel-timer eldoc-timer)
204
193
(setq eldoc-timer nil )))))
205
194
206
195
;;;### autoload
207
196
(define-globalized-minor-mode global-eldoc-mode eldoc-mode turn-on-eldoc-mode
208
- :group 'eldoc
209
197
:initialize 'custom-initialize-delay
210
198
:init-value t
211
199
; ; For `read--expression' , the usual global mode mechanism of
@@ -284,17 +272,15 @@ Otherwise work like `message'."
284
272
(when (stringp format-string)
285
273
(apply #'format-message format-string args)))
286
274
(force-mode-line-update )))
287
- (apply 'message format-string args)))
275
+ (apply # 'message format-string args)))
288
276
289
277
(defun eldoc-message (&optional string )
290
278
" Display STRING as an ElDoc message if it's non-nil.
291
279
292
280
Also store it in `eldoc-last-message' and return that value."
293
281
(let ((omessage eldoc-last-message))
294
282
(setq eldoc-last-message string)
295
- ; ; In emacs 19.29 and later, and XEmacs 19.13 and later, all messages
296
- ; ; are recorded in a log. Do not put eldoc messages in that log since
297
- ; ; they are Legion.
283
+ ; ; Do not put eldoc messages in the log since they are Legion.
298
284
; ; Emacs way of preventing log messages.
299
285
(let ((message-log-max nil ))
300
286
(cond (eldoc-last-message
@@ -307,12 +293,15 @@ Also store it in `eldoc-last-message' and return that value."
307
293
(and (symbolp command)
308
294
(intern-soft (symbol-name command) eldoc-message-commands)))
309
295
310
- ; ; This function goes on pre-command-hook for XEmacs or when using idle
311
- ; ; timers in Emacs. Motion commands clear the echo area for some reason,
296
+ ; ; This function goes on pre-command-hook.
297
+ ; ; Motion commands clear the echo area for some reason,
312
298
; ; which make eldoc messages flicker or disappear just before motion
313
299
; ; begins. This function reprints the last eldoc message immediately
314
300
; ; before the next command executes, which does away with the flicker.
315
301
; ; This doesn't seem to be required for Emacs 19.28 and earlier.
302
+ ; ; FIXME: The above comment suggests we don't really understand why
303
+ ; ; this is needed. Maybe it's not needed any more, but if it is
304
+ ; ; we should figure out why.
316
305
(defun eldoc-pre-command-refresh-echo-area ()
317
306
" Reprint `eldoc-last-message' in the echo area."
318
307
(and eldoc-last-message
@@ -385,7 +374,7 @@ Meant as a value for `eldoc-documentation-function'."
385
374
(defcustom eldoc-documentation-function #'eldoc-documentation-default
386
375
" Function to call to return doc string.
387
376
The function of no args should return a one-line string for displaying
388
- doc about a function etc. appropriate to the context around point.
377
+ doc about a function etc. appropriate to the context around point.
389
378
It should return nil if there's no doc appropriate for the context.
390
379
Typically doc is returned if point is on a function-like name or in its
391
380
arg list.
@@ -398,13 +387,21 @@ effect."
398
387
:type '(radio (function-item eldoc-documentation-default)
399
388
(function-item eldoc-documentation-compose)
400
389
(function :tag " Other function" ))
401
- :version " 28.1"
402
- :group 'eldoc )
390
+ :version " 28.1" )
403
391
404
392
(defun eldoc--supported-p ()
405
393
" Non-nil if an ElDoc function is set for this buffer."
406
394
(and (not (memq eldoc-documentation-function '(nil ignore)))
407
- eldoc-documentation-functions))
395
+ (or eldoc-documentation-functions
396
+ ; ; The old API had major modes set `eldoc-documentation-function'
397
+ ; ; to provide eldoc support. It's impossible now to determine
398
+ ; ; reliably whether the `eldoc-documentation-function' provides
399
+ ; ; eldoc support (as in the old API) or whether it just provides
400
+ ; ; a way to combine the results of the
401
+ ; ; `eldoc-documentation-functions' (as in the new API).
402
+ ; ; But at least if it's set buffer-locally it's a good hint that
403
+ ; ; there's some eldoc support in the current buffer.
404
+ (local-variable-p 'eldoc-documentation-function ))))
408
405
409
406
(defun eldoc-print-current-symbol-info ()
410
407
" Print the text produced by `eldoc-documentation-function' ."
0 commit comments