[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/inspector b1d60310da 73/93: Patch by Stefan Monnier
From: |
ELPA Syncer |
Subject: |
[elpa] externals/inspector b1d60310da 73/93: Patch by Stefan Monnier |
Date: |
Tue, 24 May 2022 18:58:01 -0400 (EDT) |
branch: externals/inspector
commit b1d60310da0b4fc794a7b86af1ba43e287d09db6
Author: Mariano Montone <marianomontone@gmail.com>
Commit: Mariano Montone <marianomontone@gmail.com>
Patch by Stefan Monnier
---
inspector.el | 51 ++++++++++++++++++++++++---------------------------
test.el | 9 +++++++--
2 files changed, 31 insertions(+), 29 deletions(-)
diff --git a/inspector.el b/inspector.el
index 9c36611556..02d980479b 100644
--- a/inspector.el
+++ b/inspector.el
@@ -159,18 +159,20 @@
(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."
+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 (inspector--princ-to-string label))
(inspector--print-truncated object))
- 'action (lambda (btn)
- (ignore btn)
+ 'action (lambda (_btn)
(inspector-inspect object t))
'follow-link t))
(defun inspector--do-with-slicer (slicer function)
"Use SLICER and call FUNCTION on the resulting slice.
SLICE should be a function that returns a slice of some data.
-FUNCTION is passed the resulting slice and a continuation function that when
called continues the consumption of slices of data, until there are no more
slices (the returned slice is NIL)."
+FUNCTION is passed the resulting slice and a continuation function that when
+called continues the consumption of slices of data, until there are no more
+slices (the returned slice is nil)."
(let ((slice (funcall slicer)))
(when slice
(funcall function slice
@@ -178,7 +180,8 @@ FUNCTION is passed the resulting slice and a continuation
function that when cal
(defun inspector--do-with-slicer-and-more-button (slicer function)
"Apply the SLICER function and apply FUNCTION to the resulting slice.
-When FUNCTION returns not NIL, adds a [More] button that inserts the next
slice in buffer."
+When FUNCTION returns non-nil, adds a [More] button that inserts the next
+slice in buffer."
(inspector--do-with-slicer
slicer
(lambda (slice cont)
@@ -186,8 +189,7 @@ When FUNCTION returns not NIL, adds a [More] button that
inserts the next slice
(when more-p
(insert-button "[more]"
'action (let ((pos (point)))
- (lambda (btn)
- (ignore btn)
+ (lambda (_btn)
(setq buffer-read-only nil)
(goto-char pos)
(delete-char (length "[More]"))
@@ -219,15 +221,13 @@ When FUNCTION returns not NIL, adds a [More] button that
inserts the next slice
(eieio-class-name subclass) (eieio-class-name subclass))
(insert " ")))
-(cl-defmethod inspect-object ((object (eql t)))
+(cl-defmethod inspect-object ((_object (eql t)))
"Render inspector buffer for boolean T."
- (ignore object)
(inspector--insert-title "boolean")
(insert "value: t"))
-(cl-defmethod inspect-object ((object (eql nil)))
- "Render inspector buffer for NIL object."
- (ignore object)
+(cl-defmethod inspect-object ((_object (eql nil)))
+ "Render inspector buffer for nil object."
(inspector--insert-title "nil")
(insert "value: nil"))
@@ -325,8 +325,7 @@ When FUNCTION returns not NIL, adds a [More] button that
inserts the next slice
(when (< i (length cons))
(cl-subseq cons i (min (cl-incf i inspector-slice-size)
(length cons)))))
- (lambda (slice cont)
- (ignore cont)
+ (lambda (slice _cont)
(dolist (cons slice)
(insert "(")
(inspector--insert-inspect-button (car cons))
@@ -348,8 +347,7 @@ When FUNCTION returns not NIL, adds a [More] button that
inserts the next slice
(when (< i (length cons))
(cl-subseq cons i (min (cl-incf i inspector-slice-size)
(length cons)))))
- (lambda (slice cont)
- (ignore cont)
+ (lambda (slice _cont)
(dolist (elem slice)
(insert (format "%d: " j))
(cl-incf j)
@@ -384,8 +382,7 @@ When FUNCTION returns not NIL, adds a [More] button that
inserts the next slice
(when (< i length)
(cons i (1- (min (cl-incf i inspector-slice-size)
length)))))
- (lambda (slice cont)
- (ignore cont)
+ (lambda (slice _cont)
(cl-loop for k from (car slice) to (cdr slice)
do
(insert (format "%d: " k))
@@ -489,8 +486,7 @@ When FUNCTION returns not NIL, adds a [More] button that
inserts the next slice
(when (< i (length keys))
(cl-subseq keys i (min (cl-incf i inspector-slice-size)
(length keys)))))
- (lambda (slice cont)
- (ignore cont)
+ (lambda (slice _cont)
(dolist (key slice)
(inspector--insert-inspect-button key)
(insert ": ")
@@ -522,9 +518,10 @@ When FUNCTION returns not NIL, adds a [More] button that
inserts the next slice
"Evaluate and inspect EXP expression."
(interactive (list (read--expression "Eval and inspect: ")))
- (inspector-inspect (eval exp)))
+ (inspector-inspect (eval exp t)))
(defun inspector--basic-inspect (object)
+ (defvar *)
(let ((buffer (inspector-make-inspector-buffer)))
(with-current-buffer buffer
(setq inspector-inspected-object object)
@@ -601,15 +598,15 @@ When PRESERVE-HISTORY is T, inspector history is not
cleared."
;;--------- Inspector mode ---------------------------------
;; Press letter 'i' in debugger backtrace to inspect locals.
-(define-key debugger-mode-map (kbd "i") 'debugger-inspect-frame-and-locals)
+(define-key debugger-mode-map (kbd "i") #'debugger-inspect-frame-and-locals)
(defvar inspector-mode-map
(let ((map (make-keymap)))
- (define-key map "q" 'inspector-quit)
- (define-key map "l" 'inspector-pop)
- (define-key map "e" 'eval-expression)
- (define-key map "n" 'forward-button)
- (define-key map "p" 'backward-button)
+ (define-key map "q" #'inspector-quit)
+ (define-key map "l" #'inspector-pop)
+ (define-key map "e" #'eval-expression)
+ (define-key map "n" #'forward-button)
+ (define-key map "p" #'backward-button)
map))
(easy-menu-define
diff --git a/test.el b/test.el
index 1b48b7b54d..0d0aa309c9 100644
--- a/test.el
+++ b/test.el
@@ -1,6 +1,11 @@
-;; Test inspector on all data types
+;; Test inspector on all data types -*- lexical-binding: t; -*-
;;
https://www.gnu.org/software/emacs/manual/html_node/elisp/Programming-Types.html
+;; FIXME: Add copyright&license blurbs.
+;; FIXME: Loading an ELisp file should not have any "visible" side effect.
+;; The best may to fix this here is likely to use `ert-deftest'.
+;; FIXME: Change the file's name to avoid clashes with other packages.
+
(require 'inspector)
(inspector-inspect 22)
@@ -74,5 +79,5 @@
(inspector-inspect (cl-loop for i from 1 to 101 collect (cons i (1+ i))))
(inspector-inspect (cl-loop for i from 1 to 101 collect (gensym) collect i))
-(inspector-inspect (apply 'vector (cl-loop for i from 1 to 1000 collect i)))
+(inspector-inspect (apply #'vector (cl-loop for i from 1 to 1000 collect i)))
- [elpa] externals/inspector 1e11bb1336 30/93: Evaluate expression with currently inspected object as context, (continued)
- [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
- [elpa] externals/inspector 6c071c67b3 60/93: Housekeeping, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector e7f2f13ff4 75/93: Start writing ert tests, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector b1d60310da 73/93: Patch by Stefan Monnier,
ELPA Syncer <=
- [elpa] externals/inspector 739890b5d6 70/93: Autoloads?, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector 477e363962 82/93: tests: no more side-effects, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector b10f60c20d 89/93: Fontification for each type of object, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector 6fadd6df9f 93/93: Create LICENSE, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector d5d286c5de 10/93: inspect-last-sexp command, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector 30d739e108 53/93: Slice arrays, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector a9e41424fa 66/93: Update README.md, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector 4b193ba6d0 69/93: Don't add [more] button when not needed, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector 2af90a4c82 83/93: tests: fixes, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector 57105aef34 72/93: Update README.md, ELPA Syncer, 2022/05/24