emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Integrate my package into Emacs


From: Stefan Monnier
Subject: Re: Integrate my package into Emacs
Date: Mon, 25 Apr 2022 12:40:04 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Mariano Montone [2022-04-22 12:36:16] wrote:
> I've implemented an inspector tool for elisp, and I think it could be nice
> to integrate into Emacs distro.
>
> https://github.com/mmontone/emacs-inspector
>
> What do you think?

As a first step, I'd be happy to add it to GNU ELPA.

> What are the steps I'd need to follow for that?

The main thing is to sign the copyright paperwork, without which your
code can't be integrated in Emacs (nor in GNU ELPA).
To do that, please fill the form below and email it to the FSF as
instructed so they can send you the relevant paperwork to sign.

I also attached a patch resulting from my quick reading of your code.
Meant as much for reading as for applying (e.g. includes some
FIXMEs).


        Stefan


Please email the following information to assign@gnu.org, and we
will send you the assignment form for your past and future changes.

Please use your full legal name (in ASCII characters) as the subject
line of the message.
----------------------------------------------------------------------
REQUEST: SEND FORM FOR PAST AND FUTURE CHANGES

[What is the name of the program or package you're contributing to?]
Emacs

[Did you copy any files or text written by someone else in these changes?
Even if that material is free software, we need to know about it.]


[Do you have an employer who might have a basis to claim to own
your changes?  Do you attend a school which might make such a claim?]


[For the copyright registration, what country are you a citizen of?]


[What year were you born?]


[Please write your email address here.]


[Please write your postal address here.]





[Which files have you changed so far, and which new files have you written
so far?]
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000000..9416f1e9c7
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+/inspector-autoloads.el
+/inspector-pkg.el
+*.elc
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)))
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]