emacs-diffs
[Top][All Lists]
Advanced

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

master b188861: Attempt to make defclass documentation more legible


From: Lars Ingebrigtsen
Subject: master b188861: Attempt to make defclass documentation more legible
Date: Thu, 24 Jun 2021 14:24:54 -0400 (EDT)

branch: master
commit b188861af403aa0da0fefc3a8bf73c9380297e4e
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Attempt to make defclass documentation more legible
    
    * lisp/emacs-lisp/cl-extra.el (cl--print-table): Attempt to make
    defclass documentation more readable (bug#30998).
    (cl--describe-class-slots): Ditto.
---
 lisp/emacs-lisp/cl-extra.el | 11 +++++++----
 lisp/emacs-lisp/subr-x.el   |  1 +
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el
index 1303654..c30349d 100644
--- a/lisp/emacs-lisp/cl-extra.el
+++ b/lisp/emacs-lisp/cl-extra.el
@@ -847,7 +847,7 @@ PROPLIST is a list of the sort returned by `symbol-plist'.
               "\n")))
    "\n"))
 
-(defun cl--print-table (header rows)
+(defun cl--print-table (header rows &optional last-slot-on-next-line)
   ;; FIXME: Isn't this functionality already implemented elsewhere?
   (let ((cols (apply #'vector (mapcar #'string-width header)))
         (col-space 2))
@@ -877,7 +877,11 @@ PROPLIST is a list of the sort returned by `symbol-plist'.
                                header))
                 "\n")
         (dolist (row rows)
-          (insert (apply #'format format row) "\n"))))))
+          (insert (apply #'format format row) "\n")
+          (when last-slot-on-next-line
+            (dolist (line (string-lines (car (last row))))
+              (insert "    " line "\n"))
+            (insert "\n")))))))
 
 (defun cl--describe-class-slots (class)
   "Print help description for the slots in CLASS.
@@ -909,8 +913,7 @@ Outputs to the current buffer."
                          (setq has-doc t)
                          (substitute-command-keys doc)))))
              slots)))
-      (cl--print-table `("Name" "Type" "Default" . ,(if has-doc '("Doc")))
-                       slots-strings))
+      (cl--print-table `("Name" "Type" "Default") slots-strings has-doc))
     (insert "\n")
     (when (> (length cslots) 0)
       (insert (propertize "\nClass Allocated Slots:\n\n" 'face 'bold))
diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el
index 1c13c39..468d124 100644
--- a/lisp/emacs-lisp/subr-x.el
+++ b/lisp/emacs-lisp/subr-x.el
@@ -317,6 +317,7 @@ than this function."
      (end (substring string (- (length string) length)))
      (t (substring string 0 length)))))
 
+;;;###autoload
 (defun string-lines (string &optional omit-nulls)
   "Split STRING into a list of lines.
 If OMIT-NULLS, empty lines will be removed from the results."



reply via email to

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