From: Dmitry Gutov <dmitry@gutov.dev>
To: Eli Zaretskii <eliz@gnu.org>, Spencer Baugh <sbaugh@janestreet.com>
Cc: 67310@debbugs.gnu.org, juri@linkov.net
Subject: bug#67310: [PATCH] Include the project--list as history when prompting for a project
Date: Sat, 25 Nov 2023 03:54:13 +0200 [thread overview]
Message-ID: <ab8f5ad1-356e-e90d-eab4-d36a0b0821fc@gutov.dev> (raw)
In-Reply-To: <83bkblgeja.fsf@gnu.org>
I'll try to answer some of the questions that are still relevant to the
latest patch, myself.
On 23/11/2023 08:38, Eli Zaretskii wrote:
>> + ;; Iterate in reverse order so project--name-history is in
>> + ;; the correct order.
>
> What is the "correct" order?
Their order in project--list.
Iteration and construction of a new list with 'push' leads to the
reverse order, hence the use of reversion at the beginning to counteract
that.
>> - (if-let (proj (project--find-in-directory dir))
>> - (push (cons (project-name proj) proj) ret)))
>> + (when-let (proj (project--find-in-directory dir))
>> + (let ((name (project-name proj)))
>> + (push name project--name-history)
>> + (push (cons name proj) ret))))
>
> Not sure I understand why you replaced if-let with when-let here.
To reduce the amount of indentation, perhaps.
>> + (let ((history-add-new-input nil))
>
> Why this non-standard way of let-binding a variable to nil?
I use this myself sometimes to make the change more explicit.
Anyway, amended.
>> + (let ((history-delete-duplicates t)
>> + (history-length t))
>> + (add-to-history 'project--list root))
>
> Why are you overriding the values of these two user options?
To implement the current behavior (how additions to project--list)
happen. I've described that behavior in one of the earlier messages here.
>> - (let ((dirs (if recursive
>> - (directory-files-recursively dir "" t)
>> - (directory-files dir t)))
>> - (known (make-hash-table :size (* 2 (length project--list))
>> - :test #'equal))
>> - (count 0))
>> - (dolist (project (mapcar #'car project--list))
>> + (let* ((dirs (if recursive
>> + (directory-files-recursively dir "" t)
>> + (directory-files dir t)))
>> + (roots (project-known-project-roots))
>> + (known (make-hash-table :size (* 2 (length roots))
>> + :test #'equal))
>> + (count 0))
>
> Is it really necessary to use let* here?
'known' depend on 'roots'.
next prev parent reply other threads:[~2023-11-25 1:54 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-20 19:58 bug#67310: [PATCH] Include the project--list as history when prompting for a project Spencer Baugh
2023-11-21 11:06 ` Dmitry Gutov
2023-11-21 11:14 ` Dmitry Gutov
2023-11-21 15:17 ` Spencer Baugh
2023-11-22 1:40 ` Dmitry Gutov
2023-11-22 16:18 ` Spencer Baugh
2023-11-22 18:44 ` Dmitry Gutov
2023-11-22 23:14 ` Spencer Baugh
2023-11-23 2:55 ` Dmitry Gutov
2023-11-24 15:50 ` Spencer Baugh
2023-11-25 2:07 ` Dmitry Gutov
2023-11-25 17:50 ` Juri Linkov
2023-11-27 17:10 ` Juri Linkov
2023-12-10 3:04 ` Dmitry Gutov
2023-12-10 17:43 ` Juri Linkov
2023-12-10 20:32 ` Dmitry Gutov
2023-12-11 17:12 ` Juri Linkov
2023-12-12 0:21 ` Dmitry Gutov
2023-12-14 1:02 ` sbaugh
2023-12-19 17:35 ` Juri Linkov
2023-11-23 6:38 ` Eli Zaretskii
2023-11-25 1:54 ` Dmitry Gutov [this message]
2023-11-25 8:42 ` Eli Zaretskii
2023-11-25 14:05 ` Dmitry Gutov
2023-11-25 14:10 ` Eli Zaretskii
2023-11-25 15:06 ` Dmitry Gutov
2023-11-25 15:57 ` Eli Zaretskii
2023-11-25 16:35 ` Dmitry Gutov
2023-11-22 1:42 ` Dmitry Gutov
2023-11-22 16:21 ` Spencer Baugh
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=ab8f5ad1-356e-e90d-eab4-d36a0b0821fc@gutov.dev \
--to=dmitry@gutov.dev \
--cc=67310@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=juri@linkov.net \
--cc=sbaugh@janestreet.com \
/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).