aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Gutov2016-07-18 02:22:24 +0300
committerDmitry Gutov2016-07-18 02:22:24 +0300
commit85b3eca57a5ae5335c11b157bb481cf8f7a35684 (patch)
treeac6a23e7598b83b6897638bb32ee1a4300b26e39
parent6dc0bafd5915b01a341cc0efbc744abd73163872 (diff)
downloademacs-85b3eca57a5ae5335c11b157bb481cf8f7a35684.tar.gz
emacs-85b3eca57a5ae5335c11b157bb481cf8f7a35684.zip
; Revert "Replace eldoc-documentation-function with a hook"
This reverts commit 5811404f0b86c9fa92c3e0b22505a9bb05f04145. It doesn't have the consensus, as evidenced by http://lists.gnu.org/archive/html/emacs-devel/2016-06/msg00138.html
-rw-r--r--doc/lispref/modes.texi2
-rw-r--r--etc/NEWS5
-rw-r--r--lisp/emacs-lisp/eldoc.el50
3 files changed, 19 insertions, 38 deletions
diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi
index 3dbfed06e2e..368d882a4b8 100644
--- a/doc/lispref/modes.texi
+++ b/doc/lispref/modes.texi
@@ -417,7 +417,7 @@ variable @code{imenu-generic-expression}, for the two variables
417 417
418@item 418@item
419The mode can specify a local value for 419The mode can specify a local value for
420@code{eldoc-documentation-functions} to tell ElDoc mode how to handle 420@code{eldoc-documentation-function} to tell ElDoc mode how to handle
421this mode. 421this mode.
422 422
423@item 423@item
diff --git a/etc/NEWS b/etc/NEWS
index c58349cd4ec..403a6b7ee36 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -265,11 +265,6 @@ viewing HTML files and the like.
265breakpoint (e.g. with "f" and "o") by customizing the new option 265breakpoint (e.g. with "f" and "o") by customizing the new option
266'edebug-sit-on-break'. 266'edebug-sit-on-break'.
267 267
268** ElDoc
269
270+++
271*** 'eldoc-documentation-functions' replaces 'eldoc-documentation-function'.
272
273** eww 268** eww
274 269
275+++ 270+++
diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
index 5cc16a86474..6c2f869f260 100644
--- a/lisp/emacs-lisp/eldoc.el
+++ b/lisp/emacs-lisp/eldoc.el
@@ -43,7 +43,7 @@
43 43
44;; Major modes for other languages may use ElDoc by defining an 44;; Major modes for other languages may use ElDoc by defining an
45;; appropriate function as the buffer-local value of 45;; appropriate function as the buffer-local value of
46;; `eldoc-documentation-functions'. 46;; `eldoc-documentation-function'.
47 47
48;;; Code: 48;;; Code:
49 49
@@ -80,7 +80,7 @@ Actually, any name of a function which takes a string as an argument and
80returns another string is acceptable. 80returns another string is acceptable.
81 81
82Note that this variable has no effect, unless 82Note that this variable has no effect, unless
83`eldoc-documentation-functions' handle it explicitly." 83`eldoc-documentation-function' handles it explicitly."
84 :type '(radio (function-item upcase) 84 :type '(radio (function-item upcase)
85 (function-item downcase) 85 (function-item downcase)
86 function) 86 function)
@@ -103,7 +103,7 @@ display in the echo area. Function or variable symbol name may be
103truncated to make more of the arglist or documentation string visible. 103truncated to make more of the arglist or documentation string visible.
104 104
105Note that this variable has no effect, unless 105Note that this variable has no effect, unless
106`eldoc-documentation-functions' handle it explicitly." 106`eldoc-documentation-function' handles it explicitly."
107 :type '(radio (const :tag "Always" t) 107 :type '(radio (const :tag "Always" t)
108 (const :tag "Never" nil) 108 (const :tag "Never" nil)
109 (const :tag "Yes, but truncate symbol names if it will\ 109 (const :tag "Yes, but truncate symbol names if it will\
@@ -113,8 +113,8 @@ Note that this variable has no effect, unless
113(defface eldoc-highlight-function-argument 113(defface eldoc-highlight-function-argument
114 '((t (:inherit bold))) 114 '((t (:inherit bold)))
115 "Face used for the argument at point in a function's argument list. 115 "Face used for the argument at point in a function's argument list.
116Note that this face has no effect unless the `eldoc-documentation-functions' 116Note that this face has no effect unless the `eldoc-documentation-function'
117handle it explicitly." 117handles it explicitly."
118 :group 'eldoc) 118 :group 'eldoc)
119 119
120;;; No user options below here. 120;;; No user options below here.
@@ -186,7 +186,7 @@ expression point is on."
186 :group 'eldoc :lighter eldoc-minor-mode-string 186 :group 'eldoc :lighter eldoc-minor-mode-string
187 (setq eldoc-last-message nil) 187 (setq eldoc-last-message nil)
188 (cond 188 (cond
189 ((not (eldoc-supported-p)) 189 ((memq eldoc-documentation-function '(nil ignore))
190 (message "There is no ElDoc support in this buffer") 190 (message "There is no ElDoc support in this buffer")
191 (setq eldoc-mode nil)) 191 (setq eldoc-mode nil))
192 (eldoc-mode 192 (eldoc-mode
@@ -211,7 +211,7 @@ the mode if ARG is omitted or nil, and toggle it if ARG is ‘toggle’.
211 211
212If Global Eldoc mode is on, `eldoc-mode' will be enabled in all 212If Global Eldoc mode is on, `eldoc-mode' will be enabled in all
213buffers where it's applicable. These are buffers that have modes 213buffers where it's applicable. These are buffers that have modes
214that have enabled eldoc support. See `eldoc-documentation-functions'." 214that have enabled eldoc support. See `eldoc-documentation-function'."
215 :group 'eldoc 215 :group 'eldoc
216 :global t 216 :global t
217 :initialize 'custom-initialize-delay 217 :initialize 'custom-initialize-delay
@@ -236,7 +236,9 @@ that have enabled eldoc support. See `eldoc-documentation-functions'."
236 eldoc-idle-delay nil 236 eldoc-idle-delay nil
237 (lambda () 237 (lambda ()
238 (when (or eldoc-mode 238 (when (or eldoc-mode
239 (and global-eldoc-mode (eldoc-supported-p))) 239 (and global-eldoc-mode
240 (not (memq eldoc-documentation-function
241 '(nil ignore)))))
240 (eldoc-print-current-symbol-info)))))) 242 (eldoc-print-current-symbol-info))))))
241 243
242 ;; If user has changed the idle delay, update the timer. 244 ;; If user has changed the idle delay, update the timer.
@@ -332,11 +334,10 @@ Otherwise work like `message'."
332 334
333 335
334;;;###autoload 336;;;###autoload
335(defvar eldoc-documentation-functions #'ignore 337(defvar eldoc-documentation-function #'ignore
336 "Hook to run to return doc string. 338 "Function to call to return doc string.
337A function in this hook should accept no args and return a 339The function of no args should return a one-line string for displaying
338one-line string for displaying documentation of a function, 340doc about a function etc. appropriate to the context around point.
339variable, etc. appropriate to the context around point.
340It should return nil if there's no doc appropriate for the context. 341It should return nil if there's no doc appropriate for the context.
341Typically doc is returned if point is on a function-like name or in its 342Typically doc is returned if point is on a function-like name or in its
342arg list. 343arg list.
@@ -346,15 +347,13 @@ the variables `eldoc-argument-case' and `eldoc-echo-area-use-multiline-p',
346and the face `eldoc-highlight-function-argument', if they are to have any 347and the face `eldoc-highlight-function-argument', if they are to have any
347effect. 348effect.
348 349
349Major modes should modify this variable using `add-hook', for example: 350Major modes should modify this variable using `add-function', for example:
350 (add-hook \\='eldoc-documentation-functions #\\='foo-eldoc nil t) 351 (add-function :before-until (local \\='eldoc-documentation-function)
352 #\\='foo-mode-eldoc-function)
351so that the global documentation function (i.e. the default value of the 353so that the global documentation function (i.e. the default value of the
352variable) is taken into account if the major mode specific function does not 354variable) is taken into account if the major mode specific function does not
353return any documentation.") 355return any documentation.")
354 356
355(define-obsolete-variable-alias 'eldoc-documentation-function
356 'eldoc-documentation-functions "25.2")
357
358(defun eldoc-print-current-symbol-info () 357(defun eldoc-print-current-symbol-info ()
359 ;; This is run from post-command-hook or some idle timer thing, 358 ;; This is run from post-command-hook or some idle timer thing,
360 ;; so we need to be careful that errors aren't ignored. 359 ;; so we need to be careful that errors aren't ignored.
@@ -364,20 +363,7 @@ return any documentation.")
364 (when eldoc-last-message 363 (when eldoc-last-message
365 (eldoc-message nil) 364 (eldoc-message nil)
366 nil)) 365 nil))
367 (eldoc-message 366 (eldoc-message (funcall eldoc-documentation-function)))))
368 (run-hook-with-args-until-success 'eldoc-documentation-functions)))))
369
370(defun eldoc-supported-p ()
371 "Return t if `eldoc-documentation-functions' has non-null elements."
372 (if (listp eldoc-documentation-functions)
373 (catch :eldoc-supported
374 (mapc
375 (lambda (fun)
376 (when (not (memq fun '(nil ignore)))
377 (throw :eldoc-supported t)))
378 eldoc-documentation-functions)
379 nil)
380 (not (memq eldoc-documentation-functions '(nil ignore)))))
381 367
382;; If the entire line cannot fit in the echo area, the symbol name may be 368;; If the entire line cannot fit in the echo area, the symbol name may be
383;; truncated or eliminated entirely from the output to make room for the 369;; truncated or eliminated entirely from the output to make room for the