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.
This commit is contained in:
parent
2fdb281a27
commit
c17ecd2dcd
3 changed files with 50 additions and 42 deletions
|
@ -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 ()
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 338 KiB After Width: | Height: | Size: 282 KiB |
|
@ -1,33 +1,33 @@
|
|||
| Type | Derived Types |
|
||||
|---------------------+------------------------------------------------------------|
|
||||
| atom | mutex record font-spec frame number-or-marker |
|
||||
| | tree-sitter-compiled-query tree-sitter-node font-entity |
|
||||
| | tree-sitter-parser hash-table window-configuration |
|
||||
| | function user-ptr overlay array process font-object symbol |
|
||||
| | obarray condvar buffer terminal thread window |
|
||||
| | native-comp-unit |
|
||||
| cl-structure-object | xref-elisp-location org-cite-processor cl--generic-method |
|
||||
| | cl--random-state register-preview-info cl--generic |
|
||||
| | cl--class cl-slot-descriptor uniquify-item registerv |
|
||||
| | isearch--state cl--generic-generalizer lisp-indent-state |
|
||||
| t | sequence atom |
|
||||
| compiled-function | subr byte-code-function |
|
||||
| integer | fixnum bignum |
|
||||
| symbol | symbol-with-pos keyword boolean |
|
||||
| accessor | oclosure-accessor |
|
||||
| oclosure | advice cconv--interactive-helper advice--forward accessor |
|
||||
| | save-some-buffers-function cl--generic-nnm |
|
||||
| cons | ppss decoded-time |
|
||||
| cl--class | cl-structure-class oclosure--class built-in-class |
|
||||
| subr | subr-primitive subr-native-elisp |
|
||||
| array | string vector bool-vector char-table |
|
||||
| number | float integer |
|
||||
| number-or-marker | integer-or-marker number |
|
||||
| function | oclosure compiled-function interpreted-function |
|
||||
| | module-function |
|
||||
| sequence | list array |
|
||||
| integer-or-marker | integer marker |
|
||||
| boolean | null |
|
||||
| list | null cons |
|
||||
| record | cl-structure-object |
|
||||
| vector | timer |
|
||||
| Type | Derived Types |
|
||||
|---------------------+-----------------------------------------------------------|
|
||||
| t | sequence atom |
|
||||
| atom | number-or-marker array record symbol function |
|
||||
| | window-configuration font-object font-entity mutex |
|
||||
| | tree-sitter-node buffer overlay tree-sitter-parser thread |
|
||||
| | font-spec native-comp-unit tree-sitter-compiled-query |
|
||||
| | terminal window frame hash-table user-ptr obarray condvar |
|
||||
| | process |
|
||||
| sequence | array list |
|
||||
| list | null cons |
|
||||
| function | oclosure compiled-function module-function |
|
||||
| | interpreted-function |
|
||||
| symbol | boolean symbol-with-pos keyword |
|
||||
| compiled-function | subr byte-code-function |
|
||||
| oclosure | accessor advice--forward cconv--interactive-helper |
|
||||
| | cl--generic-nnm advice save-some-buffers-function |
|
||||
| record | cl-structure-object |
|
||||
| cl-structure-object | cl--class lisp-indent-state cl--random-state registerv |
|
||||
| | xref-elisp-location isearch--state cl-slot-descriptor |
|
||||
| | cl--generic-generalizer uniquify-item cl--generic-method |
|
||||
| | register-preview-info cl--generic |
|
||||
| cons | ppss decoded-time |
|
||||
| array | vector string char-table bool-vector |
|
||||
| number-or-marker | number integer-or-marker |
|
||||
| integer-or-marker | integer marker |
|
||||
| number | integer float |
|
||||
| cl--class | built-in-class cl-structure-class oclosure--class |
|
||||
| subr | subr-native-elisp subr-primitive |
|
||||
| accessor | oclosure-accessor |
|
||||
| vector | timer |
|
||||
| boolean | null |
|
||||
| integer | fixnum bignum |
|
||||
|
|
Loading…
Add table
Reference in a new issue