unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dmitry@gutov.dev>
To: Spencer Baugh <sbaugh@janestreet.com>
Cc: 67310@debbugs.gnu.org, eliz@gnu.org, juri@linkov.net
Subject: bug#67310: [PATCH] Include the project--list as history when prompting for a project
Date: Thu, 23 Nov 2023 04:55:56 +0200	[thread overview]
Message-ID: <dc3b5328-8719-8948-e617-e3e8cf13f274@gutov.dev> (raw)
In-Reply-To: <iercyw1l6rz.fsf@janestreet.com>

On 23/11/2023 01:14, Spencer Baugh wrote:
> @@ -1769,27 +1778,40 @@ project-prompt-project-dir
>             ;; completion style).
>             (project--file-completion-table
>              (append project--list `(,dir-choice))))
> +         (project--dir-history project--list)
>            (pr-dir ""))
>       (while (equal pr-dir "")
>         ;; If the user simply pressed RET, do this again until they don't.
> -      (setq pr-dir (completing-read "Select project: " choices nil t)))
> +      (setq pr-dir
> +            (let ((history-add-new-input nil))
> +              (completing-read "Select project: " choices nil t nil 'project--dir-history))))
>       (if (equal pr-dir dir-choice)
>           (read-directory-name "Select directory: " default-directory nil t)
> +      (let q((history-delete-duplicates t)
               ^
                typo

> +            (history-length t))
> +        (add-to-history 'project--list pr-dir))
>         pr-dir)))

Sorry, I thought we agreed that project-prompt-project-dir and 
project-prompt-project-name shouldn't add-to-history?

Because project-current calls project-remember-project already 
(including the cases when the prompter isn't used: when the project is 
auto-detected). And to cover the remaining cases, we can have 
project-switch-project call project-remember-project as well.

This way also we keep the project-prompter implementations with less 
logic inside, meaning it's a bit easier to write the next one.

More DRY, too. At least while there's no other code using 
project-prompter directly (but then we could add a helper).





  reply	other threads:[~2023-11-23  2:55 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 [this message]
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
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=dc3b5328-8719-8948-e617-e3e8cf13f274@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).