[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/inspector 4f9961f7bb 11/93: Truncate printed objects
From: |
ELPA Syncer |
Subject: |
[elpa] externals/inspector 4f9961f7bb 11/93: Truncate printed objects |
Date: |
Tue, 24 May 2022 18:57:55 -0400 (EDT) |
branch: externals/inspector
commit 4f9961f7bbd37b9ea5ce4687b54a4d4d99c7991d
Author: Mariano Montone <marianomontone@gmail.com>
Commit: Mariano Montone <marianomontone@gmail.com>
Truncate printed objects
---
inspector.el | 36 +++++++++++++++++++++++++++---------
1 file changed, 27 insertions(+), 9 deletions(-)
diff --git a/inspector.el b/inspector.el
index cde232655b..687d351c78 100644
--- a/inspector.el
+++ b/inspector.el
@@ -29,6 +29,15 @@
(symbolp (car x))))
list))
+(defun inspector--proper-list-p (val)
+ "Is VAL a proper list?"
+ (if (fboundp 'format-proper-list-p)
+ ;; Emacs stable.
+ (with-no-warnings (format-proper-list-p val))
+ ;; Function was renamed in Emacs master:
+ ;;
http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=2fde6275b69fd113e78243790bf112bbdd2fe2bf
+ (with-no-warnings (proper-list-p val))))
+
(defvar-local inspector-history nil
"The inspector buffer history.")
@@ -58,13 +67,13 @@
(insert " ")))
(cl-defmethod inspect-object ((object (eql t)))
- (debug "True"))
+ (insert "Boolean: t"))
(cl-defmethod inspect-object ((object (eql nil)))
- (debug "Null"))
+ (insert "nil"))
(cl-defmethod inspect-object ((object symbol))
- (debug "Symbol"))
+ (insert (format "Symbol: %s" object)))
(cl-defmethod inspect-object ((object t))
(cond
@@ -87,14 +96,15 @@
"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))
- (prin1-to-string object))
+ (truncate-string-to-width
+ (prin1-to-string object) 80 nil nil t))
'action (lambda (btn)
- (inspector-inspect object t))
+ (inspector-inspect object t))
'follow-link t))
(cl-defmethod inspect-object ((cons cons))
(cond
- ((and (listp cons) (plistp cons))
+ ((and (inspector--proper-list-p cons) (plistp cons))
(insert "Property list: ")
(newline)
(let ((plist (copy-list cons)))
@@ -105,7 +115,7 @@ If LABEL has a value, then it is used as button label.
Otherwise, button label
(let ((value (pop plist)))
(inspector--insert-inspect-button value))
(newline))))
- ((listp cons)
+ ((inspector--proper-list-p cons)
(insert "Proper list:")
(newline)
(let ((i 0))
@@ -113,7 +123,15 @@ If LABEL has a value, then it is used as button label.
Otherwise, button label
(insert (format "%d: " i))
(inspector--insert-inspect-button elem)
(newline)
- (incf i))))))
+ (incf i))))
+ (t ;; It is a cons cell
+ (insert "Cons cell")
+ (newline 2)
+ (insert "CAR: ")
+ (inspector--insert-inspect-button (car cons))
+ (newline)
+ (insert "CDR:")
+ (inspector--insert-inspect-button (cdr cons)))))
(cl-defmethod inspect-object ((string string))
(insert "String: ")
@@ -165,7 +183,7 @@ When ADD-TO-HISTORY is T, OBJECT is added to inspector
history for navigation pu
(let ((buffer (inspector-make-inspector-buffer)))
(with-current-buffer buffer
(when add-to-history
- (push inspector-inspected-object inspector-history))
+ (push inspector-inspected-object inspector-history))
(setq inspector-inspected-object object)
(inspect-object object)
(setq buffer-read-only t)
- [elpa] externals/inspector b1035194b0 04/93: Integer printing, (continued)
- [elpa] externals/inspector b1035194b0 04/93: Integer printing, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector 55a4df0b45 12/93: debugger-inspect-locals, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector 1f659d04a6 34/93: Functions inspector, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector d1222593b5 36/93: Housekeeping, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector 505cd1b077 50/93: tests: classes and structs, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector 3a1f745658 56/93: Switch to inspector buffer when opened, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector b782644bbb 67/93: README: evaluate with inspected object, ELPA Syncer, 2022/05/24
- [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 <=
- [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, 2022/05/24
- [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