aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo Liu2014-03-31 09:31:17 +0800
committerLeo Liu2014-03-31 09:31:17 +0800
commit294b2b0928d7704915a480f43d1eb5c75fc35456 (patch)
tree8ac84ff9a5a99aa09564422b371cf261ea8e92b9
parent1db854ccdd81811709b10b6793730e0dd1960021 (diff)
downloademacs-294b2b0928d7704915a480f43d1eb5c75fc35456.tar.gz
emacs-294b2b0928d7704915a480f43d1eb5c75fc35456.zip
* emacs-lisp/eldoc.el (eldoc-print-current-symbol-info): Refactor
out eldoc-documentation-function-default. (eldoc-documentation-function-default): New function. (eldoc-documentation-function): Change value.
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/emacs-lisp/eldoc.el34
2 files changed, 23 insertions, 18 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index aae850d47a0..52a974fa21e 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12014-03-31 Leo Liu <sdl.web@gmail.com>
2
3 * emacs-lisp/eldoc.el (eldoc-print-current-symbol-info): Refactor
4 out eldoc-documentation-function-default.
5 (eldoc-documentation-function-default): New function.
6 (eldoc-documentation-function): Change value.
7
12014-03-31 Glenn Morris <rgm@gnu.org> 82014-03-31 Glenn Morris <rgm@gnu.org>
2 9
3 * simple.el (cycle-spacing--context, cycle-spacing): Doc tweaks. 10 * simple.el (cycle-spacing--context, cycle-spacing): Doc tweaks.
diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
index c64ec52decb..7102b5549eb 100644
--- a/lisp/emacs-lisp/eldoc.el
+++ b/lisp/emacs-lisp/eldoc.el
@@ -298,8 +298,8 @@ Otherwise work like `message'."
298 298
299 299
300;;;###autoload 300;;;###autoload
301(defvar eldoc-documentation-function nil 301(defvar eldoc-documentation-function #'eldoc-documentation-function-default
302 "If non-nil, function to call to return doc string. 302 "Function to call to return doc string.
303The function of no args should return a one-line string for displaying 303The function of no args should return a one-line string for displaying
304doc about a function etc. appropriate to the context around point. 304doc about a function etc. appropriate to the context around point.
305It should return nil if there's no doc appropriate for the context. 305It should return nil if there's no doc appropriate for the context.
@@ -323,22 +323,20 @@ Emacs Lisp mode) that support ElDoc.")
323 (when eldoc-last-message 323 (when eldoc-last-message
324 (eldoc-message nil) 324 (eldoc-message nil)
325 nil)) 325 nil))
326 (if eldoc-documentation-function 326 (eldoc-message (funcall eldoc-documentation-function)))))
327 (eldoc-message (funcall eldoc-documentation-function)) 327
328 (let* ((current-symbol (eldoc-current-symbol)) 328(defun eldoc-documentation-function-default ()
329 (current-fnsym (eldoc-fnsym-in-current-sexp)) 329 "Default value for `eldoc-documentation-function' (which see)."
330 (doc (cond 330 (let ((current-symbol (eldoc-current-symbol))
331 ((null current-fnsym) 331 (current-fnsym (eldoc-fnsym-in-current-sexp)))
332 nil) 332 (cond ((null current-fnsym)
333 ((eq current-symbol (car current-fnsym)) 333 nil)
334 (or (apply 'eldoc-get-fnsym-args-string 334 ((eq current-symbol (car current-fnsym))
335 current-fnsym) 335 (or (apply #'eldoc-get-fnsym-args-string current-fnsym)
336 (eldoc-get-var-docstring current-symbol))) 336 (eldoc-get-var-docstring current-symbol)))
337 (t 337 (t
338 (or (eldoc-get-var-docstring current-symbol) 338 (or (eldoc-get-var-docstring current-symbol)
339 (apply 'eldoc-get-fnsym-args-string 339 (apply #'eldoc-get-fnsym-args-string current-fnsym))))))
340 current-fnsym))))))
341 (eldoc-message doc))))))
342 340
343(defun eldoc-get-fnsym-args-string (sym &optional index) 341(defun eldoc-get-fnsym-args-string (sym &optional index)
344 "Return a string containing the parameter list of the function SYM. 342 "Return a string containing the parameter list of the function SYM.