From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Copyright assignment and questions about package submission Date: Sat, 26 Dec 2020 17:13:51 -0500 Message-ID: References: <87k0t7ci1n.fsf@dsemy.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24210"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Daniel Semyonov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Dec 26 23:14:32 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ktHpY-0006Cu-8x for ged-emacs-devel@m.gmane-mx.org; Sat, 26 Dec 2020 23:14:32 +0100 Original-Received: from localhost ([::1]:37552 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ktHpX-0001wV-9a for ged-emacs-devel@m.gmane-mx.org; Sat, 26 Dec 2020 17:14:31 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38354) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ktHp1-0001VD-7R for emacs-devel@gnu.org; Sat, 26 Dec 2020 17:13:59 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:37006) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ktHoy-0001yH-5G for emacs-devel@gnu.org; Sat, 26 Dec 2020 17:13:58 -0500 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 141DB44043B; Sat, 26 Dec 2020 17:13:55 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 785A94406DD; Sat, 26 Dec 2020 17:13:53 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1609020833; bh=IwV4Qt0WsAzqB+pRm38PviKZ3nX+PKlDvyOfwXLje1o=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=FzOiKkvv+NgTp2et9uBNbQP8oB4J/jTB+TxmNhlOKB+/pnNBqH2CZL6YsQ0X+ThMx URuI838TJhnrGsrYWZ4yIwr53rvmiZzG54oRwqO+3qrTK84/ElD6yIbMzWxl7Tg5XF NpJASn+mIcRzZWKZbLcCkvOmbIzizUhMBT66QR3275ajTqOUzv2bzWdbkEHSP7TH2n bXt7qpCSgwDyAEol5fjndXD31reQyuCjk1cEvJw8ZC1quH7nY4RhJ2xXoUqB5loluh rFpXovyeQ6JcJgALouIwaL+MLosF6N++Eg4ThsoRmoO6jcexipwniSrjaCgblzk7m7 7PkSikfuS7UVA== Original-Received: from alfajor (unknown [104.247.243.191]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 262931202E2; Sat, 26 Dec 2020 17:13:53 -0500 (EST) In-Reply-To: (Stefan Monnier's message of "Sat, 26 Dec 2020 17:01:39 -0500") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:261873 Archived-At: >>> 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 @@ =20 (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)) =20 (defcustom swsw-minibuffer-id ?m "ID reserved for the minibuffer." - :group 'swsw :type '(character)) =20 (defcustom swsw-scope t @@ -81,7 +79,6 @@ t means consider all windows on all existing frames. iconified frames. =E2=80=98visible=E2=80=99 means consider all windows on all visible frames. =E2=80=98current=E2=80=99 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 =E2=80=98swsw-mode=E2=80=99, and with nil as the sole argument when disabl= ing it. If set to =E2=80=98lighter=E2=80=99, use the mode line lighter of =E2=80= =98swsw-mode=E2=80=99." - :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 =E2=80=98lighter=E2=80=99, use the mode line = lighter of =E2=80=98swsw-mode=E2=80=99." (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)) =20 ;;;; Simple window switching minor mode: @@ -147,12 +142,8 @@ If set to =E2=80=98lighter=E2=80=99, use the mode line= lighter of =E2=80=98swsw-mode=E2=80=99." (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 necessa= ry. - (if (=3D 0 (mod windows chars)) - div - (1+ div)))) + (chars (length swsw-id-chars))) + (ceiling (log windows chars)))) =20 (defun swsw-update-window (window) "Update information for WINDOW."