[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/inspector f005f979f2 28/93: hash-table inspector
From: |
ELPA Syncer |
Subject: |
[elpa] externals/inspector f005f979f2 28/93: hash-table inspector |
Date: |
Tue, 24 May 2022 18:57:56 -0400 (EDT) |
branch: externals/inspector
commit f005f979f23f3b5597a1e935e72817bbc8e85e33
Author: Mariano Montone <marianomontone@gmail.com>
Commit: Mariano Montone <marianomontone@gmail.com>
hash-table inspector
---
inspector.el | 34 +++++++++++++++++++++++++++++-----
1 file changed, 29 insertions(+), 5 deletions(-)
diff --git a/inspector.el b/inspector.el
index c28899478d..a2c1573e33 100644
--- a/inspector.el
+++ b/inspector.el
@@ -3,8 +3,8 @@
;; Copyright (C) 2021 Mariano Montone
;; Author: Mariano Montone <marianomontone@gmail.com>
-;; URL: https://github.com/mmontone/slime-doc-contribs
-;; Keywords: help, lisp, slime, common-lisp
+;; URL: https://github.com/mmontone/emacs-inspector
+;; Keywords: debugging, tool, emacs-lisp, development
;; Version: 0.1
;; Package-Requires: ((emacs "25"))
@@ -152,12 +152,22 @@
(newline)))
(t (error "Cannot inspect object: %s" object))))
+(defcustom inspector-end-column 80
+ "Control print truncation size in inspector."
+ :type 'integer
+ :group 'inspector)
+
+(defun inspector--print-truncated (object &optional end-column)
+ "Print OBJECT truncated. END-COLUMN controls the truncation."
+ (truncate-string-to-width (prin1-to-string object)
+ (or end-column inspector-end-column)
+ nil nil t))
+
(defun inspector--insert-inspect-button (object &optional label)
"Insert button for inspecting OBJECT.
If LABEL has a value, then it is used as button label. Otherwise, button
label is the printed representation of OBJECT."
(insert-button (or (and label (princ-to-string label))
- (truncate-string-to-width
- (prin1-to-string object) 80 nil nil t))
+ (inspector--print-truncated object))
'action (lambda (btn)
(ignore btn)
(inspector-inspect object t))
@@ -224,7 +234,21 @@ If LABEL has a value, then it is used as button label.
Otherwise, button label
(princ (char-to-string integer) (current-buffer)))
(cl-defmethod inspect-object ((hash-table hash-table))
- (debug "Inspect hash-table"))
+ "Render inspector buffer for HASH-TABLEs."
+ (inspector--insert-title "Hash table")
+ (insert (inspector--print-truncated hash-table))
+ (newline)
+ (inspector--insert-property "Size")
+ (insert (princ-to-string (hash-table-size hash-table)))
+ (newline 2)
+ (inspector--insert-property "Values")
+ (newline)
+ (maphash (lambda (key value)
+ (inspector--insert-inspect-button key)
+ (insert ": ")
+ (inspector--insert-inspect-button value)
+ (newline))
+ hash-table))
(defun inspector-make-inspector-buffer ()
"Create an inspector buffer."
- [elpa] externals/inspector fa338ae5ed 90/93: Fontification adjustment, (continued)
- [elpa] externals/inspector fa338ae5ed 90/93: Fontification adjustment, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector e60478dc93 08/93: Linter, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector 53e8cc81c0 09/93: Minor mode and navigation, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector 4f9961f7bb 11/93: Truncate printed objects, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector 6f47c95ea2 21/93: README, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector c0269276bc 22/93: Update README.md, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector 37b54f480f 24/93: Screenshot, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector 3ccaee246c 13/93: Better debugger-inspect-locals, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector 77574c358f 25/93: el-get recipe, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector cd53047a49 27/93: Remove some of the warnings, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector f005f979f2 28/93: hash-table inspector,
ELPA Syncer <=
- [elpa] externals/inspector 5d9fbcc886 14/93: Use letter 'i' to inspect debugger stack frames, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector 75ac7da10e 29/93: Menu and tool bar, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector 1e11bb1336 30/93: Evaluate expression with currently inspected object as context, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector 701f65aacb 40/93: Inspect buffer contents, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector 37dc9503c8 42/93: .., ELPA Syncer, 2022/05/24
- [elpa] externals/inspector fdd7420b8d 43/93: More hash-table details, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector 2e23aeae84 48/93: Inspect finalizer type, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector cbb1d1cd2b 49/93: Some basic tests for elisp data types, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector 51257fb9b5 55/93: tests: overlays, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector 060da36d6f 58/93: Better quit behaviour, ELPA Syncer, 2022/05/24