emacs-diffs
[Top][All Lists]
Advanced

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

master 3d2d7e8: Fix automatic filling of docstring in cl-defstruct


From: Stefan Kangas
Subject: master 3d2d7e8: Fix automatic filling of docstring in cl-defstruct
Date: Mon, 27 Sep 2021 05:48:02 -0400 (EDT)

branch: master
commit 3d2d7e8ea235a13543ed475836f8f7ea4c88520e
Author: Stefan Kangas <stefan@marxist.se>
Commit: Stefan Kangas <stefan@marxist.se>

    Fix automatic filling of docstring in cl-defstruct
    
    * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Fix bug where a paragraph
    was filled as if it were a single line, which led to garbled
    output in the docstring.  (Bug#50839)
    
    * test/lisp/subr-tests.el
    (subr-test-internal--format-docstring-line): New test.
---
 lisp/emacs-lisp/cl-macs.el |  8 ++++----
 test/lisp/subr-tests.el    | 12 ++++++++++++
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index 833c1d1..4e0e323 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -3080,12 +3080,12 @@ Supported keywords for slots are:
                            `(nth ,pos cl-x))))))
              (push slot slots)
              (push default-value defaults)
-             ;; The arg "cl-x" is referenced by name in eg pred-form
+              ;; The arg "cl-x" is referenced by name in e.g. pred-form
              ;; and pred-check, so changing it is not straightforward.
              (push `(,defsym ,accessor (cl-x)
-                       ,(internal--format-docstring-line
-                         "Access slot \"%s\" of `%s' struct CL-X.%s"
-                         slot name
+                       ,(concat
+                         (internal--format-docstring-line
+                          "Access slot \"%s\" of `%s' struct CL-X." slot name)
                          (if doc (concat "\n" doc) ""))
                        (declare (side-effect-free t))
                        ,access-body)
diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el
index 695da10..ed9a3d0 100644
--- a/test/lisp/subr-tests.el
+++ b/test/lisp/subr-tests.el
@@ -767,6 +767,18 @@ See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=19350.";
       (should-not (equal dir default-directory))
       (should (file-exists-p default-directory)))))
 
+(ert-deftest subr-test-internal--format-docstring-line ()
+  (should
+   (string= (let ((fill-column 60))
+              (internal--format-docstring-line
+               "Emacs is the advanced, extensible, customizable, \
+self-documenting editor.  This manual describes how to edit with Emacs and \
+some of the ways to customize it; it corresponds to GNU Emacs version 28.1."))
+            "Emacs is the advanced, extensible, customizable,
+self-documenting editor.  This manual describes how to edit
+with Emacs and some of the ways to customize it; it
+corresponds to GNU Emacs version 28.1.")))
+
 (ert-deftest test-ensure-list ()
   (should (equal (ensure-list nil) nil))
   (should (equal (ensure-list :foo) '(:foo)))



reply via email to

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