emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r116913: * emacs-lisp/eldoc.el (eldoc-print-current-


From: Leo Liu
Subject: [Emacs-diffs] trunk r116913: * emacs-lisp/eldoc.el (eldoc-print-current-symbol-info): Refactor
Date: Mon, 31 Mar 2014 01:34:54 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 116913
revision-id: address@hidden
parent: address@hidden
committer: Leo Liu <address@hidden>
branch nick: trunk
timestamp: Mon 2014-03-31 09:31:17 +0800
message:
  * 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.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/emacs-lisp/eldoc.el       eldoc.el-20091113204419-o5vbwnq5f7feedwu-952
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-03-31 00:49:05 +0000
+++ b/lisp/ChangeLog    2014-03-31 01:31:17 +0000
@@ -1,3 +1,10 @@
+2014-03-31  Leo Liu  <address@hidden>
+
+       * 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.
+
 2014-03-31  Glenn Morris  <address@hidden>
 
        * simple.el (cycle-spacing--context, cycle-spacing): Doc tweaks.

=== modified file 'lisp/emacs-lisp/eldoc.el'
--- a/lisp/emacs-lisp/eldoc.el  2014-03-10 05:33:31 +0000
+++ b/lisp/emacs-lisp/eldoc.el  2014-03-31 01:31:17 +0000
@@ -298,8 +298,8 @@
 
 
 ;;;###autoload
-(defvar eldoc-documentation-function nil
-  "If non-nil, function to call to return doc string.
+(defvar eldoc-documentation-function #'eldoc-documentation-function-default
+  "Function to call to return doc string.
 The function of no args should return a one-line string for displaying
 doc about a function etc. appropriate to the context around point.
 It should return nil if there's no doc appropriate for the context.
@@ -323,22 +323,20 @@
              (when eldoc-last-message
                (eldoc-message nil)
                nil))
-        (if eldoc-documentation-function
-            (eldoc-message (funcall eldoc-documentation-function))
-          (let* ((current-symbol (eldoc-current-symbol))
-                 (current-fnsym  (eldoc-fnsym-in-current-sexp))
-                 (doc (cond
-                       ((null current-fnsym)
-                        nil)
-                       ((eq current-symbol (car current-fnsym))
-                        (or (apply 'eldoc-get-fnsym-args-string
-                                   current-fnsym)
-                            (eldoc-get-var-docstring current-symbol)))
-                       (t
-                        (or (eldoc-get-var-docstring current-symbol)
-                            (apply 'eldoc-get-fnsym-args-string
-                                   current-fnsym))))))
-            (eldoc-message doc))))))
+        (eldoc-message (funcall eldoc-documentation-function)))))
+
+(defun eldoc-documentation-function-default ()
+  "Default value for `eldoc-documentation-function' (which see)."
+  (let ((current-symbol (eldoc-current-symbol))
+       (current-fnsym  (eldoc-fnsym-in-current-sexp)))
+    (cond ((null current-fnsym)
+          nil)
+         ((eq current-symbol (car current-fnsym))
+          (or (apply #'eldoc-get-fnsym-args-string current-fnsym)
+              (eldoc-get-var-docstring current-symbol)))
+         (t
+          (or (eldoc-get-var-docstring current-symbol)
+              (apply #'eldoc-get-fnsym-args-string current-fnsym))))))
 
 (defun eldoc-get-fnsym-args-string (sym &optional index)
   "Return a string containing the parameter list of the function SYM.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]