unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Copyright assignment and questions about package submission
@ 2020-12-24 13:05 Daniel Semyonov
  2020-12-24 14:28 ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Semyonov @ 2020-12-24 13:05 UTC (permalink / raw)
  To: emacs-devel

Hi,

I'd like to submit a package I've been working on for the past few weeks
to GNU ELPA (its repository can be found at sr.ht/~dsemy/swsw).

First of all, I haven't assigned copyright to the FSF; the manual
indicates I should ask here for the forms.

In addition, I have a few questions regarding package submission:
1. My package contains an info node -- I currently have a Makefile which
generates the .info and dir files. When submitting the package, should I
include the .texi file used to generate the info node and a Makefile, or
the .info and dir files themselves?
2. In the README of the GNU ELPA git repository, it is indicated that
for a multi-file package I should include a patch with my submission
email. I'll admit I'm a "casual" git user, so I'm not sure how exactly I
should generate this patch. Which branch of the repository should I base
my patch on?

Thanks in advance, Daniel



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Copyright assignment and questions about package submission
  2020-12-24 13:05 Copyright assignment and questions about package submission Daniel Semyonov
@ 2020-12-24 14:28 ` Stefan Monnier
  2020-12-24 15:58   ` Daniel Semyonov
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2020-12-24 14:28 UTC (permalink / raw)
  To: Daniel Semyonov; +Cc: emacs-devel

> I'd like to submit a package I've been working on for the past few weeks
> to GNU ELPA (its repository can be found at sr.ht/~dsemy/swsw).

Great!
[ Caveat: I haven't looked at your package at all yet.  ]

> First of all, I haven't assigned copyright to the FSF; the manual
> indicates I should ask here for the forms.

Please fill the form below and send it to the FSF as instructed so they
can send you the relevant paperwork to sign.

> In addition, I have a few questions regarding package submission:
> 1. My package contains an info node -- I currently have a Makefile which
> generates the .info and dir files. When submitting the package, should I
> include the .texi file used to generate the info node and a Makefile, or
> the .info and dir files themselves?

Nowadays the GNU ELPA script can build the .info from the .texi
Notice also that you don't submit a set of files but a complete Git
history (GNU ELPA is not meant as a mere distribution site, but as
a development site as well), so ideally we'll just clone your main
branch as-is.

> 2. In the README of the GNU ELPA git repository, it is indicated that
> for a multi-file package I should include a patch with my submission
> email. I'll admit I'm a "casual" git user, so I'm not sure how exactly I
> should generate this patch. Which branch of the repository should I base
> my patch on?

The README needs a lot of work, indeed, especially because we've
recently changed our build scripts significantly.  A Git URL is the
preferred option now.


        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?]


[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?]




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Copyright assignment and questions about package submission
  2020-12-24 14:28 ` Stefan Monnier
@ 2020-12-24 15:58   ` Daniel Semyonov
  2020-12-26 22:01     ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Semyonov @ 2020-12-24 15:58 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

> Please fill the form below and send it to the FSF as instructed so they
> can send you the relevant paperwork to sign.

Thanks, I've sent the form.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Copyright assignment and questions about package submission
  2020-12-24 15:58   ` Daniel Semyonov
@ 2020-12-26 22:01     ` Stefan Monnier
  2020-12-26 22:13       ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2020-12-26 22:01 UTC (permalink / raw)
  To: Daniel Semyonov; +Cc: emacs-devel

>> Please fill the form below and send it to the FSF as instructed so they
>> can send you the relevant paperwork to sign.
> Thanks, I've sent the form.

BTW, I just looked at your package.

The code looks clean, but when I tried to enable it in my main Emacs
session it got stuck in `swsw-update`, apparently more specifically
inside `swsw--get-possible-ids` (see sample backtrace below obtained
with `debug-on-quit`).

It looks like your algorithm has a bad asymptotic complexity (my session
has currently 88 frames, most of them with a single window in it).


        Stefan



