[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/inspector 2c77eeb416 18/39: tree-inspector: plists
From: |
ELPA Syncer |
Subject: |
[elpa] externals/inspector 2c77eeb416 18/39: tree-inspector: plists |
Date: |
Sat, 10 Sep 2022 17:57:47 -0400 (EDT) |
branch: externals/inspector
commit 2c77eeb416a99e052bfba87bf54d7c9c1960d7bc
Author: Mariano Montone <marianomontone@gmail.com>
Commit: Mariano Montone <marianomontone@gmail.com>
tree-inspector: plists
---
tree-inspector-tests.el | 26 ++++++++++----------------
tree-inspector.el | 44 ++++++++++++++++++++++++++++++++++++++++----
2 files changed, 50 insertions(+), 20 deletions(-)
diff --git a/tree-inspector-tests.el b/tree-inspector-tests.el
index 6d7f7feb5c..6f9bf8595d 100644
--- a/tree-inspector-tests.el
+++ b/tree-inspector-tests.el
@@ -144,26 +144,20 @@
(should (cl-search "33" buffer-string))
(should (cl-search "44" buffer-string))))
-(ert-deftest inspector-tests--inspect-plist-test ()
- (inspector-inspect '(:a 33 :b 44))
- (let ((buffer-string (buffer-string)))
- (when inspector-use-specialized-inspectors-for-lists
- (should (cl-search "property list" buffer-string)))
- (should (cl-search "a" buffer-string))
- (should (cl-search "b" buffer-string))
- (should (cl-search "33" buffer-string))
- (should (cl-search "44" buffer-string))
- (inspector-quit))
+(ert-deftest tree-inspector-tests--inspect-plist-test ()
+ (tree-inspector-tests--with-tree-inspector-contents
+ (buffer-string '(:a 33 :b 44))
+ (should (cl-search "a" buffer-string))
+ (should (cl-search "b" buffer-string))
+ (should (cl-search "33" buffer-string))
+ (should (cl-search "44" buffer-string)))
- (inspector-inspect '(a 33 b 44))
- (let ((buffer-string (buffer-string)))
- (when inspector-use-specialized-inspectors-for-lists
- (should (cl-search "property list" buffer-string)))
+ (tree-inspector-tests--with-tree-inspector-contents
+ (buffer-string '(a 33 b 44))
(should (cl-search "a" buffer-string))
(should (cl-search "b" buffer-string))
(should (cl-search "33" buffer-string))
- (should (cl-search "44" buffer-string))
- (inspector-quit)))
+ (should (cl-search "44" buffer-string))))
(ert-deftest inspector-tests--inspect-hash-table-test ()
(inspector-inspect (let ((table (make-hash-table)))
diff --git a/tree-inspector.el b/tree-inspector.el
index 9ace580d48..62e1002d63 100644
--- a/tree-inspector.el
+++ b/tree-inspector.el
@@ -187,6 +187,20 @@ in a format understood by `kbd'. Commands a names of Lisp
functions."
(tree-inspector--make-node (cdr cons))))
child))
object))
+ ;; plists
+ ((and tree-inspector-use-specialized-inspectors-for-lists
+ (tree-inspector--plistp object))
+ (mapcar (lambda (cons)
+ (let ((child (treeview-new-node)))
+ (treeview-set-node-name
+ child (format "%s %s"
+ (tree-inspector--print-object (car cons))
+ (tree-inspector--print-object (cdr cons))))
+ (tree-inspector--set-node-children
+ child (list (tree-inspector--make-node (car cons))
+ (tree-inspector--make-node (cdr cons))))
+ child))
+ (cl--plist-to-alist object)))
;; proper lists
((tree-inspector--proper-list-p object)
(mapcar (lambda (item)
@@ -231,8 +245,8 @@ in a format understood by `kbd'. Commands a names of Lisp
functions."
(cl-defmethod tree-inspector--make-node ((object string))
(let ((node (treeview-new-node)))
- (treeview-set-node-name node
- (tree-inspector--print-object object))
+ (treeview-set-node-name
+ node (tree-inspector--print-object object))
node))
(cl-defmethod tree-inspector--make-node ((object cons))
@@ -260,8 +274,30 @@ in a format understood by `kbd'. Commands a names of Lisp
functions."
;; child))
;; object))
node))
- ;; proper lists
- ((tree-inspector--proper-list-p object)
+ ;; alists
+ ((and tree-inspector-use-specialized-inspectors-for-lists
+ (tree-inspector--alistp object))
+ (let ((node (treeview-new-node)))
+ (treeview-set-node-name
+ node
+ (tree-inspector--print-object object))
+ (treeview-set-node-prop node 'object object)
+ ;; (treeview-set-node-children
+ ;; node
+ ;; (mapcar (lambda (cons)
+ ;; (let ((child (treeview-new-node)))
+ ;; (treeview-set-node-name
+ ;; child (format "(%s . %s)"
+ ;; (tree-inspector--print-object (car cons))
+ ;; (tree-inspector--print-object (cdr
cons))))
+ ;; (treeview-set-node-children
+ ;; child (list (tree-inspector--make-node (car cons))
+ ;; (tree-inspector--make-node (cdr cons))))
+ ;; child))
+ ;; object))
+ node))
+ ;; plists
+ ((tree-inspector--plistp object)
(let ((node (treeview-new-node)))
(treeview-set-node-name
node (tree-inspector--print-object object))
- [elpa] externals/inspector b95e058a72 31/39: tree-inspector: docstrings, (continued)
- [elpa] externals/inspector b95e058a72 31/39: tree-inspector: docstrings, ELPA Syncer, 2022/09/10
- [elpa] externals/inspector 15da8e2052 32/39: tree-inspector: refactoring, ELPA Syncer, 2022/09/10
- [elpa] externals/inspector cc661085b1 34/39: Adjustments, ELPA Syncer, 2022/09/10
- [elpa] externals/inspector bc762c9359 38/39: tree-inspector: usage, ELPA Syncer, 2022/09/10
- [elpa] externals/inspector f71647ba51 37/39: Long description formatting, ELPA Syncer, 2022/09/10
- [elpa] externals/inspector 744b5e674d 33/39: tree-inspector: fix, ELPA Syncer, 2022/09/10
- [elpa] externals/inspector 54c5b61f2c 35/39: tree-inspector: package requires, ELPA Syncer, 2022/09/10
- [elpa] externals/inspector 0b213e931c 39/39: tree-inspector: adjustments, ELPA Syncer, 2022/09/10
- [elpa] externals/inspector b63e68fb50 08/39: tree-inspector: lazy children, ELPA Syncer, 2022/09/10
- [elpa] externals/inspector 09e5b1ce83 17/39: tests, ELPA Syncer, 2022/09/10
- [elpa] externals/inspector 2c77eeb416 18/39: tree-inspector: plists,
ELPA Syncer <=
- [elpa] externals/inspector 2b7721c678 25/39: tree-inspector: clos objects and structures inspectors, ELPA Syncer, 2022/09/10
- [elpa] externals/inspector e0905a94d3 29/39: tree-inspector: housekeeping, ELPA Syncer, 2022/09/10