summaryrefslogtreecommitdiff
path: root/admin
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2024-03-10 15:12:00 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2024-03-10 15:12:00 -0400
commitc17ecd2dcd27b73d673df51ce66f4b188afff6db (patch)
treea9b07861656d159b100cb1b26c3770dd7f146429 /admin
parent2fdb281a276af57c104008d68ae95c7f4b1c3da8 (diff)
downloademacs-c17ecd2dcd27b73d673df51ce66f4b188afff6db.tar.gz
syncdoc-type-hierarchy.el: Sort and remove `comp` dependency
* admin/syncdoc-type-hierarchy.el: Delay loading `org-table` so as not to "pollute" the table with Org-specific types. (syncdoc-all-types): Sort the types topologically from the root. (syncdoc-hierarchy): Use `cl--class-parents` instead if `comp--direct-supertypes` so we don't depend on `comp-cstr`. (syncdoc-make-type-table): Sort the table so supertypes always come before their subtypes. (syncdoc-make-type-table): Require `org-table` here. * doc/lispref/elisp_type_hierarchy.jpg: * doc/lispref/elisp_type_hierarchy.txt: Refresh.
Diffstat (limited to 'admin')
-rw-r--r--admin/syncdoc-type-hierarchy.el26
1 files changed, 17 insertions, 9 deletions
diff --git a/admin/syncdoc-type-hierarchy.el b/admin/syncdoc-type-hierarchy.el
index e14d7fb54e1..bfbbbc45aa4 100644
--- a/admin/syncdoc-type-hierarchy.el
+++ b/admin/syncdoc-type-hierarchy.el
@@ -35,7 +35,6 @@
;;; Code:
(require 'cl-lib)
-(require 'org-table)
(defconst syncdoc-file (or (macroexp-file-name) buffer-file-name))
@@ -51,21 +50,24 @@
(when (cl-find-class type)
(push type res)))
obarray)
- res)
+ (nreverse
+ (merge-ordered-lists
+ (sort
+ (mapcar (lambda (type) (cl--class-allparents (cl-find-class type)))
+ res)
+ (lambda (ts1 ts2) (> (length ts1) (length ts2)))))))
"List of all types.")
-(declare-function 'comp--direct-supertypes "comp-cstr.el")
-
(defconst syncdoc-hierarchy
(progn
;; Require it here so we don't load it before `syncdoc-all-types' is
;; computed.
- (require 'comp-cstr)
(cl-loop
- with comp-ctxt = (make-comp-cstr-ctxt)
with h = (make-hash-table :test #'eq)
for type in syncdoc-all-types
- do (puthash type (comp--direct-supertypes type) h)
+ do (puthash type (mapcar #'cl--class-name
+ (cl--class-parents (cl-find-class type)))
+ h)
finally return h)))
(defun syncdoc-insert-dot-content (rankdir)
@@ -90,10 +92,14 @@
(dolist (parent parents)
(push type (alist-get parent subtypes))))
syncdoc-hierarchy)
- (cl-loop for (type . children) in (reverse subtypes)
+ (sort subtypes
+ (lambda (x1 x2)
+ (< (length (memq (car x2) syncdoc-all-types))
+ (length (memq (car x1) syncdoc-all-types)))))
+ (cl-loop for (type . children) in subtypes
do (insert "|" (symbol-name type) " |")
do (cl-loop with x = 0
- for child in (reverse children)
+ for child in children
for child-len = (length (symbol-name child))
when (> (+ x child-len 2) 60)
do (progn
@@ -102,6 +108,8 @@
do (insert (symbol-name child) " ")
do (cl-incf x (1+ child-len)) )
do (insert "\n")))
+ (require 'org-table)
+ (declare-function 'org-table-align "org")
(org-table-align)))
(defun syncdoc-update-type-hierarchy0 ()