emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master b567c48 4/7: Don't redundantly cl-print arglist in


From: Noam Postavsky
Subject: [Emacs-diffs] master b567c48 4/7: Don't redundantly cl-print arglist in function docstring again
Date: Thu, 29 Jun 2017 19:47:47 -0400 (EDT)

branch: master
commit b567c48869b1484c6b1d263afc5cb67f22e99125
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>

    Don't redundantly cl-print arglist in function docstring again
    
    * lisp/emacs-lisp/cl-print.el (cl-print-object): Don't print arglist
    part of docstring.
    * test/lisp/emacs-lisp/cl-print-tests.el (cl-print-tests-1): Update
    test accordingly.
---
 lisp/emacs-lisp/cl-print.el            | 9 +++++----
 test/lisp/emacs-lisp/cl-print-tests.el | 2 +-
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/lisp/emacs-lisp/cl-print.el b/lisp/emacs-lisp/cl-print.el
index 89a71d1..824d0b7 100644
--- a/lisp/emacs-lisp/cl-print.el
+++ b/lisp/emacs-lisp/cl-print.el
@@ -105,10 +105,11 @@ into a button whose action shows the function's 
disassembly.")
     (if args
         (prin1 args stream)
       (princ "()" stream)))
-  (let ((doc (documentation object 'raw)))
-    (when doc
-      (princ " " stream)
-      (prin1 doc stream)))
+  (pcase (help-split-fundoc (documentation object 'raw) object)
+    ;; Drop args which `help-function-arglist' already printed.
+    (`(,_usage . ,(and doc (guard (stringp doc))))
+     (princ " " stream)
+     (prin1 doc stream)))
   (let ((inter (interactive-form object)))
     (when inter
       (princ " " stream)
diff --git a/test/lisp/emacs-lisp/cl-print-tests.el 
b/test/lisp/emacs-lisp/cl-print-tests.el
index dfbe18d..6448a1b 100644
--- a/test/lisp/emacs-lisp/cl-print-tests.el
+++ b/test/lisp/emacs-lisp/cl-print-tests.el
@@ -34,7 +34,7 @@
     (let ((print-circle t))
       (should (equal (cl-prin1-to-string `((x . ,x) (y . ,x)))
                      "((x . #1=#s(cl-print--test :a 1 :b 2)) (y . #1#))")))
-    (should (string-match "\\`#f(compiled-function (x) .*\n\n.*)\\'"
+    (should (string-match "\\`#f(compiled-function (x) \"[^\"]+\" [^\)]*)\\'"
                           (cl-prin1-to-string (symbol-function #'caar))))))
 
 (ert-deftest cl-print-tests-2 ()



reply via email to

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