1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-09 15:50:21 +00:00

Make type hierarchy textual representation a table

* etc/syncdoc-type-hierarchy.el (syncdoc-make-type-table): New function.
(syncdoc-update-type-hierarchy): Make use of.
* doc/lispref/type_hierarchy.txt: Regenerate.
This commit is contained in:
Andrea Corallo 2024-02-19 17:40:04 +01:00
parent 24e8fceb96
commit 0393bfdc91
2 changed files with 42 additions and 152 deletions

View File

@ -1,147 +1,22 @@
+--------------------+
| bignum |
+--------------------+
|
|
v
+-------------+ +--------------------+ +----------------------+ +--------+
| fixnum | --> | integer | --> | integer-or-marker | <-- | marker |
+-------------+ +--------------------+ +----------------------+ +--------+
| | |
| | |
v | |
+-------------+ +--------------------+ | |
| float | --> | number | | |
+-------------+ +--------------------+ | |
| | |
| | |
v | |
+--------------------+ | | +------------------+ +--------------------+ +----------+ +--------+
| number-or-marker | <-----+----------------------------+ | tree-sitter-node | | tree-sitter-parser | | user-ptr | | window |
+--------------------+ | +------------------+ +--------------------+ +----------+ +--------+
| | | | | |
| | | | | |
v v v v v v
+-------------+ +-------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +----------------------------+
| font-entity | --> | | <-- | overlay |
+-------------+ | | +----------------------------+
+-------------+ | | +----------------------------+
| font-object | --> | | <-- | process |
+-------------+ | | +----------------------------+
+-------------+ | | +----------------------------+
| font-spec | --> | | <-- | structure |
+-------------+ | atom | +----------------------------+
+-------------+ | | +----------------------------+
| frame | --> | | <-- | terminal |
+-------------+ | | +----------------------------+
+-------------+ | | +----------------------------+
| hash-table | --> | | <-- | thread |
+-------------+ | | +----------------------------+
+-------------+ | | +----------------------------+
| mutex | --> | | <-- | tree-sitter-compiled-query |
+-------------+ +-------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +----------------------------+
| ^ ^ ^ ^ ^ ^ ^
| | | | | | | |
v | | | | | | |
+--------------------+ | +----------------------+ | | +--------+ +-------+ +---------+
+--------------------> | t | | | window-configuration | | | | buffer | | class | | condvar |
| +--------------------+ | +----------------------+ | | +--------+ +-------+ +---------+
| +--------------------+ | | |
| | byte-code-function | | | |
| +--------------------+ | | |
| | | | |
| | | | |
| v | | |
| +--------------------+ | | |
| | compiled-function | | | |
| +--------------------+ | | |
| | | | |
| | | | |
| v | | |
| +--------------------+ | | |
| +> | function | -+ | |
| | +--------------------+ | |
| | ^ | |
| | +--------------------------------------------------+--------------+------------------------+
| | | | |
| | +--------------------+ | | |
| | | subr-primitive | | | |
| | +--------------------+ | | |
| | | | | |
| | | | | |
| | v | | |
| | +--------------------+ | | |
| +- | subr | <-----------------------------+----+ | |
| +--------------------+ | | | |
| +--------------------+ | | | |
| | keyword | -+ | | | |
| +--------------------+ | | | | |
| | | | | | |
| | | | | | |
| v | | | | |
| +--------------------+ | | | | |
| | symbol-with-pos | | | | | |
| +--------------------+ | | | | |
| | | | | | |
| | +----+ | | | |
| v | | | | |
| +--------------------+ | | | | |
| +> | symbol | ------+-----------------------+ | | |
| | +--------------------+ | | | |
| | ^ | | | |
| | +--------------------------+ | | |
| | | | |
| | +--------------------+ | | |
| | | null | -+ | | |
| | +--------------------+ | | | |
| | | | | | |
| | | | | | |
| | v | | | |
| | +--------------------+ | | | |
| +- | boolean | | | | |
| +--------------------+ | | | |
| +--------------------+ | | | |
| | cons | | | | |
| +--------------------+ | | | |
| | | | | |
| | | | | |
| v | | | |
| +--------------------+ | | | |
| | list | <+ | | |
| +--------------------+ | | |
| | | | |
| | | | |
| v | | |
| +--------------------+ | | |
+--------------------- | sequence | | | |
+--------------------+ | | |
^ | | |
+------------------------+ | | |
| | | |
| +--------------------+ | | |
| | subr-native-elisp | -----------------------------------+ | |
| +--------------------+ | |
| | |
| +-------------------------------------------+ |
| | |
| +--------------------+ | |
| | bool-vector | | |
| +--------------------+ | |
| | | |
| | | |
| v | |
| +-------------+ +-------------------------------------------------+ |
| | string | --> | array | |
| +-------------+ +-------------------------------------------------+ |
| ^ | ^ |
| | | | |
| | | | |
| +--------------------+ | +----------------------+ |
| | vector | | | char-table | |
| +--------------------+ | +----------------------+ |
| | |
+----------------------------------------------+ |
|
+--------------------+ |
| module-function | ----------------------------------------------------------------------+
+--------------------+
| Type | Derived Types |
|-------------------+----------------------------------------------------------|
| t | sequence atom |
| sequence | list array |
| atom | class structure tree-sitter-compiled-query |
| | tree-sitter-node tree-sitter-parser user-ptr font-object |
| | font-entity font-spec condvar mutex thread terminal |
| | hash-table frame buffer function window process |
| | window-configuration overlay integer-or-marker |
| | number-or-marker symbol array |
| number | float integer |
| number-or-marker | marker number |
| integer | bignum fixnum |
| symbol | keyword boolean symbol-with-pos |
| array | vector bool-vector char-table string |
| list | null cons |
| integer-or-marker | integer marker |
| compiled-function | byte-code-function |
| function | subr module-function compiled-function |
| boolean | null |
| subr | subr-native-elisp subr-primitive |
| symbol-with-pos | keyword |

View File

@ -35,6 +35,7 @@
;;; Code:
(require 'cl-lib)
(require 'org-table)
(eval-and-compile
(defconst syncdoc-lispref-dir (concat (file-name-directory
@ -55,6 +56,23 @@
(goto-char (point-max))
(insert "}\n"))
(defun syncdoc-make-type-table (file)
(with-temp-file file
(insert "|Type| Derived Types|\n|-\n")
(cl-loop for (type . children) in cl--type-hierarchy
do (insert "|" (symbol-name type) " |")
do (cl-loop with x = 0
for child in children
for child-len = (length (symbol-name child))
when (> (+ x child-len 2) 60)
do (progn
(insert "|\n||")
(setq x 0))
do (insert (symbol-name child) " ")
do (cl-incf x (1+ child-len)) )
do (insert "\n"))
(org-table-align)))
(defun syncdoc-update-type-hierarchy ()
"Update the type hierarchy representation used by the elisp manual."
(interactive)
@ -63,10 +81,7 @@
(call-process-region nil nil "dot" t (current-buffer) nil "-Tjpg" "-o"
(expand-file-name "type_hierarchy.jpg"
syncdoc-lispref-dir)))
(with-temp-buffer
(syncdoc-insert-dot-content "TB")
(call-process-region nil nil "graph-easy" t (current-buffer) nil "--output"
(expand-file-name "type_hierarchy.txt"
syncdoc-lispref-dir))))
(syncdoc-make-type-table (expand-file-name "type_hierarchy.txt"
syncdoc-lispref-dir)))
;;; syncdoc-type-hierarchy.el ends here