From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: Spencer Baugh <sbaugh@janestreet.com>
Newsgroups: gmane.emacs.bugs
Subject: bug#67310: [PATCH] Include the project--list as history when
 prompting for a project
Date: Wed, 22 Nov 2023 11:18:58 -0500
Message-ID: <ierr0khlq19.fsf@janestreet.com>
References: <ier8r6s42on.fsf@janestreet.com>
 <dc5ad8f4-b857-ea87-d178-bae903cee517@gutov.dev>
 <421e3ea8-d150-566e-f645-cbf1ccbcba61@gutov.dev>
 <ier34wz3zkx.fsf@janestreet.com>
 <81b6ed58-3fdc-3b5a-41a9-84d66475d5f1@gutov.dev>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
	logging-data="8373"; mail-complaints-to="usenet@ciao.gmane.io"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cc: 67310@debbugs.gnu.org, eliz@gnu.org, juri@linkov.net
To: Dmitry Gutov <dmitry@gutov.dev>
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Nov 22 17:20:05 2023
Return-path: <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>
Envelope-to: geb-bug-gnu-emacs@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 <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>)
	id 1r5pxN-0001zC-4a
	for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 22 Nov 2023 17:20:05 +0100
Original-Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <bug-gnu-emacs-bounces@gnu.org>)
	id 1r5pxH-0003hT-Lo; Wed, 22 Nov 2023 11:19:59 -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 <Debian-debbugs@debbugs.gnu.org>)
 id 1r5pxG-0003hL-SE
 for bug-gnu-emacs@gnu.org; Wed, 22 Nov 2023 11:19:58 -0500
Original-Received: from debbugs.gnu.org ([2001:470:142:5::43])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1r5pxG-0003G7-KZ
 for bug-gnu-emacs@gnu.org; Wed, 22 Nov 2023 11:19:58 -0500
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1r5pxJ-0007Yn-U0
 for bug-gnu-emacs@gnu.org; Wed, 22 Nov 2023 11:20:01 -0500
X-Loop: help-debbugs@gnu.org
Resent-From: Spencer Baugh <sbaugh@janestreet.com>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Wed, 22 Nov 2023 16:20:01 +0000
Resent-Message-ID: <handler.67310.B67310.170066995128983@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 67310
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
Original-Received: via spool by 67310-submit@debbugs.gnu.org id=B67310.170066995128983
 (code B ref 67310); Wed, 22 Nov 2023 16:20:01 +0000
Original-Received: (at 67310) by debbugs.gnu.org; 22 Nov 2023 16:19:11 +0000
Original-Received: from localhost ([127.0.0.1]:59773 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1r5pwU-0007XP-SW
 for submit@debbugs.gnu.org; Wed, 22 Nov 2023 11:19:11 -0500
Original-Received: from mxout1.mail.janestreet.com ([38.105.200.78]:53969)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <sbaugh@janestreet.com>) id 1r5pwS-0007Ws-I1
 for 67310@debbugs.gnu.org; Wed, 22 Nov 2023 11:19:09 -0500
In-Reply-To: <81b6ed58-3fdc-3b5a-41a9-84d66475d5f1@gutov.dev> (Dmitry Gutov's
 message of "Wed, 22 Nov 2023 03:40:28 +0200")
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
X-BeenThere: bug-gnu-emacs@gnu.org
List-Id: "Bug reports for GNU Emacs,
 the Swiss army knife of text editors" <bug-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/bug-gnu-emacs>
List-Post: <mailto:bug-gnu-emacs@gnu.org>
List-Help: <mailto:bug-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=subscribe>
Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org
Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org
Xref: news.gmane.io gmane.emacs.bugs:274766
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/274766>

Dmitry Gutov <dmitry@gutov.dev> writes:
> On 21/11/2023 17:17, Spencer Baugh wrote:
>>       (if (equal pr-dir dir-choice)
>>           (read-directory-name "Select directory: " default-directory nil t)
>> +      (project--add-dir pr-dir)
>>         pr-dir)))
>> ...
>>       (if (equal pr-name dir-choice)
>>           (read-directory-name "Select directory: " default-directory nil t)
>> -      (let ((proj (assoc pr-name choices)))
>> -        (if (stringp proj) proj (project-root (cdr proj)))))))
>> +      (let* ((proj (assoc pr-name choices))
>> +             (root (project-root (cdr proj))))
>> +        (project--add-dir root)
>> +        root))))
>
> I think in the (equal pr-dir dir-choice) case we want to add the
> directory name entered by the user into the "history" anyway, don't
> we?

Mmmmaybe?  That would change behavior - currently transient projects
don't go into the project--list, and with that change they would.  Do
you think they should?

I personally never use transient projects so I don't really know how
they should behave.

> Though perhaps there's no need to do it here: 'project-current' calls
> 'project-remember-project' anyway when maybe-prompt is non-nil.
>
> So what happens if you drop both of the above 'project--add-dir' calls?

project-prompter is also called from project-switch-project, which
doesn't call project-remember-project but should also update the history
IMO.