From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.devel Subject: Re: [NonGNU ELPA] 11 new packages! Date: Fri, 25 Nov 2022 17:31:06 +0000 Message-ID: <871qpr0wmd.fsf@posteo.net> References: <87r0y6ug9z.fsf@disroot.org> <87y1sct2hp.fsf@posteo.net> <87k03vf5m8.fsf@disroot.org> <87edu2narn.fsf@posteo.net> <8735aieqtr.fsf@disroot.org> <87cz9mlq3o.fsf@posteo.net> <875yfdd5ad.fsf@disroot.org> <87tu2n1p5v.fsf@posteo.net> <87fse79o94.fsf@disroot.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26517"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Emacs Developer List To: Akib Azmain Turja Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Nov 25 18:31:58 2022 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 1oycYP-0006gW-Sz for ged-emacs-devel@m.gmane-mx.org; Fri, 25 Nov 2022 18:31:57 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oycXi-0004gr-D2; Fri, 25 Nov 2022 12:31:14 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oycXf-0004cV-LT for emacs-devel@gnu.org; Fri, 25 Nov 2022 12:31:11 -0500 Original-Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oycXb-0004aC-Pc for emacs-devel@gnu.org; Fri, 25 Nov 2022 12:31:11 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id A84C0240029 for ; Fri, 25 Nov 2022 18:31:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1669397465; bh=9lVEGe0xyBrXhYXtbMyqAK6z5RIAXCmcgxuLJUrwfRw=; h=From:To:Cc:Subject:Date:From; b=lJgbeuCXqxRRo7wsooJkFmAClqWDB5hLJYg4g5+rMwln8JXwUkMQTxKpZjhe5YPTU MjS7ziz7i/zy77SYCGGXm7qVsLmPognIoF5D3ug0JjbjldBh5DL57ybvD5g4iXjIX1 qN7QbrNDB+C7+ZlWbYe7OCvpvSpsmoLd6RDRxVb7XA91h69kzA4ne+WRDqPICkzj3/ jQ/WTmBWoK4IFl4zDlGRiH5Oz62qFnMwxZSZ3uQFmHa+Ielbv2qjsMkfRrkYdw5ilt X0STkvVmcuGHQsLy+kehhj0KEQhdJ6ox4wmdC3lhS0UhKivWMm5nhs35t1blBsKnzR rFRTewksjPY/Q== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4NJhjP1Tsvz6tmJ; Fri, 25 Nov 2022 18:31:05 +0100 (CET) In-Reply-To: <87fse79o94.fsf@disroot.org> (Akib Azmain Turja's message of "Fri, 25 Nov 2022 19:07:03 +0600") Received-SPF: pass client-ip=185.67.36.65; envelope-from=philipk@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-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.29 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:300504 Archived-At: Akib Azmain Turja writes: > Philip Kaludercic writes: > >> >> iwindow: >> >> diff --git a/iwindow.el b/iwindow.el >> index c808bd26f9..eab2c3084b 100644 >> --- a/iwindow.el >> +++ b/iwindow.el >> @@ -46,6 +46,8 @@ >> ;;; Code: >> >> (require 'cl-lib) >> +;; By adding `seq' as a dependency you could lower the dependency on >> +;; the minimum version of Emacs. >> > > Thanks. But then I would need to do the following: > > + cl-mapcar -> seq-mapn > + cl-labels -> named-let (right?) > + cl-letf* -> What? unwind-protect? Eh, I didn't mean to say that you should replace cl-lib with seq, you can use both. > Suggestions appreciated. > >> (defgroup iwindow nil >> "Interactively manipulate windows." >> @@ -54,7 +56,7 @@ >> :prefix "iwindow-") >> >> (defcustom iwindow-selection-keys >> - '(?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9) >> + (number-sequence ?0 ?9) >> "List of keys to use to select window. >> >> Each element should be a key that `read-key' can return." > > Done. > >> @@ -141,8 +143,7 @@ list of form (OPTION...), whose length of no more than the length of >> (walk tree nil)) >> (run-hook-wrapped 'iwindow-decoration-functions >> (lambda (fn) (ignore (push fn decorators)))) >> - (cl-labels ((call-decorators >> - (fns) >> + (cl-labels ((call-decorators (fns) >> (with-selected-window current-window >> (if fns >> (funcall (car fns) windows > > Done. IIRC, Emacs indented the code as the following when I wrote it: > > (cl-labels ((call-decorators (fns) > (with-selected-window current-window > (if fns > (funcall (car fns) windows > > So I placed the argument list on its own line. Perhaps this was changed recently, because I explicitly tried re-indenting the function and it looked fine. > >> @@ -157,6 +158,7 @@ list of form (OPTION...), whose length of no more than the length of >> Return the window chosen." >> (if (windowp tree) >> (prog1 >> + ;; Is there really a point to using `prog1' here? >> tree >> (redraw-display)) >> (let ((option nil) > > I don't think so. I don't know why I wrote that, but looks like the > code is same as (progn (redraw-display) tree). Changed. > >> @@ -192,7 +194,7 @@ WINDOW and ignore WINDOW when PREDICATE returns nil." >> (seq-filter predicate windows) >> windows))) >> (when candidates >> - (if (cdr candidates) ; (> (length candidates) 1) >> + (if (cdr candidates) ;(length> candidates 1) >> (iwindow--ask (iwindow--make-decision-tree >> (vconcat windows) 0 (length windows) >> predicate)) > > I was using Emacs 27 back then, hence that comment. Now I changed that. > Anyway, is there any benefit that new primitive? This was probably the most pointless input I had. The only advantage that (length> candidates 1) has over (cdr candidates) is that it makes your intention more explicit. >> @@ -215,7 +217,7 @@ WINDOWS and CALLBACK is described in the docstring of >> (alist-get (selected-window) >> ',windows))) >> (mapconcat >> - (apply-partially #'string ? ) >> + (apply-partially #'string ?\s) >> keys "") >> ',(alist-get (current-buffer) >> original-mode-lines))))) > > Nice idea. Done. > >> @@ -261,6 +263,7 @@ WINDOWS and CALLBACK is described in the docstring of >> >> WINDOWS and CALLBACK is described in the docstring of >> `iwindow-decoration-functions', which see." >> + ;; Again, recommending Compat you could make use of `named-let' here >> (cl-labels ((setup-windows (window-list) >> (with-selected-window (caar window-list) >> (let ((ov nil)) > > Hmm, tail call optimization, interesting.