unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Philip Kaludercic <philipk@posteo.net>
To: Akib Azmain Turja <akib@disroot.org>
Cc: Emacs Developer List <emacs-devel@gnu.org>
Subject: Re: [NonGNU ELPA] 11 new packages!
Date: Fri, 25 Nov 2022 17:31:06 +0000	[thread overview]
Message-ID: <871qpr0wmd.fsf@posteo.net> (raw)
In-Reply-To: <87fse79o94.fsf@disroot.org> (Akib Azmain Turja's message of "Fri, 25 Nov 2022 19:07:03 +0600")

Akib Azmain Turja <akib@disroot.org> writes:

> Philip Kaludercic <philipk@posteo.net> 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.



  parent reply	other threads:[~2022-11-25 17:31 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-14  7:42 [NonGNU ELPA] 11 new packages! Akib Azmain Turja
2022-11-15 17:42 ` Akib Azmain Turja
2022-11-15 19:53 ` Filipp Gunbin
2022-11-16 12:22   ` Akib Azmain Turja
2022-11-16 16:53     ` Eli Zaretskii
2022-11-16 17:43       ` Akib Azmain Turja
2022-11-16 19:47         ` Eli Zaretskii
2022-11-17 14:27           ` Akib Azmain Turja
2022-11-17 18:41             ` Stefan Monnier
2022-11-17 18:51             ` Yuan Fu
2022-11-24 23:38               ` Richard Stallman
2022-11-17 18:56             ` Eli Zaretskii
2022-11-15 19:57 ` Philip Kaludercic
2022-11-16 12:25   ` Akib Azmain Turja
2022-11-16 16:07     ` Philip Kaludercic
2022-11-16 17:45       ` Akib Azmain Turja
2022-11-16 18:19         ` Philip Kaludercic
2022-11-17 14:28           ` Akib Azmain Turja
2022-11-21 18:32             ` Philip Kaludercic
2022-11-22 15:20               ` Akib Azmain Turja
2022-11-22 17:07                 ` Philip Kaludercic
2022-11-22 17:42                   ` Akib Azmain Turja
2022-11-25  8:29                     ` Akib Azmain Turja
2022-11-25 16:32                       ` Philip Kaludercic
2022-11-25 17:14                         ` Akib Azmain Turja
2022-11-22 21:16                 ` Stefan Monnier
2022-11-25  7:14             ` Philip Kaludercic
2022-11-25  7:22               ` Philip Kaludercic
2022-11-25 12:45                 ` Akib Azmain Turja
2022-11-25 13:07               ` Akib Azmain Turja
2022-11-25 17:16                 ` Akib Azmain Turja
2022-11-25 17:31                 ` Philip Kaludercic [this message]
2022-11-26  5:53                   ` Akib Azmain Turja
2022-11-26 20:12                     ` Stefan Monnier
2022-11-25 19:07             ` Philip Kaludercic
2022-11-26  7:49               ` Akib Azmain Turja
2022-11-27  8:11                 ` Philip Kaludercic
2022-11-27 19:22                   ` Akib Azmain Turja
2022-11-27 19:55                   ` Akib Azmain Turja
2022-11-27 20:30                     ` Philip Kaludercic
2022-11-26 18:44               ` Akib Azmain Turja
2022-11-26 20:07             ` Philip Kaludercic
2022-11-26 20:17               ` Philip Kaludercic
2022-11-26 21:12                 ` Akib Azmain Turja
2022-11-27 11:45                   ` Philip Kaludercic
2022-11-27 17:04                     ` Akib Azmain Turja
2022-11-27 20:26                       ` Philip Kaludercic
2022-11-28 19:07                       ` Akib Azmain Turja
2022-11-28 19:42                         ` Philip Kaludercic
2022-11-28 20:32                           ` Akib Azmain Turja
2022-11-28 20:57                         ` Stefan Monnier
2022-11-27 18:40                   ` [NonGNU ELPA] 12 " Akib Azmain Turja
2022-11-27 20:36                     ` Philip Kaludercic
2022-11-27 21:11                       ` Akib Azmain Turja
2022-11-27  6:40               ` [NonGNU ELPA] 11 " Akib Azmain Turja
2022-11-19 12:05     ` Richard Stallman
2022-11-19 12:17       ` Philip Kaludercic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871qpr0wmd.fsf@posteo.net \
    --to=philipk@posteo.net \
    --cc=akib@disroot.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).