summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2021-06-24 20:24:43 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2021-06-24 20:24:43 +0200
commitb188861af403aa0da0fefc3a8bf73c9380297e4e (patch)
tree933fc86b4923a513b90af61ceb363c49408dc1ad /lisp/emacs-lisp
parentbf21aba533864bf0179b2e76f4bdc2e7c6cce726 (diff)
downloademacs-b188861af403aa0da0fefc3a8bf73c9380297e4e.tar.gz
emacs-b188861af403aa0da0fefc3a8bf73c9380297e4e.tar.bz2
emacs-b188861af403aa0da0fefc3a8bf73c9380297e4e.zip
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.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/cl-extra.el11
-rw-r--r--lisp/emacs-lisp/subr-x.el1
2 files changed, 8 insertions, 4 deletions
diff --git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el
index 13036544825..c30349de6bb 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 1c13c398dde..468d124c0e2 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."