diff options
| author | Stefan Kangas | 2021-09-27 11:26:31 +0200 |
|---|---|---|
| committer | Stefan Kangas | 2021-09-27 11:47:55 +0200 |
| commit | 3d2d7e8ea235a13543ed475836f8f7ea4c88520e (patch) | |
| tree | 59ac0734edf406cc50eff6cbbdd216049d56ca54 | |
| parent | 2403deca2bcffc62ff80e4c90a61fea1ea30a768 (diff) | |
| download | emacs-3d2d7e8ea235a13543ed475836f8f7ea4c88520e.tar.gz emacs-3d2d7e8ea235a13543ed475836f8f7ea4c88520e.zip | |
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.
| -rw-r--r-- | lisp/emacs-lisp/cl-macs.el | 8 | ||||
| -rw-r--r-- | 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 833c1d19737..4e0e323cfa1 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el | |||
| @@ -3080,12 +3080,12 @@ Supported keywords for slots are: | |||
| 3080 | `(nth ,pos cl-x)))))) | 3080 | `(nth ,pos cl-x)))))) |
| 3081 | (push slot slots) | 3081 | (push slot slots) |
| 3082 | (push default-value defaults) | 3082 | (push default-value defaults) |
| 3083 | ;; The arg "cl-x" is referenced by name in eg pred-form | 3083 | ;; The arg "cl-x" is referenced by name in e.g. pred-form |
| 3084 | ;; and pred-check, so changing it is not straightforward. | 3084 | ;; and pred-check, so changing it is not straightforward. |
| 3085 | (push `(,defsym ,accessor (cl-x) | 3085 | (push `(,defsym ,accessor (cl-x) |
| 3086 | ,(internal--format-docstring-line | 3086 | ,(concat |
| 3087 | "Access slot \"%s\" of `%s' struct CL-X.%s" | 3087 | (internal--format-docstring-line |
| 3088 | slot name | 3088 | "Access slot \"%s\" of `%s' struct CL-X." slot name) |
| 3089 | (if doc (concat "\n" doc) "")) | 3089 | (if doc (concat "\n" doc) "")) |
| 3090 | (declare (side-effect-free t)) | 3090 | (declare (side-effect-free t)) |
| 3091 | ,access-body) | 3091 | ,access-body) |
diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el index 695da10408e..ed9a3d01498 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." | |||
| 767 | (should-not (equal dir default-directory)) | 767 | (should-not (equal dir default-directory)) |
| 768 | (should (file-exists-p default-directory))))) | 768 | (should (file-exists-p default-directory))))) |
| 769 | 769 | ||
| 770 | (ert-deftest subr-test-internal--format-docstring-line () | ||
| 771 | (should | ||
| 772 | (string= (let ((fill-column 60)) | ||
| 773 | (internal--format-docstring-line | ||
| 774 | "Emacs is the advanced, extensible, customizable, \ | ||
| 775 | self-documenting editor. This manual describes how to edit with Emacs and \ | ||
| 776 | some of the ways to customize it; it corresponds to GNU Emacs version 28.1.")) | ||
| 777 | "Emacs is the advanced, extensible, customizable, | ||
| 778 | self-documenting editor. This manual describes how to edit | ||
| 779 | with Emacs and some of the ways to customize it; it | ||
| 780 | corresponds to GNU Emacs version 28.1."))) | ||
| 781 | |||
| 770 | (ert-deftest test-ensure-list () | 782 | (ert-deftest test-ensure-list () |
| 771 | (should (equal (ensure-list nil) nil)) | 783 | (should (equal (ensure-list nil) nil)) |
| 772 | (should (equal (ensure-list :foo) '(:foo))) | 784 | (should (equal (ensure-list :foo) '(:foo))) |