3232; ; the one-line documentation for that variable instead, to remind you of
3333; ; that variable's meaning.
3434
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' .
4238
4339; ; Major modes for other languages may use ElDoc by adding an
4440; ; 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
5753last input, no documentation will be printed.
5854
5955If this variable is set to 0, no idle time is required."
60- :type 'number
61- :group 'eldoc )
56+ :type 'number )
6257
6358(defcustom eldoc-print-after-edit nil
6459 " If non-nil eldoc info is only shown when editing.
6560Changing the value requires toggling `eldoc-mode' ."
66- :type 'boolean
67- :group 'eldoc )
61+ :type 'boolean )
6862
6963;;;### autoload
7064(defcustom eldoc-minor-mode-string (purecopy " ElDoc" )
7165 " 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 )))
7467
7568(defcustom eldoc-argument-case #'identity
7669 " Case to display argument names of functions, as a symbol.
@@ -82,8 +75,7 @@ Note that this variable has no effect, unless
8275`eldoc-documentation-function' handles it explicitly."
8376 :type '(radio (function-item upcase)
8477 (function-item downcase)
85- function)
86- :group 'eldoc )
78+ function))
8779(make-obsolete-variable 'eldoc-argument-case nil " 25.1" )
8880
8981(defcustom eldoc-echo-area-use-multiline-p 'truncate-sym-name-if-fit
@@ -106,15 +98,13 @@ Note that this variable has no effect, unless
10698 :type '(radio (const :tag " Always" t )
10799 (const :tag " Never" nil )
108100 (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)))
111102
112103(defface eldoc-highlight-function-argument
113104 '((t (:inherit bold )))
114105 " Face used for the argument at point in a function's argument list.
115106Note that this face has no effect unless the `eldoc-documentation-function'
116- handles it explicitly."
117- :group 'eldoc )
107+ handles it explicitly." )
118108
119109; ;; No user options below here.
120110
@@ -182,8 +172,7 @@ area displays information about a function or variable in the
182172text where point is. If point is on a documented variable, it
183173displays the first line of that variable's doc string. Otherwise
184174it 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
187176 (setq eldoc-last-message nil )
188177 (cond
189178 ((not (eldoc--supported-p ))
@@ -193,19 +182,18 @@ expression point is on."
193182 (eldoc-mode
194183 (when eldoc-print-after-edit
195184 (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 ))
198187 (t
199188 (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 )
202191 (when eldoc-timer
203192 (cancel-timer eldoc-timer)
204193 (setq eldoc-timer nil )))))
205194
206195;;;### autoload
207196(define-globalized-minor-mode global-eldoc-mode eldoc-mode turn-on-eldoc-mode
208- :group 'eldoc
209197 :initialize 'custom-initialize-delay
210198 :init-value t
211199 ; ; For `read--expression' , the usual global mode mechanism of
@@ -284,17 +272,15 @@ Otherwise work like `message'."
284272 (when (stringp format-string)
285273 (apply #'format-message format-string args)))
286274 (force-mode-line-update )))
287- (apply 'message format-string args)))
275+ (apply # 'message format-string args)))
288276
289277(defun eldoc-message (&optional string )
290278 " Display STRING as an ElDoc message if it's non-nil.
291279
292280Also store it in `eldoc-last-message' and return that value."
293281 (let ((omessage eldoc-last-message))
294282 (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.
298284 ; ; Emacs way of preventing log messages.
299285 (let ((message-log-max nil ))
300286 (cond (eldoc-last-message
@@ -307,12 +293,15 @@ Also store it in `eldoc-last-message' and return that value."
307293 (and (symbolp command)
308294 (intern-soft (symbol-name command) eldoc-message-commands)))
309295
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,
312298; ; which make eldoc messages flicker or disappear just before motion
313299; ; begins. This function reprints the last eldoc message immediately
314300; ; before the next command executes, which does away with the flicker.
315301; ; 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.
316305(defun eldoc-pre-command-refresh-echo-area ()
317306 " Reprint `eldoc-last-message' in the echo area."
318307 (and eldoc-last-message
@@ -385,7 +374,7 @@ Meant as a value for `eldoc-documentation-function'."
385374(defcustom eldoc-documentation-function #'eldoc-documentation-default
386375 " Function to call to return doc string.
387376The 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.
389378It should return nil if there's no doc appropriate for the context.
390379Typically doc is returned if point is on a function-like name or in its
391380arg list.
@@ -398,13 +387,21 @@ effect."
398387 :type '(radio (function-item eldoc-documentation-default)
399388 (function-item eldoc-documentation-compose)
400389 (function :tag " Other function" ))
401- :version " 28.1"
402- :group 'eldoc )
390+ :version " 28.1" )
403391
404392(defun eldoc--supported-p ()
405393 " Non-nil if an ElDoc function is set for this buffer."
406394 (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 ))))
408405
409406(defun eldoc-print-current-symbol-info ()
410407 " Print the text produced by `eldoc-documentation-function' ."
0 commit comments