Debugger entered--Lisp error: (quit)
  (closure ((char-lists (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108)) t) (inner) (mapcar #'(lambda (outer) (cons outer inner)) (car char-lists)))((103 106 106 107 102 103))
  mapcan((closure ((char-lists (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108)) t) (inner) (mapcar #'(lambda (outer) (cons outer inner)) (car char-lists))) ((97 97 97 97 97 97) (115 97 97 97 97 97) (100 97 97 97 97 97) (102 97 97 97 97 97) (103 97 97 97 97 97) (104 97 97 97 97 97) (106 97 97 97 97 97) (107 97 97 97 97 97) (108 97 97 97 97 97) (97 115 97 97 97 97) (115 115 97 97 97 97) (100 115 97 97 97 97) (102 115 97 97 97 97) (103 115 97 97 97 97) (104 115 97 97 97 97) (106 115 97 97 97 97) (107 115 97 97 97 97) (108 115 97 97 97 97) (97 100 97 97 97 97) (115 100 97 97 97 97) (100 100 97 97 97 97) (102 100 97 97 97 97) (103 100 97 97 97 97) (104 100 97 97 97 97) (106 100 97 97 97 97) (107 100 97 97 97 97) (108 100 97 97 97 97) (97 102 97 97 97 97) (115 102 97 97 97 97) (100 102 97 97 97 97) (102 102 97 97 97 97) (103 102 97 97 97 97) (104 102 97 97 97 97) (106 102 97 97 97 97) (107 102 97 97 97 97) (108 102 97 97 97 97) (97 103 97 97 97 97) (115 103 97 97 97 97) (100 103 97 97 97 97) (102 103 97 97 97 97) (103 103 97 97 97 97) (104 103 97 97 97 97) (106 103 97 97 97 97) (107 103 97 97 97 97) (108 103 97 97 97 97) (97 104 97 97 97 97) (115 104 97 97 97 97) (100 104 97 97 97 97) (102 104 97 97 97 97) (103 104 97 97 97 97) ...))
  (if char-lists (mapcan #'(lambda (inner) (mapcar #'(lambda (outer) (cons outer inner)) (car char-lists))) (apply #'swsw--get-possible-ids (cdr char-lists))) (list nil))
  swsw--get-possible-ids((97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108))
  apply(swsw--get-possible-ids ((97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108)))
  (mapcan #'(lambda (inner) (mapcar #'(lambda (outer) (cons outer inner)) (car char-lists))) (apply #'swsw--get-possible-ids (cdr char-lists)))
  (if char-lists (mapcan #'(lambda (inner) (mapcar #'(lambda (outer) (cons outer inner)) (car char-lists))) (apply #'swsw--get-possible-ids (cdr char-lists))) (list nil))
  swsw--get-possible-ids((97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108))
  apply(swsw--get-possible-ids ((97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108)))
  (mapcan #'(lambda (inner) (mapcar #'(lambda (outer) (cons outer inner)) (car char-lists))) (apply #'swsw--get-possible-ids (cdr char-lists)))
  (if char-lists (mapcan #'(lambda (inner) (mapcar #'(lambda (outer) (cons outer inner)) (car char-lists))) (apply #'swsw--get-possible-ids (cdr char-lists))) (list nil))
  swsw--get-possible-ids((97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108))
  apply(swsw--get-possible-ids ((97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108)))
  (mapcan #'(lambda (inner) (mapcar #'(lambda (outer) (cons outer inner)) (car char-lists))) (apply #'swsw--get-possible-ids (cdr char-lists)))
  (if char-lists (mapcan #'(lambda (inner) (mapcar #'(lambda (outer) (cons outer inner)) (car char-lists))) (apply #'swsw--get-possible-ids (cdr char-lists))) (list nil))
  swsw--get-possible-ids((97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108))
  apply(swsw--get-possible-ids ((97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108)))
  (mapcan #'(lambda (inner) (mapcar #'(lambda (outer) (cons outer inner)) (car char-lists))) (apply #'swsw--get-possible-ids (cdr char-lists)))
  (if char-lists (mapcan #'(lambda (inner) (mapcar #'(lambda (outer) (cons outer inner)) (car char-lists))) (apply #'swsw--get-possible-ids (cdr char-lists))) (list nil))
  swsw--get-possible-ids((97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108))
  apply(swsw--get-possible-ids ((97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108) (97 115 100 102 103 104 106 107 108)))
  (let ((acc 0) (len (swsw--get-id-length)) char-lists) (while (< acc len) (setq char-lists (cons swsw-id-chars char-lists)) (setq acc (1+ acc))) (apply #'swsw--get-possible-ids char-lists))
  (setq swsw-window-list nil swsw-ids (let ((acc 0) (len (swsw--get-id-length)) char-lists) (while (< acc len) (setq char-lists (cons swsw-id-chars char-lists)) (setq acc (1+ acc))) (apply #'swsw--get-possible-ids char-lists)))
  swsw-update()
  (progn (swsw-update) (if (eq swsw-display-function 'lighter) nil (funcall swsw-display-function t)) (add-hook 'window-configuration-change-hook #'swsw-update) (add-hook 'minibuffer-setup-hook #'swsw-update) (add-hook 'minibuffer-exit-hook #'swsw-update) (add-hook 'after-delete-frame-functions #'swsw-update))
  (if swsw-mode (progn (swsw-update) (if (eq swsw-display-function 'lighter) nil (funcall swsw-display-function t)) (add-hook 'window-configuration-change-hook #'swsw-update) (add-hook 'minibuffer-setup-hook #'swsw-update) (add-hook 'minibuffer-exit-hook #'swsw-update) (add-hook 'after-delete-frame-functions #'swsw-update)) (if (eq swsw-display-function 'lighter) nil (funcall swsw-display-function nil)) (remove-hook 'window-configuration-change-hook #'swsw-update) (remove-hook 'minibuffer-setup-hook #'swsw-update) (remove-hook 'minibuffer-exit-hook #'swsw-update) (remove-hook 'after-delete-frame-functions #'swsw-update))
  (let ((last-message (current-message))) (progn (set-default 'swsw-mode (cond ((eq arg 'toggle) (not (default-value 'swsw-mode))) ((and (numberp arg) (< arg 1)) nil) (t t)))) (if swsw-mode (progn (swsw-update) (if (eq swsw-display-function 'lighter) nil (funcall swsw-display-function t)) (add-hook 'window-configuration-change-hook #'swsw-update) (add-hook 'minibuffer-setup-hook #'swsw-update) (add-hook 'minibuffer-exit-hook #'swsw-update) (add-hook 'after-delete-frame-functions #'swsw-update)) (if (eq swsw-display-function 'lighter) nil (funcall swsw-display-function nil)) (remove-hook 'window-configuration-change-hook #'swsw-update) (remove-hook 'minibuffer-setup-hook #'swsw-update) (remove-hook 'minibuffer-exit-hook #'swsw-update) (remove-hook 'after-delete-frame-functions #'swsw-update)) (run-hooks 'swsw-mode-hook (if (default-value 'swsw-mode) 'swsw-mode-on-hook 'swsw-mode-off-hook)) (if (called-interactively-p 'any) (progn (customize-mark-as-set 'swsw-mode) (if (and (current-message) (not (equal last-message (current-message)))) nil (let ((local "")) (message "Swsw mode %sabled%s" (if (default-value ...) "en" "dis") local))))))
  swsw-mode(toggle)
  funcall-interactively(swsw-mode toggle)
  call-interactively(swsw-mode record nil)
  command-execute(swsw-mode record)
  execute-extended-command(nil "swsw-mode" nil)
  funcall-interactively(execute-extended-command nil "swsw-mode" nil)
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Copyright assignment and questions about package submission
  2020-12-26 22:01     ` Stefan Monnier
@ 2020-12-26 22:13       ` Stefan Monnier
  2020-12-27  9:30         ` Daniel Semyonov
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2020-12-26 22:13 UTC (permalink / raw)
  To: Daniel Semyonov; +Cc: emacs-devel

>>> Please fill the form below and send it to the FSF as instructed so they
>>> can send you the relevant paperwork to sign.
>> Thanks, I've sent the form.
>
> BTW, I just looked at your package.
>
> The code looks clean, but when I tried to enable it in my main Emacs
> session it got stuck in `swsw-update`, apparently more specifically
> inside `swsw--get-possible-ids` (see sample backtrace below obtained
> with `debug-on-quit`).
>
> It looks like your algorithm has a bad asymptotic complexity (my session
> has currently 88 frames, most of them with a single window in it).

Actually, it looks like a simple error where you used division instead
of logarithm, thus constructing a `sws-ids` that's exponentially longer
than the one you need.  The patch below makes it usable for me.

[ I'd still argue that you shouldn't bother to construct the whole
  `sws-ids` list but instead keep a counter which lets you build the
  "next" id on the fly.  But that's up to you.  ]


        Stefan


diff --git a/swsw.el b/swsw.el
index 7f26b63..e4bb743 100644
--- a/swsw.el
+++ b/swsw.el
@@ -66,12 +66,10 @@
 
 (defcustom swsw-id-chars '(?a ?s ?d ?f ?g ?h ?j ?k ?l)
   "Base set of characters from which window IDs are constructed."
-  :group 'swsw
   :type '(repeat character))
 
 (defcustom swsw-minibuffer-id ?m
   "ID reserved for the minibuffer."
-  :group 'swsw
   :type '(character))
 
 (defcustom swsw-scope t
@@ -81,7 +79,6 @@ t means consider all windows on all existing frames.
   iconified frames.
 ‘visible’ means consider all windows on all visible frames.
 ‘current’ means consider only the currently selected frame."
-  :group 'swsw
   :type '(radio (const :tag "All windows on all frames" t)
                 (const
                  :tag "All windows on all visible and iconified frames." 0)
@@ -109,7 +106,6 @@ sole argument (turning it on)."
 This function is called with t as the sole argument when enabling
 ‘swsw-mode’, and with nil as the sole argument when disabling it.
 If set to ‘lighter’, use the mode line lighter of ‘swsw-mode’."
-  :group 'swsw
   :type '(radio (const :tag "Mode line lighter" lighter)
                 (function :tag "Display function"))
   :set #'swsw--set-display-function)
@@ -117,7 +113,6 @@ If set to ‘lighter’, use the mode line lighter of ‘swsw-mode’."
 (defcustom swsw-id-format " <%s>"
   "Format string for the window ID.
 %s is replaced with a representation of the window's ID."
-  :group 'swsw
   :type '(string))
 
 ;;;; Simple window switching minor mode:
@@ -147,12 +142,8 @@ If set to ‘lighter’, use the mode line lighter of ‘swsw-mode’."
 (defun swsw--get-id-length ()
   "Return the current length of a window ID."
   (let* ((windows (length (window-list-1 nil nil (swsw--get-scope))))
-         (chars (length swsw-id-chars))
-         (div (/ windows chars)))
-    ;; Check the remainder to avoid returning a longer length than necessary.
-    (if (= 0 (mod windows chars))
-        div
-      (1+ div))))
+         (chars (length swsw-id-chars)))
+    (ceiling (log windows chars))))
 
 (defun swsw-update-window (window)
   "Update information for WINDOW."




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: Copyright assignment and questions about package submission
  2020-12-26 22:13       ` Stefan Monnier
@ 2020-12-27  9:30         ` Daniel Semyonov
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Semyonov @ 2020-12-27  9:30 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

> Actually, it looks like a simple error where you used division instead
> of logarithm, thus constructing a `sws-ids` that's exponentially longer
> than the one you need.   The patch below makes it usable for me.

Thanks, I've applied the patch (with minor modifications).

> [ I'd still argue that you shouldn't bother to construct the whole
>    `sws-ids` list but instead keep a counter which lets you build the
>    "next" id on the fly.   But that's up to you.   ]

I've done some testing with a large number of windows (with the patch
applied) and building the list doesn't seem to introduce any noticeable
delay.  I do agree that it isn't a very clean solution though. I'll see
if I can implement this in a better way.



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-12-27  9:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-24 13:05 Copyright assignment and questions about package submission Daniel Semyonov
2020-12-24 14:28 ` Stefan Monnier
2020-12-24 15:58   ` Daniel Semyonov
2020-12-26 22:01     ` Stefan Monnier
2020-12-26 22:13       ` Stefan Monnier
2020-12-27  9:30         ` Daniel Semyonov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).