[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/inspector 53e8cc81c0 09/93: Minor mode and navigation
From: |
ELPA Syncer |
Subject: |
[elpa] externals/inspector 53e8cc81c0 09/93: Minor mode and navigation |
Date: |
Tue, 24 May 2022 18:57:55 -0400 (EDT) |
branch: externals/inspector
commit 53e8cc81c014e8076441283b95432135bb7c61d7
Author: Mariano Montone <marianomontone@gmail.com>
Commit: Mariano Montone <marianomontone@gmail.com>
Minor mode and navigation
---
inspector.el | 35 ++++++++++++++++++++++++++++++-----
1 file changed, 30 insertions(+), 5 deletions(-)
diff --git a/inspector.el b/inspector.el
index e9e416c5bb..15282762d1 100644
--- a/inspector.el
+++ b/inspector.el
@@ -29,7 +29,14 @@
(symbolp (car x))))
list))
-(cl-defgeneric inspect-object (object))
+(defvar-local inspector-history nil
+ "The inspector buffer history.")
+
+(defvar-local inspector-inspected-object nil
+ "The current inspected object.")
+
+(cl-defgeneric inspect-object (object)
+ "Main generic interface for filling inspector buffers for the different
types of OBJECT.")
(cl-defmethod inspect-object ((class (subclass eieio-default-superclass)))
(insert (format "Class: %s" (eioio-class-name class)))
@@ -82,7 +89,7 @@ If LABEL has a value, then it is used as button label.
Otherwise, button label
(insert-button (or (and label (princ-to-string label))
(prin1-to-string object))
'action (lambda (btn)
- (inspector-inspect object))
+ (inspector-inspect object t))
'follow-link t))
(cl-defmethod inspect-object ((cons cons))
@@ -152,14 +159,30 @@ If LABEL has a value, then it is used as button label.
Otherwise, button label
(inspector-inspect (eval exp)))
-(defun inspector-inspect (object)
- "Top-level function for inspecting OBJECTs."
+(defun inspector-inspect (object &optional add-to-history)
+ "Top-level function for inspecting OBJECTs.
+When ADD-TO-HISTORY is T, OBJECT is added to inspector history for navigation
purposes."
(let ((buffer (inspector-make-inspector-buffer)))
(with-current-buffer buffer
+ (when add-to-history
+ (push inspector-inspected-object inspector-history))
+ (setq inspector-inspected-object object)
(inspect-object object)
(setq buffer-read-only t)
(display-buffer buffer))))
+(defun inspector-quit ()
+ "Quit the Emacs inspector."
+ (interactive)
+ (kill-buffer "*inspector*"))
+
+(defun inspector-pop ()
+ "Inspect previous object in inspector history."
+ (interactive)
+ (when inspector-history
+ (let ((object (pop inspector-history)))
+ (inspector-inspect object))))
+
(defgroup inspector nil
"Emacs Lisp inspector customizations."
:group 'lisp)
@@ -171,7 +194,9 @@ If LABEL has a value, then it is used as button label.
Otherwise, button label
(defvar inspector-mode-map
(let ((map (make-keymap)))
- (define-key map (kbd "q") 'inspector-quit)))
+ (define-key map (kbd "q") 'inspector-quit)
+ (define-key map (kbd "l") 'inspector-pop)
+ map))
(define-minor-mode inspector-mode
"Minor mode for inspector buffers."
- [elpa] externals/inspector e834de3e6d 03/93: Inspect classes, (continued)
- [elpa] externals/inspector e834de3e6d 03/93: Inspect classes, ELPA Syncer, 2022/05/24
- [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 <=
- [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, 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