[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/inspector 1f659d04a6 34/93: Functions inspector
From: |
ELPA Syncer |
Subject: |
[elpa] externals/inspector 1f659d04a6 34/93: Functions inspector |
Date: |
Tue, 24 May 2022 18:57:57 -0400 (EDT) |
branch: externals/inspector
commit 1f659d04a622460e52e6e698895f58c6b57bc5c9
Author: Mariano Montone <marianomontone@gmail.com>
Commit: Mariano Montone <marianomontone@gmail.com>
Functions inspector
---
inspector.el | 64 ++++++++++++++++++++++++++++++++++++------------------------
1 file changed, 38 insertions(+), 26 deletions(-)
diff --git a/inspector.el b/inspector.el
index d27e4367af..6126fa6e21 100644
--- a/inspector.el
+++ b/inspector.el
@@ -42,16 +42,16 @@
(let ((expected t))
(and (cl-evenp (length list))
(cl-every (lambda (x)
- (setq expected (if (eql expected t) 'symbol t))
- (cl-typep x expected))
- list))))
+ (setq expected (if (eql expected t) 'symbol t))
+ (cl-typep x expected))
+ list))))
(defun alistp (list)
"Return T if LIST is an association list."
(cl-every (lambda (x)
- (and (consp x)
- (symbolp (car x))))
- list))
+ (and (consp x)
+ (symbolp (car x))))
+ list))
(defun alist-to-plist (alist)
"Convert association list ALIST to a property list."
@@ -87,12 +87,12 @@
:group 'inspector)
(defface inspector-value-face
- '((t (:inherit font-lock-builtin-face)))
+ '((t (:inherit font-lock-builtin-face)))
"Face for things which can themselves be inspected."
:group 'inspector)
(defface inspector-action-face
- '((t (:inherit font-lock-warning-face)))
+ '((t (:inherit font-lock-warning-face)))
"Face for labels of inspector actions."
:group 'inspector)
@@ -106,6 +106,11 @@
:type 'integer
:group 'inspector)
+(defcustom inspector-show-documentation t
+ "Whether to show variables and function documentation or not."
+ :type 'boolean
+ :group 'inspector)
+
;;-------- Inspector code -------------------
(defvar-local inspector-history nil
@@ -136,8 +141,8 @@
(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))
+ (or end-column inspector-end-column)
+ nil nil t))
(defun inspector--insert-inspect-button (object &optional label)
"Insert button for inspecting OBJECT.
@@ -145,7 +150,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))
(inspector--print-truncated object))
'action (lambda (btn)
- (ignore btn)
+ (ignore btn)
(inspector-inspect object t))
'follow-link t))
@@ -207,7 +212,7 @@ If LABEL has a value, then it is used as button label.
Otherwise, button label
(newline)
(inspector--insert-horizontal-line)
(newline)
- (insert "Slot values:")
+ (inspector--insert-label "Slot values")
(newline)
(dolist (slot (eieio-class-slots (eieio-object-class object)))
(insert (format "%s: " (cl--slot-descriptor-name slot)))
@@ -216,13 +221,20 @@ If LABEL has a value, then it is used as button label.
Otherwise, button label
(newline)))
((cl-struct-p object)
(inspector--insert-title (format "%s struct" (type-of object)))
- (insert "Slot values:")
+ (inspector--insert-label "Slot values")
(newline)
(dolist (slot (cdr (cl-struct-slot-info (type-of object))))
(insert (format "%s: " (car slot)))
(inspector--insert-inspect-button
(cl-struct-slot-value (type-of object) (car slot) object))
(newline)))
+ ((functionp object)
+ (inspector--insert-title "Function")
+ (inspector--insert-label "Name")
+ (inspector--insert-value (princ-to-string object))
+ (newline)
+ (inspector--insert-label "Arglist")
+ (inspector--insert-value (elisp-get-fnsym-args-string object)))
(t (error "Cannot inspect object: %s" object))))
(cl-defmethod inspect-object ((cons cons))
@@ -296,11 +308,11 @@ If LABEL has a value, then it is used as button label.
Otherwise, button label
(inspector--insert-label "Values")
(newline)
(maphash (lambda (key value)
- (inspector--insert-inspect-button key)
- (insert ": ")
- (inspector--insert-inspect-button value)
- (newline))
- hash-table))
+ (inspector--insert-inspect-button key)
+ (insert ": ")
+ (inspector--insert-inspect-button value)
+ (newline))
+ hash-table))
;;--- Buffers ------------------------------
@@ -360,8 +372,8 @@ When ADD-TO-HISTORY is T, OBJECT is added to inspector
history for navigation pu
"Inspect local variables of the frame at point in debugger backtrace."
(interactive)
(let* ((nframe (1+ (debugger-frame-number 'skip-base)))
- (base (debugger--backtrace-base))
- (locals (backtrace--locals nframe base)))
+ (base (debugger--backtrace-base))
+ (locals (backtrace--locals nframe base)))
(inspector-inspect (alist-to-plist locals))))
;;--------- Inspector mode ---------------------------------
@@ -377,12 +389,12 @@ When ADD-TO-HISTORY is T, OBJECT is added to inspector
history for navigation pu
map))
(easy-menu-define
- inspector-mode-menu inspector-mode-map
- "Menu for inspector."
- '("Inspector"
- ["Previous" inspector-pop :help "Inpect previous object"]
- ["Evaluate" eval-expression :help "Evaluate expression with current
inspected object as context"]
- ["Exit" inspector-quit :help "Quit the Emacs Lisp inspector"]))
+ inspector-mode-menu inspector-mode-map
+ "Menu for inspector."
+ '("Inspector"
+ ["Previous" inspector-pop :help "Inpect previous object"]
+ ["Evaluate" eval-expression :help "Evaluate expression with current
inspected object as context"]
+ ["Exit" inspector-quit :help "Quit the Emacs Lisp inspector"]))
(defvar inspector-tool-bar-map
(let ((map (make-sparse-keymap)))
- [elpa] externals/inspector e504625e80 26/93: Inspect structures, (continued)
- [elpa] externals/inspector e504625e80 26/93: Inspect structures, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector 440bd7a530 17/93: Housekeeping, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector d7f85a9c25 16/93: Inspect array, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector cfa57e310b 18/93: Better presentation functions, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector 4d409a6715 32/93: Evaluate in menu, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector edbd5c1318 37/93: Association list inspector and custom var to toggle specialized, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector 5d014ff023 39/93: Windows, frames, overlays, and buffers inspectors., ELPA Syncer, 2022/05/24
- [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 <=
- [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, 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