GNU bug report logs - #67310
[PATCH] Include the project--list as history when prompting for a project

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: wishlist; Reported by: Spencer Baugh <sbaugh@HIDDEN>; Keywords: patch; dated Mon, 20 Nov 2023 19:59:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Severity set to 'wishlist' from 'normal' Request was from Stefan Kangas <stefankangas@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 67310 <at> debbugs.gnu.org:


Received: (at 67310) by debbugs.gnu.org; 19 Dec 2023 17:52:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Dec 19 12:52:33 2023
Received: from localhost ([127.0.0.1]:37281 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rFeGe-0007nE-Tf
	for submit <at> debbugs.gnu.org; Tue, 19 Dec 2023 12:52:33 -0500
Received: from relay3-d.mail.gandi.net ([217.70.183.195]:50719)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1rFeGW-0007mH-62
 for 67310 <at> debbugs.gnu.org; Tue, 19 Dec 2023 12:52:24 -0500
Received: by mail.gandi.net (Postfix) with ESMTPSA id E0C6A60002;
 Tue, 19 Dec 2023 17:52:13 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: sbaugh@HIDDEN
Subject: Re: bug#67310: [PATCH] Include the project--list as history when
 prompting for a project
In-Reply-To: <87wmthtx5p.fsf@HIDDEN> (sbaugh@HIDDEN's message of "Thu, 
 14 Dec 2023 01:02:58 +0000 (UTC)")
Organization: LINKOV.NET
References: <ier8r6s42on.fsf@HIDDEN>
 <dc5ad8f4-b857-ea87-d178-bae903cee517@HIDDEN>
 <421e3ea8-d150-566e-f645-cbf1ccbcba61@HIDDEN>
 <ier34wz3zkx.fsf@HIDDEN>
 <81b6ed58-3fdc-3b5a-41a9-84d66475d5f1@HIDDEN>
 <ierr0khlq19.fsf@HIDDEN>
 <5c3eb6a1-38da-8af4-419a-e0567b163e3a@HIDDEN>
 <iercyw1l6rz.fsf@HIDDEN>
 <dc3b5328-8719-8948-e617-e3e8cf13f274@HIDDEN>
 <ier8r6nkv58.fsf@HIDDEN> <8634wr6s1t.fsf@HIDDEN>
 <dfbd2b3e-a14b-b5b4-a7c0-aa837ea6220c@HIDDEN>
 <861qbujehq.fsf@HIDDEN>
 <780dbb13-c0ca-9082-936b-3c2ab34084dc@HIDDEN>
 <861qbtq630.fsf@HIDDEN>
 <8c67f590-d31a-44be-1c33-c0c75e4da63c@HIDDEN>
 <87wmthtx5p.fsf@HIDDEN>
Date: Tue, 19 Dec 2023 19:35:28 +0200
Message-ID: <86zfy6rt0v.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 67310
Cc: 67310 <at> debbugs.gnu.org, Dmitry Gutov <dmitry@HIDDEN>, eliz@HIDDEN,
 Spencer Baugh <sbaugh@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

>>>>>>> This change broke the order of 'C-x p p M-n M-n ...',
>>>>>> Could you remind me which behavior in 'M-n M-n' the aforementioned change
>>>>>> relates to? Is this supposed to be like input history as well, or the
>>>>>> contents of the completions table in a certain order?
>>>>> It's inappropriate to overwrite the history with the recently visited projects.
>>>>> Only user input should be added to history variables because it's actually
>>>>> the history of user input.  Therefore, the remaining way to access a list
>>>>> of recently visited projects is the future history with 'M-n M-n'.
>>>>
>>>> But... we do overwrite it now, manually constructing the value of input
>>>> history from project--list every time.
>>>>
>>>> So it seems like both "past history" and "future history" show the same
>>>> information now. If so, it might make sense to keep only one.
>>> It's usually not good to overwrite past history.  So it's better
>>> to keep only future history.
>>
>> I'm not sure the actual input history is useful here: in most cases,
>> it will be empty or almost empty. project history is different from
>> all others because we almost always detect it automatically. And also
>> because the total set of projects is relatively small, for each user.
>>
>> And "future history" is different for every command, including the
>> logic of how it's formed. Most users are also unaware of its
>> existence, so it wouldn't be a good idea to rely only on it.
>
> Yes, I think it's okay for project history to be treated as minibuffer
> history even though it's not actual input history.  It's not a huge
> deal, especially since the history didn't exist before.

To me the distinction between input history and project history is clear.
Especially since I added a lot of define-advice that update the most
recent project by any activity on a project: such as running 'vc-dir'
adds the current vc project dir to the top of the project list,
using Dired does the same, etc.  So I always have the most recently used
project on 'C-x p p M-n'.  Whereas I expect that 'C-x p p M-p' will get
the last project that was manually selected by the previous completion.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#67310; Package emacs. Full text available.

Message received at 67310 <at> debbugs.gnu.org:


Received: (at 67310) by debbugs.gnu.org; 14 Dec 2023 01:03:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Dec 13 20:03:25 2023
Received: from localhost ([127.0.0.1]:59897 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rDa8K-0000Ka-NN
	for submit <at> debbugs.gnu.org; Wed, 13 Dec 2023 20:03:25 -0500
Received: from s.wrqvwxzv.outbound-mail.sendgrid.net ([149.72.154.232]:54832)
 by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from
 <bounces+21787432-b3f5-67310=debbugs.gnu.org@HIDDEN>)
 id 1rDa8G-0000KI-RA
 for 67310 <at> debbugs.gnu.org; Wed, 13 Dec 2023 20:03:24 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=catern.com;
 h=from:subject:in-reply-to:references:mime-version:to:cc:content-type:
 content-transfer-encoding:cc:content-type:from:subject:to;
 s=s1; bh=H2jBYpfqPg0SE4LrRXFptxa7xynPV/9vYqdnY4OUEkQ=;
 b=KAvYAQnQv6Qea0/fNKAoWMc8bLhzpVtuoPbKfuB+Iecvs9gJ+GW1FL1CQYuO621YR/Oh
 7ZWAV7xsUwI5YXWEA0L7wyFhzB2LUHt1UeFuce64VcOfGhaAdoO4uTxqU0mCucm+VEW/+/
 R++jpBatKxvB8tY4OaSpZgJQrAfuze291oqSmySR3Voyrftc0bnd3zo2JotlYHACUCUcq4
 MK1xsn85rG+p3tnTDe/JeAXOwyhtFnrtGK7YibOsOwD3OJu3pF8DyfB6SCj2kwXhnTZdAn
 sko0rVEzLZhUYpUqmJGUzOhh/B5rPbEipFAF2AP2HJA0zKWmNhgPgFlEcV8hBcjA==
Received: by filterdrecv-6b68c9f446-xmb8m with SMTP id
 filterdrecv-6b68c9f446-xmb8m-1-657A5442-10
 2023-12-14 01:02:58.281265135 +0000 UTC m=+4947721.640721966
Received: from earth.catern.com (unknown) by geopod-ismtpd-30 (SG) with ESMTP
 id 8tMMcuOTQ-G3dUzRlNwofg Thu, 14 Dec 2023 01:02:58.216 +0000 (UTC)
Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=74.101.51.129;
 helo=localhost; envelope-from=sbaugh@HIDDEN; receiver=gutov.dev 
Received: from localhost (unknown [74.101.51.129])
 by earth.catern.com (Postfix) with ESMTPSA id 1CD526324F;
 Wed, 13 Dec 2023 20:01:22 -0500 (EST)
From: sbaugh@HIDDEN
Subject: Re: bug#67310: [PATCH] Include the project--list as history when
 prompting for a project
In-Reply-To: <8c67f590-d31a-44be-1c33-c0c75e4da63c@HIDDEN> (Dmitry Gutov's
 message of "Tue, 12 Dec 2023 02:21:07 +0200")
References: <ier8r6s42on.fsf@HIDDEN>
 <dc5ad8f4-b857-ea87-d178-bae903cee517@HIDDEN>
 <421e3ea8-d150-566e-f645-cbf1ccbcba61@HIDDEN>
 <ier34wz3zkx.fsf@HIDDEN>
 <81b6ed58-3fdc-3b5a-41a9-84d66475d5f1@HIDDEN>
 <ierr0khlq19.fsf@HIDDEN>
 <5c3eb6a1-38da-8af4-419a-e0567b163e3a@HIDDEN>
 <iercyw1l6rz.fsf@HIDDEN>
 <dc3b5328-8719-8948-e617-e3e8cf13f274@HIDDEN>
 <ier8r6nkv58.fsf@HIDDEN> <8634wr6s1t.fsf@HIDDEN>
 <dfbd2b3e-a14b-b5b4-a7c0-aa837ea6220c@HIDDEN>
 <861qbujehq.fsf@HIDDEN>
 <780dbb13-c0ca-9082-936b-3c2ab34084dc@HIDDEN>
 <861qbtq630.fsf@HIDDEN>
 <8c67f590-d31a-44be-1c33-c0c75e4da63c@HIDDEN>
Date: Thu, 14 Dec 2023 01:02:58 +0000 (UTC)
Message-ID: <87wmthtx5p.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
X-SG-EID: =?us-ascii?Q?ZgbRq7gjGrt0q=2FPjvxk7wM0yQFRdOkTJAtEbkjCkHbJVsJKTyi3du9eES3s+64?=
 =?us-ascii?Q?dPxmY181xWJM9fipML=2FwNdFZ=2FNA3hVG6Rwfh4vj?=
 =?us-ascii?Q?+qxFuq+qcwAB5ryFbvKJTjqcVSjsfGE7L5YNyTV?=
 =?us-ascii?Q?Qi8Ge9YtWYM7bWBcAyKHUsCQ8numvFdDMa1++pY?=
 =?us-ascii?Q?x7vt3HS9dju+KuAGKOEqjZHU6P5Pyxuqcmw=3D=3D?=
To: Dmitry Gutov <dmitry@HIDDEN>
X-Entity-ID: d/0VcHixlS0t7iB1YKCv4Q==
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 67310
Cc: 67310 <at> debbugs.gnu.org, Spencer Baugh <sbaugh@HIDDEN>, eliz@HIDDEN,
 Juri Linkov <juri@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.2 (/)

Dmitry Gutov <dmitry@HIDDEN> writes:
> On 11/12/2023 19:12, Juri Linkov wrote:
>>>>>> This change broke the order of 'C-x p p M-n M-n ...',
>>>>> Could you remind me which behavior in 'M-n M-n' the aforementioned change
>>>>> relates to? Is this supposed to be like input history as well, or the
>>>>> contents of the completions table in a certain order?
>>>> It's inappropriate to overwrite the history with the recently visited projects.
>>>> Only user input should be added to history variables because it's actually
>>>> the history of user input.  Therefore, the remaining way to access a list
>>>> of recently visited projects is the future history with 'M-n M-n'.
>>>
>>> But... we do overwrite it now, manually constructing the value of input
>>> history from project--list every time.
>>>
>>> So it seems like both "past history" and "future history" show the same
>>> information now. If so, it might make sense to keep only one.
>> It's usually not good to overwrite past history.  So it's better
>> to keep only future history.
>
> I'm not sure the actual input history is useful here: in most cases,
> it will be empty or almost empty. project history is different from
> all others because we almost always detect it automatically. And also
> because the total set of projects is relatively small, for each user.
>
> And "future history" is different for every command, including the
> logic of how it's formed. Most users are also unaware of its
> existence, so it wouldn't be a good idea to rely only on it.

Yes, I think it's okay for project history to be treated as minibuffer
history even though it's not actual input history.  It's not a huge
deal, especially since the history didn't exist before.

I worry that making M-n produce project--list and M-p produce input
history will be confusing for users.  It would be like how history and
defaults in switch-to-buffer works, which is also quite confusing.  I
personally have no intuitive grasp of when I should use history and
which I should use defaults in switch-to-buffer.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#67310; Package emacs. Full text available.

Message received at 67310 <at> debbugs.gnu.org:


Received: (at 67310) by debbugs.gnu.org; 12 Dec 2023 00:21:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Dec 11 19:21:40 2023
Received: from localhost ([127.0.0.1]:55013 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rCqWp-00022z-GL
	for submit <at> debbugs.gnu.org; Mon, 11 Dec 2023 19:21:39 -0500
Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:59063)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dmitry@HIDDEN>) id 1rCqWh-00022a-MP
 for 67310 <at> debbugs.gnu.org; Mon, 11 Dec 2023 19:21:38 -0500
Received: from compute5.internal (compute5.nyi.internal [10.202.2.45])
 by mailout.west.internal (Postfix) with ESMTP id AE30A320193A;
 Mon, 11 Dec 2023 19:21:10 -0500 (EST)
Received: from mailfrontend1 ([10.202.2.162])
 by compute5.internal (MEProxy); Mon, 11 Dec 2023 19:21:11 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc
 :cc:content-transfer-encoding:content-type:content-type:date
 :date:from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:subject:subject:to:to; s=fm3; t=1702340470;
 x=1702426870; bh=dXEY2DoUD7ndk4PVtJz1uy2Eoq/yrEHdLgbhf7GKnfc=; b=
 G4cmOrF2lnf/ls4MukfH56IplYR18xknDFdbymonhOSbheIO2TmFmTeOY0kqjm0g
 1p9VTWLHHubP5KBuYtQMtoOX7b2vA2gUab7Fil6zVeWeSkqpjFTcHonPLRegCAj4
 QqtGd38DgP9vLX15gJIa9rFBrrykBbJSPymeONw/bVBK9iHoVtFn2Nut5kICZLSV
 y8HJJk4XNZe0L632vS3Q8uQs32iNlcSaFb1TqRoWGP6aGUHHb+2sTGg7CkMziY+E
 1kIgkRyCUQcfOGmC7LGmT3lcyM4GH7G7p147qlMitozTgvn9ImwrstriqXQsGc3H
 MTvclBeO0njidrBZvonbyQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-transfer-encoding
 :content-type:content-type:date:date:feedback-id:feedback-id
 :from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy
 :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1702340470; x=
 1702426870; bh=dXEY2DoUD7ndk4PVtJz1uy2Eoq/yrEHdLgbhf7GKnfc=; b=F
 I9pEd6lk5qPit+V2Rzw6hSRuJGuaA/Iop4VSJfM0S/tn1x17VgiCIMthjvSab6nQ
 mt4yRgsaXfduBqq8YLRxfF2HgzXSkhcSiutQRAb/FLzvLg6i1JP+vVUlDyKWrdmP
 G1S5WxGkwMTYb0l6/1q5PapFD7BxYelEpWGGKxHKPLndFCsR+ONV7D3PpwYVeTG2
 dBk3LVA+X7dBQLYx4UVwl4YAS0LSc6iAlNV3gSXTwgzKIJ34RSUEdyIbmtcnNjyf
 chgTkvNf1YN7Ht5A6+AsMnMdw6qqk3LgIa0g8fHRbcqao4Y5n1gH3Z7ttFPfM1qQ
 WI22yYo/VHg433TjI2jOA==
X-ME-Sender: <xms:dad3ZfUVacYHyDwwpcoYKCnmqQoTeZJx0BLd0Xyb0VeXdXJ6l7GxTg>
 <xme:dad3ZXmTSuB7LJhrBIWrMeoeEbxY0EI9RpY8tIZAdfEOrChge0JXN7vEb9bx4QeAi
 vHRUPCh7QIbGUP3cpI>
X-ME-Received: <xmr:dad3ZbbYK1kFYUmMtJhpywWzdv-FuAh07Tv3i2fx9fEh4-GTEtgLS-L1mwiDFRF8FNJEJw>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudelfedgvdduucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi
 thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth
 htvghrnhephfeutdekveeggeetteekfeejffegudduudfhueevleeftdffffeggeeivddv
 jeelnecuffhomhgrihhnpehgnhhurdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenuc
 frrghrrghmpehmrghilhhfrhhomhepughmihhtrhihsehguhhtohhvrdguvghv
X-ME-Proxy: <xmx:dad3ZaU1Cj0otyqkzo7EAT9qH3RYHW5up9C0tHIxl68bmfRB3ZGHeg>
 <xmx:dad3ZZnZ6u-Nxh7XBmplw222z9xxPckvB6rxQpjqObMa2odDYQSDXw>
 <xmx:dad3ZXe4cO7loBf4pSCX2FwefCffy-4_IEL2OqtHnLJz7q4W1Hc0VA>
 <xmx:dqd3ZewgVAFkdRk3Ih_WPIhxS-3zHu2Rl3eJOEyQnIzlLtcZOEwLeg>
Feedback-ID: i0e71465a:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon,
 11 Dec 2023 19:21:08 -0500 (EST)
Message-ID: <8c67f590-d31a-44be-1c33-c0c75e4da63c@HIDDEN>
Date: Tue, 12 Dec 2023 02:21:07 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.13.0
Subject: Re: bug#67310: [PATCH] Include the project--list as history when
 prompting for a project
Content-Language: en-US
To: Juri Linkov <juri@HIDDEN>
References: <ier8r6s42on.fsf@HIDDEN>
 <dc5ad8f4-b857-ea87-d178-bae903cee517@HIDDEN>
 <421e3ea8-d150-566e-f645-cbf1ccbcba61@HIDDEN>
 <ier34wz3zkx.fsf@HIDDEN>
 <81b6ed58-3fdc-3b5a-41a9-84d66475d5f1@HIDDEN>
 <ierr0khlq19.fsf@HIDDEN>
 <5c3eb6a1-38da-8af4-419a-e0567b163e3a@HIDDEN>
 <iercyw1l6rz.fsf@HIDDEN>
 <dc3b5328-8719-8948-e617-e3e8cf13f274@HIDDEN>
 <ier8r6nkv58.fsf@HIDDEN> <8634wr6s1t.fsf@HIDDEN>
 <dfbd2b3e-a14b-b5b4-a7c0-aa837ea6220c@HIDDEN>
 <861qbujehq.fsf@HIDDEN>
 <780dbb13-c0ca-9082-936b-3c2ab34084dc@HIDDEN>
 <861qbtq630.fsf@HIDDEN>
From: Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <861qbtq630.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -2.9 (--)
X-Debbugs-Envelope-To: 67310
Cc: 67310 <at> debbugs.gnu.org, Spencer Baugh <sbaugh@HIDDEN>, eliz@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.9 (---)

On 11/12/2023 19:12, Juri Linkov wrote:
>>>>> This change broke the order of 'C-x p p M-n M-n ...',
>>>> Could you remind me which behavior in 'M-n M-n' the aforementioned change
>>>> relates to? Is this supposed to be like input history as well, or the
>>>> contents of the completions table in a certain order?
>>> It's inappropriate to overwrite the history with the recently visited projects.
>>> Only user input should be added to history variables because it's actually
>>> the history of user input.  Therefore, the remaining way to access a list
>>> of recently visited projects is the future history with 'M-n M-n'.
>>
>> But... we do overwrite it now, manually constructing the value of input
>> history from project--list every time.
>>
>> So it seems like both "past history" and "future history" show the same
>> information now. If so, it might make sense to keep only one.
> 
> It's usually not good to overwrite past history.  So it's better
> to keep only future history.

I'm not sure the actual input history is useful here: in most cases, it 
will be empty or almost empty. project history is different from all 
others because we almost always detect it automatically. And also 
because the total set of projects is relatively small, for each user.

And "future history" is different for every command, including the logic 
of how it's formed. Most users are also unaware of its existence, so it 
wouldn't be a good idea to rely only on it.

>>>> I just tried find-file, and the future history is empty there, so I suppose
>>>> this is something we added particularly for project-find-file.
>>> Unlike with project--list, we don't keep a list of recently visited files.
>>> Once we conducted an experiment to add all visited files to the input file history,
>>> even when a file was visited without reading a file name in the minibuffer,
>>> e.g. by typing RET in Dired.  But no one liked this behavior.
>>
>> I don't remember that experiment,
> 
> It was in https://debbugs.gnu.org/12915#121
> 
> #+begin_src emacs-lisp
> (add-hook 'first-change-hook 'add-file-name-to-history)
> (add-hook 'find-file-hook 'add-file-name-to-history)
> (defun add-file-name-to-history ()
>    (when (and buffer-file-name (not buffer-read-only))
>      (add-to-history 'file-name-history buffer-file-name)))
> #+end_src
> 
> but this clutters the file history too much.

That makes sense.

>> but the description sounds like recentf. Which must have its audience
>> (and I use it through Ido's "virtual buffers").
> 
> 'recentf-list' looks like the right thing to add to future history
> of 'C-x C-f', but not to its past history.  This prototype works nicely:
> 
> #+begin_src emacs-lisp
> (define-advice find-file (:around (ofun &rest args) recentf-list)
>    (interactive (lambda (spec)
>                   (minibuffer-with-setup-hook
>                       (lambda ()
>                         (when (featurep 'recentf)
>                           (setq-local minibuffer-default-add-function
>                                       (lambda () recentf-list))))
>                     (advice-eval-interactive-spec spec))))
>    (apply ofun args))
> #+end_src
> 
> so this could be enabled by default when recentf.el is loaded.

Interesting. This way the difference between "forward history" and the 
regular one happens due to "exotic" ways to visit a file. E.g. from 
ido's "virtual buffers", or 'M-x recentf', to some older versions of 
project-find-file. I might actually be happy if they showed up in 
find-file's history too. Though if we're talking about buffers restored 
by desktop-read, for example, then no. The problem is messing with 
history's order.

Anyway, I'm mildly positive on your suggestion above, but it's probably 
a good idea to ask somebody else as well.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#67310; Package emacs. Full text available.

Message received at 67310 <at> debbugs.gnu.org:


Received: (at 67310) by debbugs.gnu.org; 11 Dec 2023 17:22:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Dec 11 12:22:01 2023
Received: from localhost ([127.0.0.1]:54502 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rCjyi-0001vb-Km
	for submit <at> debbugs.gnu.org; Mon, 11 Dec 2023 12:22:00 -0500
Received: from relay3-d.mail.gandi.net ([2001:4b98:dc4:8::223]:46539)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1rCjyd-0001uq-Pd
 for 67310 <at> debbugs.gnu.org; Mon, 11 Dec 2023 12:21:57 -0500
Received: by mail.gandi.net (Postfix) with ESMTPSA id 682F460007;
 Mon, 11 Dec 2023 17:21:33 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Dmitry Gutov <dmitry@HIDDEN>
Subject: Re: bug#67310: [PATCH] Include the project--list as history when
 prompting for a project
In-Reply-To: <780dbb13-c0ca-9082-936b-3c2ab34084dc@HIDDEN> (Dmitry Gutov's
 message of "Sun, 10 Dec 2023 22:32:27 +0200")
Organization: LINKOV.NET
References: <ier8r6s42on.fsf@HIDDEN>
 <dc5ad8f4-b857-ea87-d178-bae903cee517@HIDDEN>
 <421e3ea8-d150-566e-f645-cbf1ccbcba61@HIDDEN>
 <ier34wz3zkx.fsf@HIDDEN>
 <81b6ed58-3fdc-3b5a-41a9-84d66475d5f1@HIDDEN>
 <ierr0khlq19.fsf@HIDDEN>
 <5c3eb6a1-38da-8af4-419a-e0567b163e3a@HIDDEN>
 <iercyw1l6rz.fsf@HIDDEN>
 <dc3b5328-8719-8948-e617-e3e8cf13f274@HIDDEN>
 <ier8r6nkv58.fsf@HIDDEN> <8634wr6s1t.fsf@HIDDEN>
 <dfbd2b3e-a14b-b5b4-a7c0-aa837ea6220c@HIDDEN>
 <861qbujehq.fsf@HIDDEN>
 <780dbb13-c0ca-9082-936b-3c2ab34084dc@HIDDEN>
Date: Mon, 11 Dec 2023 19:12:23 +0200
Message-ID: <861qbtq630.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 67310
Cc: 67310 <at> debbugs.gnu.org, Spencer Baugh <sbaugh@HIDDEN>, eliz@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

>>>> This change broke the order of 'C-x p p M-n M-n ...',
>>> Could you remind me which behavior in 'M-n M-n' the aforementioned change
>>> relates to? Is this supposed to be like input history as well, or the
>>> contents of the completions table in a certain order?
>> It's inappropriate to overwrite the history with the recently visited projects.
>> Only user input should be added to history variables because it's actually
>> the history of user input.  Therefore, the remaining way to access a list
>> of recently visited projects is the future history with 'M-n M-n'.
>
> But... we do overwrite it now, manually constructing the value of input
> history from project--list every time.
>
> So it seems like both "past history" and "future history" show the same
> information now. If so, it might make sense to keep only one.

It's usually not good to overwrite past history.  So it's better
to keep only future history.

>>> I just tried find-file, and the future history is empty there, so I suppose
>>> this is something we added particularly for project-find-file.
>> Unlike with project--list, we don't keep a list of recently visited files.
>> Once we conducted an experiment to add all visited files to the input file history,
>> even when a file was visited without reading a file name in the minibuffer,
>> e.g. by typing RET in Dired.  But no one liked this behavior.
>
> I don't remember that experiment,

It was in https://debbugs.gnu.org/12915#121

#+begin_src emacs-lisp
(add-hook 'first-change-hook 'add-file-name-to-history)
(add-hook 'find-file-hook 'add-file-name-to-history)
(defun add-file-name-to-history ()
  (when (and buffer-file-name (not buffer-read-only))
    (add-to-history 'file-name-history buffer-file-name)))
#+end_src

but this clutters the file history too much.

> but the description sounds like recentf. Which must have its audience
> (and I use it through Ido's "virtual buffers").

'recentf-list' looks like the right thing to add to future history
of 'C-x C-f', but not to its past history.  This prototype works nicely:

#+begin_src emacs-lisp
(define-advice find-file (:around (ofun &rest args) recentf-list)
  (interactive (lambda (spec)
                 (minibuffer-with-setup-hook
                     (lambda ()
                       (when (featurep 'recentf)
                         (setq-local minibuffer-default-add-function
                                     (lambda () recentf-list))))
                   (advice-eval-interactive-spec spec))))
  (apply ofun args))
#+end_src

so this could be enabled by default when recentf.el is loaded.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#67310; Package emacs. Full text available.

Message received at 67310 <at> debbugs.gnu.org:


Received: (at 67310) by debbugs.gnu.org; 10 Dec 2023 20:32:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Dec 10 15:32:59 2023
Received: from localhost ([127.0.0.1]:51813 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rCQTy-0004Ls-JZ
	for submit <at> debbugs.gnu.org; Sun, 10 Dec 2023 15:32:58 -0500
Received: from wout4-smtp.messagingengine.com ([64.147.123.20]:38329)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dmitry@HIDDEN>) id 1rCQTt-0004La-1b
 for 67310 <at> debbugs.gnu.org; Sun, 10 Dec 2023 15:32:56 -0500
Received: from compute1.internal (compute1.nyi.internal [10.202.2.41])
 by mailout.west.internal (Postfix) with ESMTP id 80AA93200A27;
 Sun, 10 Dec 2023 15:32:32 -0500 (EST)
Received: from mailfrontend1 ([10.202.2.162])
 by compute1.internal (MEProxy); Sun, 10 Dec 2023 15:32:32 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc
 :cc:content-transfer-encoding:content-type:content-type:date
 :date:from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:sender:subject:subject:to:to; s=fm3; t=
 1702240352; x=1702326752; bh=bIMVON/r/TNqypXSBFi73ReOGe2g4+u56U+
 UGbdQNcs=; b=xkj7zLXq7XwZD1aSBb0G8T8jpTFRHMtj2oEAsOKhfl6UF+QALV5
 FgoDlMQ2LIv0r/5h4v6tLaKo/rwL9diU4DY7LgV82ydEfTSAO+HF0auVonK43Ftj
 XF/0rIOhkWAxPqapG4sSURmoL9nI44fRsWSEF9sX72GnI2+OC+Z+EiMGpLXPXyC9
 ZMrg3sRPvRX/d8NtK0bknQCcWnkWjAHzyVbwUEFhkCgHPJOfgfoD1pMEDjtvi2eq
 OFlT7Qu/f+o67eWdiLmjZfMhwfc+0EkL0sjleEc1/3oGHR5EHe3GBLGT0ZCu0owo
 XuxsYE6ktpquyhyVWNB5oP3RyfyXtSADlQA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-transfer-encoding
 :content-type:content-type:date:date:feedback-id:feedback-id
 :from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:sender:subject:subject:to:to:x-me-proxy
 :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=
 1702240352; x=1702326752; bh=bIMVON/r/TNqypXSBFi73ReOGe2g4+u56U+
 UGbdQNcs=; b=i5lXQjcTZHRMgoa50ZhoeRQCeaUhLB1rTnaoVbTcZovT1OmnJl4
 XxzvAuaw5q2ywq0HupqMk/n+F1fGKoIgCnLW0Tnu4U3t2kzNBAFaFpbxjb6E5LyL
 zJAFCao68OXYfwba9ABlUOs/WAZQ66YrF7xOLpwo8W4B2FjCPx0YMUThEy9H0oS8
 IvZBW/60+xZHqFA9DFJxlSKC/G4RmN67xTfHWlpAl6LPi8afEM/J82rv0swd/zlI
 FP2sJv9SfjHm5hoRA36LuYJlKgFcbctx8GxQ5vYG5ySDCNM63bjFsP9ikdbQknIW
 aenQHudiwayrlO5W+wefWvh1TPIuehlpG2A==
X-ME-Sender: <xms:XyB2ZV-ngMy6SyqQSBWtMEx58nZA2AYdl_H2NMhJJle4AtmX4dhMrA>
 <xme:XyB2ZZu5sJ4gedUxC2RDaqe98tRposFauu_qK7KMzOCE-bMMqfeaT7Zx4HI6LdIfp
 A7mEaQsxp0qepaAPEo>
X-ME-Received: <xmr:XyB2ZTChRNTHqp5-p1X84sEIjx5fnb-J7qL22y1bD6y6oDNTED0fkHjdIBw57XvZXN2DfQ>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudeltddgudegtdcutefuodetggdotefrod
 ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh
 necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd
 enucfjughrpefkffggfgfuvfevfhfhjggtgfesthejredttdefjeenucfhrhhomhepffhm
 ihhtrhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrdguvghvqeenucggtffrrg
 htthgvrhhnpeeigfetveehveevffehledtueekieeikeeufeegudfgfeeghfdulefgfeev
 ledvveenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe
 gumhhithhrhiesghhuthhovhdruggvvh
X-ME-Proxy: <xmx:XyB2ZZctLYcp8cKO2sOC7heYAbA1ElK9e4wZAXRmO6Sbt15EVHQLag>
 <xmx:XyB2ZaPXqVpwE0EhqovqJq4cltotBjXFxN8GwOJmvIb6194mZsIaRA>
 <xmx:XyB2ZbneN9dbtCqmhC2esq53OusgnKALc6aTFVPgjfWpcG67Yn9l-w>
 <xmx:YCB2ZTYWLVHdNKmBDkzMsf2K7FW8vYW1dKPnahjFH0B9-wSkmSpiOg>
Feedback-ID: i0e71465a:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun,
 10 Dec 2023 15:32:30 -0500 (EST)
Message-ID: <780dbb13-c0ca-9082-936b-3c2ab34084dc@HIDDEN>
Date: Sun, 10 Dec 2023 22:32:27 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.13.0
Subject: Re: bug#67310: [PATCH] Include the project--list as history when
 prompting for a project
Content-Language: en-US
To: Juri Linkov <juri@HIDDEN>
References: <ier8r6s42on.fsf@HIDDEN>
 <dc5ad8f4-b857-ea87-d178-bae903cee517@HIDDEN>
 <421e3ea8-d150-566e-f645-cbf1ccbcba61@HIDDEN>
 <ier34wz3zkx.fsf@HIDDEN>
 <81b6ed58-3fdc-3b5a-41a9-84d66475d5f1@HIDDEN>
 <ierr0khlq19.fsf@HIDDEN>
 <5c3eb6a1-38da-8af4-419a-e0567b163e3a@HIDDEN>
 <iercyw1l6rz.fsf@HIDDEN>
 <dc3b5328-8719-8948-e617-e3e8cf13f274@HIDDEN>
 <ier8r6nkv58.fsf@HIDDEN> <8634wr6s1t.fsf@HIDDEN>
 <dfbd2b3e-a14b-b5b4-a7c0-aa837ea6220c@HIDDEN>
 <861qbujehq.fsf@HIDDEN>
From: Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <861qbujehq.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -2.9 (--)
X-Debbugs-Envelope-To: 67310
Cc: 67310 <at> debbugs.gnu.org, Spencer Baugh <sbaugh@HIDDEN>, eliz@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.9 (---)

On 10/12/2023 19:43, Juri Linkov wrote:
>>> This change broke the order of 'C-x p p M-n M-n ...',
>> Could you remind me which behavior in 'M-n M-n' the aforementioned change
>> relates to? Is this supposed to be like input history as well, or the
>> contents of the completions table in a certain order?
> It's inappropriate to overwrite the history with the recently visited projects.
> Only user input should be added to history variables because it's actually
> the history of user input.  Therefore, the remaining way to access a list
> of recently visited projects is the future history with 'M-n M-n'.

But... we do overwrite it now, manually constructing the value of input 
history from project--list every time.

So it seems like both "past history" and "future history" show the same 
information now. If so, it might make sense to keep only one.

>> I just tried find-file, and the future history is empty there, so I suppose
>> this is something we added particularly for project-find-file.
> Unlike with project--list, we don't keep a list of recently visited files.
> Once we conducted an experiment to add all visited files to the input file history,
> even when a file was visited without reading a file name in the minibuffer,
> e.g. by typing RET in Dired.  But no one liked this behavior.

I don't remember that experiment, but the description sounds like 
recentf. Which must have its audience (and I use it through Ido's 
"virtual buffers").

Thought the way of accessing that history (only through iteration) might 
have felt limiting in that experiment.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#67310; Package emacs. Full text available.

Message received at 67310 <at> debbugs.gnu.org:


Received: (at 67310) by debbugs.gnu.org; 10 Dec 2023 17:54:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Dec 10 12:54:32 2023
Received: from localhost ([127.0.0.1]:51760 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rCO0d-0000C3-Oj
	for submit <at> debbugs.gnu.org; Sun, 10 Dec 2023 12:54:32 -0500
Received: from relay8-d.mail.gandi.net ([217.70.183.201]:54053)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1rCO0c-0000Ak-2Q
 for 67310 <at> debbugs.gnu.org; Sun, 10 Dec 2023 12:54:30 -0500
Received: by mail.gandi.net (Postfix) with ESMTPSA id 32D921BF203;
 Sun, 10 Dec 2023 17:54:07 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Dmitry Gutov <dmitry@HIDDEN>
Subject: Re: bug#67310: [PATCH] Include the project--list as history when
 prompting for a project
In-Reply-To: <dfbd2b3e-a14b-b5b4-a7c0-aa837ea6220c@HIDDEN> (Dmitry Gutov's
 message of "Sun, 10 Dec 2023 05:04:27 +0200")
Organization: LINKOV.NET
References: <ier8r6s42on.fsf@HIDDEN>
 <dc5ad8f4-b857-ea87-d178-bae903cee517@HIDDEN>
 <421e3ea8-d150-566e-f645-cbf1ccbcba61@HIDDEN>
 <ier34wz3zkx.fsf@HIDDEN>
 <81b6ed58-3fdc-3b5a-41a9-84d66475d5f1@HIDDEN>
 <ierr0khlq19.fsf@HIDDEN>
 <5c3eb6a1-38da-8af4-419a-e0567b163e3a@HIDDEN>
 <iercyw1l6rz.fsf@HIDDEN>
 <dc3b5328-8719-8948-e617-e3e8cf13f274@HIDDEN>
 <ier8r6nkv58.fsf@HIDDEN> <8634wr6s1t.fsf@HIDDEN>
 <dfbd2b3e-a14b-b5b4-a7c0-aa837ea6220c@HIDDEN>
Date: Sun, 10 Dec 2023 19:43:21 +0200
Message-ID: <861qbujehq.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 67310
Cc: 67310 <at> debbugs.gnu.org, Spencer Baugh <sbaugh@HIDDEN>, eliz@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

>> This change broke the order of 'C-x p p M-n M-n ...',
>
> Could you remind me which behavior in 'M-n M-n' the aforementioned change
> relates to? Is this supposed to be like input history as well, or the
> contents of the completions table in a certain order?

It's inappropriate to overwrite the history with the recently visited projects.
Only user input should be added to history variables because it's actually
the history of user input.  Therefore, the remaining way to access a list
of recently visited projects is the future history with 'M-n M-n'.

> I just tried find-file, and the future history is empty there, so I suppose
> this is something we added particularly for project-find-file.

Unlike with project--list, we don't keep a list of recently visited files.
Once we conducted an experiment to add all visited files to the input file history,
even when a file was visited without reading a file name in the minibuffer,
e.g. by typing RET in Dired.  But no one liked this behavior.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#67310; Package emacs. Full text available.

Message received at 67310 <at> debbugs.gnu.org:


Received: (at 67310) by debbugs.gnu.org; 10 Dec 2023 03:04:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Dec 09 22:04:53 2023
Received: from localhost ([127.0.0.1]:49261 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rCA7h-00083P-H5
	for submit <at> debbugs.gnu.org; Sat, 09 Dec 2023 22:04:53 -0500
Received: from wout4-smtp.messagingengine.com ([64.147.123.20]:34321)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dmitry@HIDDEN>) id 1rCA7e-00083A-Jc
 for 67310 <at> debbugs.gnu.org; Sat, 09 Dec 2023 22:04:52 -0500
Received: from compute1.internal (compute1.nyi.internal [10.202.2.41])
 by mailout.west.internal (Postfix) with ESMTP id B9A073200A19;
 Sat,  9 Dec 2023 22:04:30 -0500 (EST)
Received: from mailfrontend1 ([10.202.2.162])
 by compute1.internal (MEProxy); Sat, 09 Dec 2023 22:04:31 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc
 :cc:content-transfer-encoding:content-type:content-type:date
 :date:from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:sender:subject:subject:to:to; s=fm3; t=
 1702177470; x=1702263870; bh=ba2TRYhNb/dNiC7W8+HOr8PLB5sbtfLHiYG
 tkSgDrHo=; b=lWW32TALu7bq9bEbmJTSqWSPvzdu1N+TT/VZ1/04/TL3XJnqMgi
 BEAS97CONHDrSevlz1wuluYRmhxe2wBD0PABXJFSa+HdOzoj0wA7covMeiSiD4hu
 Vf3d445/mPrjNu3BNz4VzOOir6FTGFlcH68ipx9wG4Ph15xJ4ovDm05rE/XdSm41
 Fu+lvEw7TOgKBe3G0jhy+hGQA5s+O+VPg5LRk+Mn44+SQdtaWMWoF3HOzNZZz9QQ
 unQ/x8bz2KRz3VBOnPQBUxBO7DAphyKQyz5ySD/YjFeYIMbCrALTOixAAdktgQy0
 H1KJipa+SxIJGPfgY4zVTS+AkxBnjlo7gYQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-transfer-encoding
 :content-type:content-type:date:date:feedback-id:feedback-id
 :from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:sender:subject:subject:to:to:x-me-proxy
 :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=
 1702177470; x=1702263870; bh=ba2TRYhNb/dNiC7W8+HOr8PLB5sbtfLHiYG
 tkSgDrHo=; b=e00dwjZwNKEePoj+qE6+2kSSHbMoQBwIFvTC8uooy+QUBasEeC7
 V5oRWRLMW0bCcR2CCNNQe/kl/MLrqB/Q3pB5utgY7Uz4QqQrPZG8IX7sM83jvFDZ
 i0hbKVGuVOz9yXkDMb/lOotLOTiu2L7WmaIuiZJuhq9iIyQkO4/m0sIxk0kJrYAo
 vzCmruSZOj607jhll4p9p9ia9ffBdq8gu/2xq9mq1ECzFE0VVHV3za5yOIXeFUFu
 Yhuksb5G9ecbBTZcDRdxd+qGv3Egr8Rlb8aq1Ec/bucZ6qU62HdUr/mP/yZfzGmm
 +2u0yY8rogGZxor8CFkTb7Mlf6rkQyCYZOg==
X-ME-Sender: <xms:vSp1Zf4kcbk6xH9qKL77ubOhoF9bC9oMWqtgnKphKjq_3GoDqHd3MQ>
 <xme:vSp1ZU4Qh0K6520I_iDL0H4BSc2aV-4vhDxN3nR6F2zbsCRt5X6e3VQYJwqhG_dTH
 UTFH3Owr7JUHqEa7qo>
X-ME-Received: <xmr:vSp1ZWddcE_xK7kXjNplJNwAcrrd78zlLRmuAZKDYe7qnn1J2Hp5LmH2REa1ynujJA1zlw>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudekledgheehucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi
 thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth
 htvghrnhepiefgteevheevveffheeltdeukeeiieekueefgedugfefgefhudelgfefveel
 vdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug
 hmihhtrhihsehguhhtohhvrdguvghv
X-ME-Proxy: <xmx:vip1ZQK7mXhX0VPAaMGf_L_3JA6BgPWRTgv-AGfpKLC07Kz-oz1hhw>
 <xmx:vip1ZTIwlNVf3l8gJZHGN5VHlOkAURPIIfbZJC3hNp-QoQL4lBFuPA>
 <xmx:vip1ZZwNZF5se7VkMFJtI4g7VO_SSWwauAgkgMnOh9tFPIC7RsVkKg>
 <xmx:vip1ZaVRDlQIkuTtQbdiDRwSCDClzU3FRu39fIK4HgIBRM_-nAJMGw>
Feedback-ID: i0e71465a:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat,
 9 Dec 2023 22:04:28 -0500 (EST)
Message-ID: <dfbd2b3e-a14b-b5b4-a7c0-aa837ea6220c@HIDDEN>
Date: Sun, 10 Dec 2023 05:04:27 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.13.0
Subject: Re: bug#67310: [PATCH] Include the project--list as history when
 prompting for a project
Content-Language: en-US
To: Juri Linkov <juri@HIDDEN>, Spencer Baugh <sbaugh@HIDDEN>
References: <ier8r6s42on.fsf@HIDDEN>
 <dc5ad8f4-b857-ea87-d178-bae903cee517@HIDDEN>
 <421e3ea8-d150-566e-f645-cbf1ccbcba61@HIDDEN>
 <ier34wz3zkx.fsf@HIDDEN>
 <81b6ed58-3fdc-3b5a-41a9-84d66475d5f1@HIDDEN>
 <ierr0khlq19.fsf@HIDDEN>
 <5c3eb6a1-38da-8af4-419a-e0567b163e3a@HIDDEN>
 <iercyw1l6rz.fsf@HIDDEN>
 <dc3b5328-8719-8948-e617-e3e8cf13f274@HIDDEN>
 <ier8r6nkv58.fsf@HIDDEN> <8634wr6s1t.fsf@HIDDEN>
From: Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <8634wr6s1t.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -2.2 (--)
X-Debbugs-Envelope-To: 67310
Cc: 67310 <at> debbugs.gnu.org, eliz@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.9 (---)

Hi Juri,

On 27/11/2023 19:10, Juri Linkov wrote:
>> +            ;; Iterate in reverse order so project--name-history is in
>> +            ;; the correct order.
>> +            (dolist (dir (reverse (project-known-project-roots)))
>>                 ;; we filter out directories that no longer map to a project,
>>                 ;; since they don't have a clean project-name.
>> -              (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))))
> This change broke the order of 'C-x p p M-n M-n ...',
> so I pushed this fix:
> 
> diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
> index f7f057396e1..a81bb63fba4 100644
> --- a/lisp/progmodes/project.el
> +++ b/lisp/progmodes/project.el
> @@ -1808,7 +1808,7 @@ project-prompt-project-name
>                            (name (project-name proj)))
>                   (push name project--name-history)
>                   (push (cons name proj) ret)))
> -            ret))
> +            (reverse ret)))
>            ;; XXX: Just using this for the category (for the substring
>            ;; completion style).
>            (table (project--file-completion-table

Could you remind me which behavior in 'M-n M-n' the aforementioned 
change relates to? Is this supposed to be like input history as well, or 
the contents of the completions table in a certain order?

I just tried find-file, and the future history is empty there, so I 
suppose this is something we added particularly for project-find-file.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#67310; Package emacs. Full text available.

Message received at 67310 <at> debbugs.gnu.org:


Received: (at 67310) by debbugs.gnu.org; 27 Nov 2023 17:11:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Nov 27 12:11:49 2023
Received: from localhost ([127.0.0.1]:44672 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r7f9B-0005nG-5x
	for submit <at> debbugs.gnu.org; Mon, 27 Nov 2023 12:11:49 -0500
Received: from relay9-d.mail.gandi.net ([2001:4b98:dc4:8::229]:51715)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1r7f98-0005n0-TX
 for 67310 <at> debbugs.gnu.org; Mon, 27 Nov 2023 12:11:47 -0500
Received: by mail.gandi.net (Postfix) with ESMTPSA id 9AF1DFF817;
 Mon, 27 Nov 2023 17:11:32 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Spencer Baugh <sbaugh@HIDDEN>
Subject: Re: bug#67310: [PATCH] Include the project--list as history when
 prompting for a project
In-Reply-To: <ier8r6nkv58.fsf@HIDDEN> (Spencer Baugh's message of
 "Fri, 24 Nov 2023 10:50:43 -0500")
Organization: LINKOV.NET
References: <ier8r6s42on.fsf@HIDDEN>
 <dc5ad8f4-b857-ea87-d178-bae903cee517@HIDDEN>
 <421e3ea8-d150-566e-f645-cbf1ccbcba61@HIDDEN>
 <ier34wz3zkx.fsf@HIDDEN>
 <81b6ed58-3fdc-3b5a-41a9-84d66475d5f1@HIDDEN>
 <ierr0khlq19.fsf@HIDDEN>
 <5c3eb6a1-38da-8af4-419a-e0567b163e3a@HIDDEN>
 <iercyw1l6rz.fsf@HIDDEN>
 <dc3b5328-8719-8948-e617-e3e8cf13f274@HIDDEN>
 <ier8r6nkv58.fsf@HIDDEN>
Date: Mon, 27 Nov 2023 19:10:22 +0200
Message-ID: <8634wr6s1t.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 67310
Cc: 67310 <at> debbugs.gnu.org, Dmitry Gutov <dmitry@HIDDEN>, eliz@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

> +            ;; Iterate in reverse order so project--name-history is in
> +            ;; the correct order.
> +            (dolist (dir (reverse (project-known-project-roots)))
>                ;; we filter out directories that no longer map to a project,
>                ;; since they don't have a clean project-name.
> -              (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))))

This change broke the order of 'C-x p p M-n M-n ...',
so I pushed this fix:

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index f7f057396e1..a81bb63fba4 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -1808,7 +1808,7 @@ project-prompt-project-name
                          (name (project-name proj)))
                 (push name project--name-history)
                 (push (cons name proj) ret)))
-            ret))
+            (reverse ret)))
          ;; XXX: Just using this for the category (for the substring
          ;; completion style).
          (table (project--file-completion-table




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#67310; Package emacs. Full text available.

Message received at 67310 <at> debbugs.gnu.org:


Received: (at 67310) by debbugs.gnu.org; 25 Nov 2023 18:21:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Nov 25 13:21:34 2023
Received: from localhost ([127.0.0.1]:40183 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r6xHa-0002OQ-1B
	for submit <at> debbugs.gnu.org; Sat, 25 Nov 2023 13:21:34 -0500
Received: from relay2-d.mail.gandi.net ([2001:4b98:dc4:8::222]:36929)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1r6xHY-0002OB-2U
 for 67310 <at> debbugs.gnu.org; Sat, 25 Nov 2023 13:21:32 -0500
Received: by mail.gandi.net (Postfix) with ESMTPSA id 8EC5140003;
 Sat, 25 Nov 2023 18:21:19 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Spencer Baugh <sbaugh@HIDDEN>
Subject: Re: bug#67310: [PATCH] Include the project--list as history when
 prompting for a project
In-Reply-To: <ier8r6nkv58.fsf@HIDDEN> (Spencer Baugh's message of
 "Fri, 24 Nov 2023 10:50:43 -0500")
Organization: LINKOV.NET
References: <ier8r6s42on.fsf@HIDDEN>
 <dc5ad8f4-b857-ea87-d178-bae903cee517@HIDDEN>
 <421e3ea8-d150-566e-f645-cbf1ccbcba61@HIDDEN>
 <ier34wz3zkx.fsf@HIDDEN>
 <81b6ed58-3fdc-3b5a-41a9-84d66475d5f1@HIDDEN>
 <ierr0khlq19.fsf@HIDDEN>
 <5c3eb6a1-38da-8af4-419a-e0567b163e3a@HIDDEN>
 <iercyw1l6rz.fsf@HIDDEN>
 <dc3b5328-8719-8948-e617-e3e8cf13f274@HIDDEN>
 <ier8r6nkv58.fsf@HIDDEN>
Date: Sat, 25 Nov 2023 19:50:42 +0200
Message-ID: <86cyvx211t.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 67310
Cc: 67310 <at> debbugs.gnu.org, Dmitry Gutov <dmitry@HIDDEN>, eliz@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

> (Perhaps I should find a better workflow for submitting patches than
> manually running format-patch and copy-pasting the resulting patch to
> attach it to a subsequent email)

There is a new command 'vc-prepare-patch' in Emacs 29, maybe it could help.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#67310; Package emacs. Full text available.

Message received at 67310 <at> debbugs.gnu.org:


Received: (at 67310) by debbugs.gnu.org; 25 Nov 2023 16:36:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Nov 25 11:36:10 2023
Received: from localhost ([127.0.0.1]:40098 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r6vda-0005DT-8W
	for submit <at> debbugs.gnu.org; Sat, 25 Nov 2023 11:36:10 -0500
Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:37299)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dmitry@HIDDEN>) id 1r6vdX-0005Cp-U5
 for 67310 <at> debbugs.gnu.org; Sat, 25 Nov 2023 11:36:08 -0500
Received: from compute5.internal (compute5.nyi.internal [10.202.2.45])
 by mailout.west.internal (Postfix) with ESMTP id 6FBB132005C1;
 Sat, 25 Nov 2023 11:35:56 -0500 (EST)
Received: from mailfrontend1 ([10.202.2.162])
 by compute5.internal (MEProxy); Sat, 25 Nov 2023 11:35:56 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc
 :cc:content-transfer-encoding:content-type:content-type:date
 :date:from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:sender:subject:subject:to:to; s=fm3; t=
 1700930155; x=1701016555; bh=+oryC+pfLZHH08DztNfrW/n0HDvKrq42HRV
 rwdC7quY=; b=KuvSBYdYjFi3he0UShNwEVb94GLjnMfiHwbdw+hpHdK2E0HG5vh
 R/z3Rd1D3PePTjcfqB0IxVp5VQx4HUwSl309svy1SEeFIVbJgoajKME0Gse71pC5
 Z4g7q4DsTIcAhADekea+8NfQy1mKjHbOdQhRgnIga08/8020IrkSS61aBk5dg8Ct
 wNW/q6GTou8e2s5Sz+atqnFfbXx0iDNByEDBNipXThV6LtJTbfwBUjYNhROBBM8m
 xKN/rawPT/uP1WwHBIG4t0RmsTq5Epm+NQky/ny0fWSzo7+FqzHocphtoZ/3Oq/l
 gmVCAuekY4TzhoYQr2gHOY5U+wG32/STOsw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-transfer-encoding
 :content-type:content-type:date:date:feedback-id:feedback-id
 :from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:sender:subject:subject:to:to:x-me-proxy
 :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=
 1700930155; x=1701016555; bh=+oryC+pfLZHH08DztNfrW/n0HDvKrq42HRV
 rwdC7quY=; b=Ljg254asJk/EjykHL7fHDZ1Y7Pran1WEf8ysdr685SutNdE4PMJ
 rZlLuUjrebrCq8H6J3C2/lE4LhsbCfanTbHm8cVkAc87XZva1FoXho0td9OiH04o
 O9APRKsL22MheIC1JfjtSrj/gVYcIcWp4oYPXdJfsQA+r1xOFcrfnYmjY/viT1Az
 U6R9RedJn2c5W0xmzOzJ9akLyFhV9fhhvMVdXPkhwUFtxJQoWHJMRHIEK3gQocMW
 JzUAOWz5FQ4yxZ2wuRJS/++9rYaD31Fj+nezJ+vHQs9nsmSEKBHvKgFWph6bWcYf
 WeWQ4FlzeFwbeymd8OIpdsCN2GkXPvvMQlA==
X-ME-Sender: <xms:ayJiZfoGCl6laGXaxl7O0TTeD5KsXqYa0GjMgD-bHRKt0KiIlCCPnA>
 <xme:ayJiZZqw946xluuNGRVGCYAfihbu6ATi5I6AzaCw006jQtJzSS3I68E_IJe-022ca
 LwsCViqlCZIL-0_MKE>
X-ME-Received: <xmr:ayJiZcPleLmYZTCo4SJPwIibyUhPlWzJCnwyojLDLoOsgFUZybr38X53-5D3c-wTwC2gKQ>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudehjedgkeelucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi
 thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth
 htvghrnhepiefgteevheevveffheeltdeukeeiieekueefgedugfefgefhudelgfefveel
 vdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug
 hmihhtrhihsehguhhtohhvrdguvghv
X-ME-Proxy: <xmx:ayJiZS5yjsW3HhKzsI7ScbolKAMJM5BHNnkb999sEw8qE7yuILKggw>
 <xmx:ayJiZe6153r5JTwh5yY-_IBHrmZ3zFh2EO1DmmdsGHaZoJX52gIGBQ>
 <xmx:ayJiZajmah5JsGhjL2XugutLGV2N9mtwJNGBWDsNE6oDp-DzMdwiRg>
 <xmx:ayJiZeFSDpz_CS9gzCLg6TVEgHWjxrTLwpL3_uv2Jc7dKMD17mROtg>
Feedback-ID: i0e71465a:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat,
 25 Nov 2023 11:35:54 -0500 (EST)
Message-ID: <e53ebe02-27eb-5761-f401-efed5f45089a@HIDDEN>
Date: Sat, 25 Nov 2023 18:35:51 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.13.0
Subject: Re: bug#67310: [PATCH] Include the project--list as history when
 prompting for a project
Content-Language: en-US
To: Eli Zaretskii <eliz@HIDDEN>
References: <ier8r6s42on.fsf@HIDDEN>
 <dc5ad8f4-b857-ea87-d178-bae903cee517@HIDDEN>
 <421e3ea8-d150-566e-f645-cbf1ccbcba61@HIDDEN>
 <ier34wz3zkx.fsf@HIDDEN>
 <81b6ed58-3fdc-3b5a-41a9-84d66475d5f1@HIDDEN>
 <ierr0khlq19.fsf@HIDDEN>
 <5c3eb6a1-38da-8af4-419a-e0567b163e3a@HIDDEN>
 <iercyw1l6rz.fsf@HIDDEN> <83bkblgeja.fsf@HIDDEN>
 <ab8f5ad1-356e-e90d-eab4-d36a0b0821fc@HIDDEN> <83edgedy1j.fsf@HIDDEN>
 <96636783-62bb-0bb1-ecb5-c510630402e3@HIDDEN> <83zfz1c4am.fsf@HIDDEN>
 <7a354d33-54b6-cc51-f9f4-58ee14380852@HIDDEN> <83v89pbzc9.fsf@HIDDEN>
From: Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <83v89pbzc9.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -2.9 (--)
X-Debbugs-Envelope-To: 67310
Cc: 67310 <at> debbugs.gnu.org, sbaugh@HIDDEN, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.9 (---)

On 25/11/2023 17:57, Eli Zaretskii wrote:
>> Date: Sat, 25 Nov 2023 17:06:06 +0200
>> Cc:sbaugh@HIDDEN,67310 <at> debbugs.gnu.org,juri@HIDDEN
>> From: Dmitry Gutov<dmitry@HIDDEN>
>>
>> On 25/11/2023 16:10, Eli Zaretskii wrote:
>>>> Date: Sat, 25 Nov 2023 16:05:03 +0200
>>>> Cc:sbaugh@HIDDEN,67310 <at> debbugs.gnu.org,juri@HIDDEN
>>>> From: Dmitry Gutov<dmitry@HIDDEN>
>>>>
>>>>> I generally request and expect people not to make unnecessary changes,
>>>>> since doing that makes forensics harder: you see changes which don't
>>>>> change the code's semantics, and need to waste time studying such
>>>>> "changes" and deciding that they are no-ops.
>>>>>
>>>>> Please everyone keep this in mind when you make changes.
>>>> In general we don't frown in making minor cosmetic changes in the same
>>>> area as major meaningful changes are done.
>>> Yes, if the changes are for the better.  In this case, they seem to be
>>> due to someone's personal stylistic preferences, so their value is
>>> questionable at best.
>> I generally allow stylistic preferences when they don't run counter to
>> mine. That's better for contributors' morale, for one thing.
> I suggest what I think is a better principle: the stylistic
> preferences of the original author always take precedence.  This is
> better both for the original author's morale (as in "something will
> always be left of my contribution"), and for forensics, as I explained.

That's also a good consideration.

In our case, the contributor and the original author were the same person.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#67310; Package emacs. Full text available.

Message received at 67310 <at> debbugs.gnu.org:


Received: (at 67310) by debbugs.gnu.org; 25 Nov 2023 15:57:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Nov 25 10:57:35 2023
Received: from localhost ([127.0.0.1]:40062 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r6v2E-000454-LW
	for submit <at> debbugs.gnu.org; Sat, 25 Nov 2023 10:57:35 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:46826)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1r6v2C-00044p-LC
 for 67310 <at> debbugs.gnu.org; Sat, 25 Nov 2023 10:57:33 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1r6v21-0005MA-17; Sat, 25 Nov 2023 10:57:21 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=79f+Msf9x3gpHxZ8XebaFqOrwPyo/UB83QQAzewOJKM=; b=BZOjwbXJWTEJ
 W1X+shN/RNVM0olqX3/vNyPOMxpZwOibNOoaeEDBgrrrW206eapgYoPS16gMAPAY8B/5BFMQfnN/H
 e7AMht5octnpyEVeyUG6x13byraZP5EWAUctFsDm/ZI728++7GNuht9IgiP57ddctmcuN/CfsYxFU
 HGU1FitPas5iUnlXclz2zim9VJwuVdo2BOYUtkRHfe1NRRaqwMV8g3iTvg4Vx8dEqhh7bkDxqnl7P
 0fpA0yfYTrVTrQvmo5yu+XSiylba486ND3QJwbcXGbPjrB9jJ0hq86m5yirwcgsGnXjKehMoYML8d
 uQlo69AxKfUukgWitfB9qg==;
Date: Sat, 25 Nov 2023 17:57:10 +0200
Message-Id: <83v89pbzc9.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <7a354d33-54b6-cc51-f9f4-58ee14380852@HIDDEN> (message from
 Dmitry Gutov on Sat, 25 Nov 2023 17:06:06 +0200)
Subject: Re: bug#67310: [PATCH] Include the project--list as history when
 prompting for a project
References: <ier8r6s42on.fsf@HIDDEN>
 <dc5ad8f4-b857-ea87-d178-bae903cee517@HIDDEN>
 <421e3ea8-d150-566e-f645-cbf1ccbcba61@HIDDEN>
 <ier34wz3zkx.fsf@HIDDEN>
 <81b6ed58-3fdc-3b5a-41a9-84d66475d5f1@HIDDEN>
 <ierr0khlq19.fsf@HIDDEN>
 <5c3eb6a1-38da-8af4-419a-e0567b163e3a@HIDDEN>
 <iercyw1l6rz.fsf@HIDDEN> <83bkblgeja.fsf@HIDDEN>
 <ab8f5ad1-356e-e90d-eab4-d36a0b0821fc@HIDDEN> <83edgedy1j.fsf@HIDDEN>
 <96636783-62bb-0bb1-ecb5-c510630402e3@HIDDEN> <83zfz1c4am.fsf@HIDDEN>
 <7a354d33-54b6-cc51-f9f4-58ee14380852@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 67310
Cc: 67310 <at> debbugs.gnu.org, sbaugh@HIDDEN, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Sat, 25 Nov 2023 17:06:06 +0200
> Cc: sbaugh@HIDDEN, 67310 <at> debbugs.gnu.org, juri@HIDDEN
> From: Dmitry Gutov <dmitry@HIDDEN>
> 
> On 25/11/2023 16:10, Eli Zaretskii wrote:
> >> Date: Sat, 25 Nov 2023 16:05:03 +0200
> >> Cc:sbaugh@HIDDEN,67310 <at> debbugs.gnu.org,juri@HIDDEN
> >> From: Dmitry Gutov<dmitry@HIDDEN>
> >>
> >>> I generally request and expect people not to make unnecessary changes,
> >>> since doing that makes forensics harder: you see changes which don't
> >>> change the code's semantics, and need to waste time studying such
> >>> "changes" and deciding that they are no-ops.
> >>>
> >>> Please everyone keep this in mind when you make changes.
> >> In general we don't frown in making minor cosmetic changes in the same
> >> area as major meaningful changes are done.
> > Yes, if the changes are for the better.  In this case, they seem to be
> > due to someone's personal stylistic preferences, so their value is
> > questionable at best.
> 
> I generally allow stylistic preferences when they don't run counter to 
> mine. That's better for contributors' morale, for one thing.

I suggest what I think is a better principle: the stylistic
preferences of the original author always take precedence.  This is
better both for the original author's morale (as in "something will
always be left of my contribution"), and for forensics, as I explained.

And I don't think this should hurt contributors' morale, since they
will know that their preferences in the code they introduce will be
kept for as long as the code is relevant, and not overwritten the next
day.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#67310; Package emacs. Full text available.

Message received at 67310 <at> debbugs.gnu.org:


Received: (at 67310) by debbugs.gnu.org; 25 Nov 2023 15:06:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Nov 25 10:06:24 2023
Received: from localhost ([127.0.0.1]:39999 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r6uEi-0002aC-By
	for submit <at> debbugs.gnu.org; Sat, 25 Nov 2023 10:06:24 -0500
Received: from wout5-smtp.messagingengine.com ([64.147.123.21]:59547)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dmitry@HIDDEN>) id 1r6uEg-0002Zy-Ao
 for 67310 <at> debbugs.gnu.org; Sat, 25 Nov 2023 10:06:23 -0500
Received: from compute1.internal (compute1.nyi.internal [10.202.2.41])
 by mailout.west.internal (Postfix) with ESMTP id D0B8C320027A;
 Sat, 25 Nov 2023 10:06:10 -0500 (EST)
Received: from mailfrontend1 ([10.202.2.162])
 by compute1.internal (MEProxy); Sat, 25 Nov 2023 10:06:11 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc
 :cc:content-transfer-encoding:content-type:content-type:date
 :date:from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:sender:subject:subject:to:to; s=fm3; t=
 1700924770; x=1701011170; bh=uOQy6AihjB70HakF14b8uQfTPetQQZMQkei
 kUMA8nAo=; b=YU6Lv2ZChczctVBE92Lq5oOKblls/XAuyi/wtGHJlrdV0oFQWMN
 TufUnbcrUZkI0dhMFZzogCPdUhm82oy9YFCvSqVKckorjzUQ/dmqpZNU0hIinMSX
 dVAZyZi6mgEIsGxNbCpenuS6QzuTsApaqqe6VgO34NyvWSpgJbxR5JAc9I7Ph0Dv
 c2xMtkOaa22udktQKfWZ2D6/BbvMoc1xGV00YR3tdOSGcD/P8evW2Pac3WXVpr5m
 pSc98TssNl3kbzJWxITVWwVRnlrsaIgkmuBn1udhl4a/7jaF8X8jwqstl4w3PyfV
 gw158I5xNegL5G2SL3VmJvjOf+HWF1wx7+Q==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-transfer-encoding
 :content-type:content-type:date:date:feedback-id:feedback-id
 :from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:sender:subject:subject:to:to:x-me-proxy
 :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=
 1700924770; x=1701011170; bh=uOQy6AihjB70HakF14b8uQfTPetQQZMQkei
 kUMA8nAo=; b=eFYYSXF4MauUMjAwJTqpF0crvXNCiGT8zmYQwN44F5r+mHVmMpW
 S9VfMNpmFdPpguhX1mA6I1KhdVe8bmPfx3U3xH5V51kuYhQpbEVCFxlIvnMDAhV4
 eiz+fFirWTCZJWMvB9JliB3G+sLqDOH56duY9asJs3oSWDDb9sFTyUZftPixbq1G
 EVRus4pumTmJPcKwPpONBYdEfY9lQwPME0SmqsFrl8kMu4lDWM8DR1xmDcs3G3at
 09VmKiyy0edNBOjpfdfM5yLzJsjovw/MzKwrrqP8Jqv0n6ETJqjEUG2WcVzu1gwb
 Fm7vqcverMRW8EUIe0A9uIy6hKtkYYgWG3A==
X-ME-Sender: <xms:YQ1iZfyRHPPbzuVF2rK2SWNARmCnlF4G4HtViilMgDN-VCIK1dl4Fg>
 <xme:YQ1iZXSsmJK8GieP19PmoaQHSMf-kOX9lhl8SoQ2CQKHK3WVJap5y2_TWlOI1IgOS
 x28DL-fBdUQbLkuIfw>
X-ME-Received: <xmr:YQ1iZZX9QSAbCoA9CHbDvYMIW_QRnQmEHXkTW1DrwJKDD-YOolxX2rZa-SNBVtQkfBMUbg>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudehjedgjeduucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi
 thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth
 htvghrnhepiefgteevheevveffheeltdeukeeiieekueefgedugfefgefhudelgfefveel
 vdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug
 hmihhtrhihsehguhhtohhvrdguvghv
X-ME-Proxy: <xmx:Yg1iZZhCLEarrzmbIlMir7i11X5wZu4IyyytKJU8yR9nV99lTDHv-Q>
 <xmx:Yg1iZRCvEBXKxPybmkhVYJs5YVkaT4VKtC_9ZJ2Sx-e41kZkvWAdEA>
 <xmx:Yg1iZSKGCbnJLMiMq92JTNHiw6LnEj1pVpx_p1RPYc0flpK4NGBY_w>
 <xmx:Yg1iZUOO_A2344bjZv5FeVArVlQAT7dlxoPOvp0Da9tM2HOxrxIqHg>
Feedback-ID: i0e71465a:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat,
 25 Nov 2023 10:06:08 -0500 (EST)
Message-ID: <7a354d33-54b6-cc51-f9f4-58ee14380852@HIDDEN>
Date: Sat, 25 Nov 2023 17:06:06 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.13.0
Subject: Re: bug#67310: [PATCH] Include the project--list as history when
 prompting for a project
Content-Language: en-US
To: Eli Zaretskii <eliz@HIDDEN>
References: <ier8r6s42on.fsf@HIDDEN>
 <dc5ad8f4-b857-ea87-d178-bae903cee517@HIDDEN>
 <421e3ea8-d150-566e-f645-cbf1ccbcba61@HIDDEN>
 <ier34wz3zkx.fsf@HIDDEN>
 <81b6ed58-3fdc-3b5a-41a9-84d66475d5f1@HIDDEN>
 <ierr0khlq19.fsf@HIDDEN>
 <5c3eb6a1-38da-8af4-419a-e0567b163e3a@HIDDEN>
 <iercyw1l6rz.fsf@HIDDEN> <83bkblgeja.fsf@HIDDEN>
 <ab8f5ad1-356e-e90d-eab4-d36a0b0821fc@HIDDEN> <83edgedy1j.fsf@HIDDEN>
 <96636783-62bb-0bb1-ecb5-c510630402e3@HIDDEN> <83zfz1c4am.fsf@HIDDEN>
From: Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <83zfz1c4am.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -2.9 (--)
X-Debbugs-Envelope-To: 67310
Cc: 67310 <at> debbugs.gnu.org, sbaugh@HIDDEN, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.9 (---)

On 25/11/2023 16:10, Eli Zaretskii wrote:
>> Date: Sat, 25 Nov 2023 16:05:03 +0200
>> Cc:sbaugh@HIDDEN,67310 <at> debbugs.gnu.org,juri@HIDDEN
>> From: Dmitry Gutov<dmitry@HIDDEN>
>>
>>> I generally request and expect people not to make unnecessary changes,
>>> since doing that makes forensics harder: you see changes which don't
>>> change the code's semantics, and need to waste time studying such
>>> "changes" and deciding that they are no-ops.
>>>
>>> Please everyone keep this in mind when you make changes.
>> In general we don't frown in making minor cosmetic changes in the same
>> area as major meaningful changes are done.
> Yes, if the changes are for the better.  In this case, they seem to be
> due to someone's personal stylistic preferences, so their value is
> questionable at best.

I generally allow stylistic preferences when they don't run counter to 
mine. That's better for contributors' morale, for one thing.

Anyway, I made one more change in that area, hopefully to everyone's liking.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#67310; Package emacs. Full text available.

Message received at 67310 <at> debbugs.gnu.org:


Received: (at 67310) by debbugs.gnu.org; 25 Nov 2023 14:10:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Nov 25 09:10:43 2023
Received: from localhost ([127.0.0.1]:38214 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r6tMp-0000dy-GU
	for submit <at> debbugs.gnu.org; Sat, 25 Nov 2023 09:10:43 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:52436)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1r6tMn-0000dm-Ci
 for 67310 <at> debbugs.gnu.org; Sat, 25 Nov 2023 09:10:42 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1r6tMa-000206-Iv; Sat, 25 Nov 2023 09:10:30 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=BijP+rpq0t9zygDdsaDvkdm9TNI3Hu0s7GY1MccXp/4=; b=CxJ4vWyiLJno
 5VE4H12Gs1pgRI6g3GRVj4wynOKNczYqUIqk6+DW5ZIkywdXnqxB5tmz7MHrBIRKp6PJtsQG4ojJa
 +xLVJDpD5kfnqfuodhzXzqImzlWEkN90PBHGpDMV+6+2/K86pcE56jfv0OueoiNLUUAsXMhyiK6Gf
 D9aCbEaZ1tNF50LO+OAPALGtkV7CRlxT87CYAyPqpi1IDj/5IDCct3AA1HRN1gACtQxURNkGM9/VZ
 o2J64xE/yBOEVpYAmc4D055G8mOKlOYc3GwH924HyMDUQ1QKXBk31QRd6psGp+8RLf62QSng1UWme
 vh5vCxKZNjNXAY8FzKgxEA==;
Date: Sat, 25 Nov 2023 16:10:09 +0200
Message-Id: <83zfz1c4am.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <96636783-62bb-0bb1-ecb5-c510630402e3@HIDDEN> (message from
 Dmitry Gutov on Sat, 25 Nov 2023 16:05:03 +0200)
Subject: Re: bug#67310: [PATCH] Include the project--list as history when
 prompting for a project
References: <ier8r6s42on.fsf@HIDDEN>
 <dc5ad8f4-b857-ea87-d178-bae903cee517@HIDDEN>
 <421e3ea8-d150-566e-f645-cbf1ccbcba61@HIDDEN>
 <ier34wz3zkx.fsf@HIDDEN>
 <81b6ed58-3fdc-3b5a-41a9-84d66475d5f1@HIDDEN>
 <ierr0khlq19.fsf@HIDDEN>
 <5c3eb6a1-38da-8af4-419a-e0567b163e3a@HIDDEN>
 <iercyw1l6rz.fsf@HIDDEN> <83bkblgeja.fsf@HIDDEN>
 <ab8f5ad1-356e-e90d-eab4-d36a0b0821fc@HIDDEN> <83edgedy1j.fsf@HIDDEN>
 <96636783-62bb-0bb1-ecb5-c510630402e3@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 67310
Cc: 67310 <at> debbugs.gnu.org, sbaugh@HIDDEN, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Sat, 25 Nov 2023 16:05:03 +0200
> Cc: sbaugh@HIDDEN, 67310 <at> debbugs.gnu.org, juri@HIDDEN
> From: Dmitry Gutov <dmitry@HIDDEN>
> 
> > I generally request and expect people not to make unnecessary changes,
> > since doing that makes forensics harder: you see changes which don't
> > change the code's semantics, and need to waste time studying such
> > "changes" and deciding that they are no-ops.
> > 
> > Please everyone keep this in mind when you make changes.
> 
> In general we don't frown in making minor cosmetic changes in the same 
> area as major meaningful changes are done.

Yes, if the changes are for the better.  In this case, they seem to be
due to someone's personal stylistic preferences, so their value is
questionable at best.

> > I think this is not a good idea, regardless of the reasons.  Users
> > have these options to control how history functionality behaves in
> > Emacs, and here you take away that control with no "fire escape".
> 
> Actually, never mind: the latest version of the patch doesn't use 
> 'add-to-history', or reference these variables.

Good.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#67310; Package emacs. Full text available.

Message received at 67310 <at> debbugs.gnu.org:


Received: (at 67310) by debbugs.gnu.org; 25 Nov 2023 14:05:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Nov 25 09:05:22 2023
Received: from localhost ([127.0.0.1]:38209 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r6tHd-0000VY-Ks
	for submit <at> debbugs.gnu.org; Sat, 25 Nov 2023 09:05:22 -0500
Received: from wout5-smtp.messagingengine.com ([64.147.123.21]:49321)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dmitry@HIDDEN>) id 1r6tHb-0000VJ-9k
 for 67310 <at> debbugs.gnu.org; Sat, 25 Nov 2023 09:05:20 -0500
Received: from compute1.internal (compute1.nyi.internal [10.202.2.41])
 by mailout.west.internal (Postfix) with ESMTP id C8F0832009F4;
 Sat, 25 Nov 2023 09:05:07 -0500 (EST)
Received: from mailfrontend1 ([10.202.2.162])
 by compute1.internal (MEProxy); Sat, 25 Nov 2023 09:05:08 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc
 :cc:content-transfer-encoding:content-type:content-type:date
 :date:from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:sender:subject:subject:to:to; s=fm3; t=
 1700921107; x=1701007507; bh=W5oPZ6BcPVEAyBSLluQMCq6PHvbqr2GJol4
 ofnKS2R0=; b=KsM+LjFSvZ67+W0AcYSXsJCC35CQxOYwXFX6lJdPR2+pKoNS/+/
 1wHWhUBnbiIMtHRgicha0qD5aWuRKVkZWQQZOY97Jz7+IPtRwufXVMCfpwU3bC/V
 JO/r+bEZpAXWDzK/CzE70IbjRbg3YovaJtxCNIfqKyuQgx7xWV8TCrTpiR3S6iqs
 nwrwnWoB+6meHSJUs+VI5+ZQUlePUoUkMaPOsrpSr9BYaZzIxYEiWZQxovxSN/GY
 nGD543U2fUp9Q2tesE9m2001RoLqeLE/pbgTqboGt2Vu9PFxhAN+gKEXHKdLeM7l
 sDGt0cmjEN7E1TvTF6vGYWkB5ZihxmCm4Vw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-transfer-encoding
 :content-type:content-type:date:date:feedback-id:feedback-id
 :from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:sender:subject:subject:to:to:x-me-proxy
 :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=
 1700921107; x=1701007507; bh=W5oPZ6BcPVEAyBSLluQMCq6PHvbqr2GJol4
 ofnKS2R0=; b=fguHcxR0ucUSKBN/mlzOBa1zaSxEycjWQTBhcPqJKiqQzpaUDAU
 qhSWvui1ZBWn6joIAWgSk7m3zFQBzWQLSHOTc5JsTgTakByT3u4tbu7uavy4SD4W
 xeCniIUKTXMkFDILplr1yFq51UVHp7R9IdPpTjdmEQLf8uBUjbUrI7pl726GtYYr
 RzxcmxWLfCOVhIw6cSDwc6pAfXed8WMbUub8lWGwpzgqjofL2kSvd6yaR1oI4TM9
 qiF6OQo7JF6olS69LbffoXlzQsaRbGnjhEm36LquPWRHFJ7MnGWOD2gq/mdONPd0
 Y+JQTLI3qMGue81qwpLaEabVPlM+b93yjvw==
X-ME-Sender: <xms:Ev9hZdZDKcraC1_Pva55CDZoKdHRh8DkQRmJTUuq13euUIpqQmAgow>
 <xme:Ev9hZUZCwoubDMTWmK03jEATlps4VRqrRLUCgVqRwAi0YrXu4LvIXEpmlKiB5pOM0
 ySmghI5A-8edPJrVN0>
X-ME-Received: <xmr:Ev9hZf9zKc1z_t0y1joBHu5FEn9JQzp7kRn7mg6sqgt4s6Y1QXzl5xZewY2KAgtUrBWW5Q>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudehjedgheekucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi
 thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth
 htvghrnhepiefgteevheevveffheeltdeukeeiieekueefgedugfefgefhudelgfefveel
 vdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug
 hmihhtrhihsehguhhtohhvrdguvghv
X-ME-Proxy: <xmx:Ev9hZbrp1O4cm-xUhCoZhLZpiL_Vq4ebQ62TJaG8TxHGJFUFqHfzOw>
 <xmx:Ev9hZYpkYPrHZeHPGwwvlS4vIyyJlmrmfdeUea2nE8y7rY20ju4_ow>
 <xmx:Ev9hZRRnfRFwzJpI2_KI1XDBiZAkFZR5BLLpyDq6BWnUur0aKXe-Yg>
 <xmx:E_9hZf24mx9xfVa6yEtrog8-K83IN6hdNbYHr-vFCqLUogrnqGGPWw>
Feedback-ID: i0e71465a:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat,
 25 Nov 2023 09:05:05 -0500 (EST)
Message-ID: <96636783-62bb-0bb1-ecb5-c510630402e3@HIDDEN>
Date: Sat, 25 Nov 2023 16:05:03 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.13.0
Subject: Re: bug#67310: [PATCH] Include the project--list as history when
 prompting for a project
Content-Language: en-US
To: Eli Zaretskii <eliz@HIDDEN>
References: <ier8r6s42on.fsf@HIDDEN>
 <dc5ad8f4-b857-ea87-d178-bae903cee517@HIDDEN>
 <421e3ea8-d150-566e-f645-cbf1ccbcba61@HIDDEN>
 <ier34wz3zkx.fsf@HIDDEN>
 <81b6ed58-3fdc-3b5a-41a9-84d66475d5f1@HIDDEN>
 <ierr0khlq19.fsf@HIDDEN>
 <5c3eb6a1-38da-8af4-419a-e0567b163e3a@HIDDEN>
 <iercyw1l6rz.fsf@HIDDEN> <83bkblgeja.fsf@HIDDEN>
 <ab8f5ad1-356e-e90d-eab4-d36a0b0821fc@HIDDEN> <83edgedy1j.fsf@HIDDEN>
From: Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <83edgedy1j.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -2.9 (--)
X-Debbugs-Envelope-To: 67310
Cc: 67310 <at> debbugs.gnu.org, sbaugh@HIDDEN, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.9 (---)

On 25/11/2023 10:42, Eli Zaretskii wrote:
>> Date: Sat, 25 Nov 2023 03:54:13 +0200
>> Cc: 67310 <at> debbugs.gnu.org, juri@HIDDEN
>> From: Dmitry Gutov <dmitry@HIDDEN>
>>
>> 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.
> 
> Then the comment should say
> 
>    Iterate in reverse order so project--name-history is in the same
>    order as project--list.

Sure.

>>>> -              (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.
> 
> Why is that an advantage?
> 
> I generally request and expect people not to make unnecessary changes,
> since doing that makes forensics harder: you see changes which don't
> change the code's semantics, and need to waste time studying such
> "changes" and deciding that they are no-ops.
> 
> Please everyone keep this in mind when you make changes.

In general we don't frown in making minor cosmetic changes in the same 
area as major meaningful changes are done.

Conversely, we do frown on cosmetic changes when nothing else is added. 
Ergo, the only time to make such minor changes is when more meaningful 
changes are done.

If the latter was not the case, we could instead prefer the more common 
tactic of separating functional and cosmetic changes.

>>>> +        (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.
> 
> I think this is not a good idea, regardless of the reasons.  Users
> have these options to control how history functionality behaves in
> Emacs, and here you take away that control with no "fire escape".

Actually, never mind: the latest version of the patch doesn't use 
'add-to-history', or reference these variables.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#67310; Package emacs. Full text available.

Message received at 67310 <at> debbugs.gnu.org:


Received: (at 67310) by debbugs.gnu.org; 25 Nov 2023 08:42:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Nov 25 03:42:34 2023
Received: from localhost ([127.0.0.1]:37748 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r6oFG-0008De-1s
	for submit <at> debbugs.gnu.org; Sat, 25 Nov 2023 03:42:34 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:49672)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1r6oFD-0008DP-BE
 for 67310 <at> debbugs.gnu.org; Sat, 25 Nov 2023 03:42:32 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1r6oF2-0007oB-10; Sat, 25 Nov 2023 03:42:20 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=LuZUYz2JUXU6jRMxH2ZUJwVXGA1OEJfvRIoUaNdyIfU=; b=lIpW5Ozz64lO
 v0SlM4f6YLA/g/WNbQvV1Rh2GuQsdUlDjZJDMjZBihZnJ1z/dknTsHizh0QI89Zh0269ODf5xtVy9
 V9ouu2GIhhhOOI4LIV5kaU+0temlVXm4/dMLCg2Ly31n8FO69eXpJhlUt1UM6RFoluMIr6BeEvkmU
 2YrKyjOTANYaVy/wKEGqmEnlyN5Ag80fpEfWhxNmywoJZlwPjwKTGoVGU/6Uie3sq2pbMeEJuA2cn
 58gsCqG4ZIpYQ6083YT4LVZAwTKjvuRC2In2GlczIvmgXapcUd90ZoTXeAaWu7EGtHaoKST/J7R6R
 PvEDGpVkTL1as/kXYHbkmw==;
Date: Sat, 25 Nov 2023 10:42:16 +0200
Message-Id: <83edgedy1j.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <ab8f5ad1-356e-e90d-eab4-d36a0b0821fc@HIDDEN> (message from
 Dmitry Gutov on Sat, 25 Nov 2023 03:54:13 +0200)
Subject: Re: bug#67310: [PATCH] Include the project--list as history when
 prompting for a project
References: <ier8r6s42on.fsf@HIDDEN>
 <dc5ad8f4-b857-ea87-d178-bae903cee517@HIDDEN>
 <421e3ea8-d150-566e-f645-cbf1ccbcba61@HIDDEN>
 <ier34wz3zkx.fsf@HIDDEN>
 <81b6ed58-3fdc-3b5a-41a9-84d66475d5f1@HIDDEN>
 <ierr0khlq19.fsf@HIDDEN>
 <5c3eb6a1-38da-8af4-419a-e0567b163e3a@HIDDEN>
 <iercyw1l6rz.fsf@HIDDEN> <83bkblgeja.fsf@HIDDEN>
 <ab8f5ad1-356e-e90d-eab4-d36a0b0821fc@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 67310
Cc: 67310 <at> debbugs.gnu.org, sbaugh@HIDDEN, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Sat, 25 Nov 2023 03:54:13 +0200
> Cc: 67310 <at> debbugs.gnu.org, juri@HIDDEN
> From: Dmitry Gutov <dmitry@HIDDEN>
> 
> 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.

Then the comment should say

  Iterate in reverse order so project--name-history is in the same
  order as project--list.

> >> -              (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.

Why is that an advantage?

I generally request and expect people not to make unnecessary changes,
since doing that makes forensics harder: you see changes which don't
change the code's semantics, and need to waste time studying such
"changes" and deciding that they are no-ops.

Please everyone keep this in mind when you make changes.

> >> +        (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.

I think this is not a good idea, regardless of the reasons.  Users
have these options to control how history functionality behaves in
Emacs, and here you take away that control with no "fire escape".

As for the description you allude to above, all I found is this, which
is part of Spencer's commit log:

  The project--list is already ordered such that the most recently used
  projects are at the front.  Now we use it as the minibuffer history
  when prompting for a project.

  To avoid savehist from picking up project--list as a minibuffer
  history variable and overriding our own persistence mechanism, we
  don't pass project--list directly as a history variable, but instead
  pass project--dir-history or project--name-history, dynamically-bound
  to an appropriate value.  project--dir-history and
  project--name-history won't be persisted since they're always unbound
  at the top level; but if they are persisted anyway somehow, it won't
  affect us.

  If we later find a way to rely on savehist for persistence instead of
  having our own mechanism, we can change the in-memory format of
  project--list to be just a list of directories, and our explicit calls
  to project--add-dir can be replaced by let-binding
  history-delete-duplicates=t, history-length=t.

If this is what you mean, then I don't see how this justifies the
overriding.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#67310; Package emacs. Full text available.

Message received at 67310 <at> debbugs.gnu.org:


Received: (at 67310) by debbugs.gnu.org; 25 Nov 2023 02:07:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 24 21:07:55 2023
Received: from localhost ([127.0.0.1]:37533 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r6i5L-0005nq-Ir
	for submit <at> debbugs.gnu.org; Fri, 24 Nov 2023 21:07:55 -0500
Received: from out5-smtp.messagingengine.com ([66.111.4.29]:48017)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dmitry@HIDDEN>) id 1r6i5I-0005nd-K1
 for 67310 <at> debbugs.gnu.org; Fri, 24 Nov 2023 21:07:53 -0500
Received: from compute5.internal (compute5.nyi.internal [10.202.2.45])
 by mailout.nyi.internal (Postfix) with ESMTP id 438315C01C7;
 Fri, 24 Nov 2023 21:07:42 -0500 (EST)
Received: from mailfrontend1 ([10.202.2.162])
 by compute5.internal (MEProxy); Fri, 24 Nov 2023 21:07:42 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc
 :cc:content-transfer-encoding:content-type:content-type:date
 :date:from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:sender:subject:subject:to:to; s=fm3; t=
 1700878062; x=1700964462; bh=9VLXBxb/APLDQWikhvruF3DvpbtEWstbOTM
 rb6/gGHo=; b=HgCWK0J3Er5IKasrYEZBaa2JyPatfn57oTHceXO2yAO9G4pUSmP
 QAPqSjpnLqjzp5daHfebJhE0w2YQutawY+Q4sYTy1wBuWt8LQXVd4mpNR5OI/GNt
 sHG6dwN5izSCFEdaiFw/PKzRma1gxtdIMc20LAtwUPJ5RieGEzw2a5AgcUprZcil
 u3iMQJ5xk5MSDSkMHS9K/j5YcLt5onKGrLcXm1HIG5duws7WFZ9Qpvxjp5RahheB
 kh2cvgF70pkX5P0HT2ZmhXk24BjcgpXQ7wuOSkD7DiE01mPdDTde9a9bJ4iA5h4a
 Mp3IsBRfqRa/ZAyHDIlG5tC+VKrYKT+eLPg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-transfer-encoding
 :content-type:content-type:date:date:feedback-id:feedback-id
 :from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:sender:subject:subject:to:to:x-me-proxy
 :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=
 1700878062; x=1700964462; bh=9VLXBxb/APLDQWikhvruF3DvpbtEWstbOTM
 rb6/gGHo=; b=J9Ns+ANJ5IJklt99PdfqGS9lT2wVppw4ylowQQycq/objuDDYOd
 FP4d0293HuhGvE9ehMP15ZO7ypiJHkO8LAEZfR6xVXm8oKReHky7IrnCo68ZVa90
 HCONNeMcDJRj0wjs57trja2IVq/yf9F0wr0/yr7aMJOVoJO9BFYaqunsrZutzOWD
 HgNU8gAnpTvDqsXHNZYUcQvRdViA7nUv7VVeJJBRkooJkn1wY6HIYoZP7Hg1LtJ2
 OufGgqgiphWd0iytKjFkxWpl8ViIDEtNnNtL4MjFcaPIInFSxHzNd+aOK5Zcjy7A
 F9aeCaCx9JiFWrUJn4/sRp5r37YnDz3SDBg==
X-ME-Sender: <xms:7VZhZd77SS5Byvqqh6SM_-Lw5e5Wc9anH-2EqsMnz6W8PrOxBZVopg>
 <xme:7VZhZa7NZypDcIuubWIpPBVxXjRZQXTiswRyKx_EKS0EYviv-pn4D3A7pfGSjHsiv
 CAFxwhqLPALeHR9G4M>
X-ME-Received: <xmr:7VZhZUc_xcicodbSVX3KJ_Ojb38grxdLfkdRxzayycVjLZfnjKftZ8C38KCGD2YGx6vDLw>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudehiedggeegucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi
 thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth
 htvghrnhepiefgteevheevveffheeltdeukeeiieekueefgedugfefgefhudelgfefveel
 vdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug
 hmihhtrhihsehguhhtohhvrdguvghv
X-ME-Proxy: <xmx:7VZhZWInLd-sfKbemjSZrmlydkvaOajfxnV4bfAwvYvKp1HB8EgqSQ>
 <xmx:7VZhZRKVNx6ITs8WNkhKxDU24v3wGTN8AV1N-Qz28hcFcL7erNp2QQ>
 <xmx:7VZhZfxAF1chHv7BjVlwooniw0IjKqJymWQoDa9xB1rjp-wubvTY1g>
 <xmx:7lZhZYVyJeHTT60cPQ6e2OM9EgmwNnyf1CNDBsQ7dJOlgnlGQ5wWNQ>
Feedback-ID: i0e71465a:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri,
 24 Nov 2023 21:07:40 -0500 (EST)
Message-ID: <c5b94ee6-7771-5c86-4aee-b56da9cf5c2a@HIDDEN>
Date: Sat, 25 Nov 2023 04:07:39 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.13.0
Subject: Re: bug#67310: [PATCH] Include the project--list as history when
 prompting for a project
Content-Language: en-US
To: Spencer Baugh <sbaugh@HIDDEN>
References: <ier8r6s42on.fsf@HIDDEN>
 <dc5ad8f4-b857-ea87-d178-bae903cee517@HIDDEN>
 <421e3ea8-d150-566e-f645-cbf1ccbcba61@HIDDEN>
 <ier34wz3zkx.fsf@HIDDEN>
 <81b6ed58-3fdc-3b5a-41a9-84d66475d5f1@HIDDEN>
 <ierr0khlq19.fsf@HIDDEN>
 <5c3eb6a1-38da-8af4-419a-e0567b163e3a@HIDDEN>
 <iercyw1l6rz.fsf@HIDDEN>
 <dc3b5328-8719-8948-e617-e3e8cf13f274@HIDDEN>
 <ier8r6nkv58.fsf@HIDDEN>
From: Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <ier8r6nkv58.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -2.9 (--)
X-Debbugs-Envelope-To: 67310
Cc: 67310 <at> debbugs.gnu.org, eliz@HIDDEN, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.9 (---)

On 24/11/2023 17:50, Spencer Baugh wrote:
> Oops, sorry, that was just the old version of the patch.  Correct
> version attached.

Thanks! Installed (after renaming project--add-dir to 
project--remember-dir).

> (Perhaps I should find a better workflow for submitting patches than
> manually running format-patch and copy-pasting the resulting patch to
> attach it to a subsequent email)

Our discussion of any potential migration to alternative "forges" has 
stalled, so there's not much I can recommend, unfortunately.

If/when you have commit access, using branches for review becomes an 
option, but it comes with its own inconveniences.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#67310; Package emacs. Full text available.

Message received at 67310 <at> debbugs.gnu.org:


Received: (at 67310) by debbugs.gnu.org; 25 Nov 2023 01:54:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 24 20:54:31 2023
Received: from localhost ([127.0.0.1]:37527 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r6hsM-0005RE-WE
	for submit <at> debbugs.gnu.org; Fri, 24 Nov 2023 20:54:31 -0500
Received: from out5-smtp.messagingengine.com ([66.111.4.29]:44789)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dmitry@HIDDEN>) id 1r6hsL-0005R1-4N
 for 67310 <at> debbugs.gnu.org; Fri, 24 Nov 2023 20:54:30 -0500
Received: from compute3.internal (compute3.nyi.internal [10.202.2.43])
 by mailout.nyi.internal (Postfix) with ESMTP id 15E8D5C0196;
 Fri, 24 Nov 2023 20:54:19 -0500 (EST)
Received: from mailfrontend1 ([10.202.2.162])
 by compute3.internal (MEProxy); Fri, 24 Nov 2023 20:54:19 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc
 :cc:content-transfer-encoding:content-type:content-type:date
 :date:from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:sender:subject:subject:to:to; s=fm3; t=
 1700877259; x=1700963659; bh=+84e6iUofD21Py+B/Z8vOvEQU4vpdmJygTR
 4IY9+HTM=; b=gCbnpFFud2rWS+Qojf5O7W4Iwwq4qqHF5IZJ1JZP7+1OyadWX2b
 sSc3UnlheyCaK9DJvlzqPgcv3+Abol9tynRFlgOrqMdyVqVBQlvLaHda/OenKyv+
 bKEboZmk4S8kYwkSySk7Amv4lNe2OJajlpikHQfUnlqxVEooLqAOlIt2NKwuguhV
 z1tIv5USBc2G0Ar/bnibM8G77shLucI4zeylcUmGp45yhSS1i3kwJ3U5ozuFd6Zn
 bvBQk5us6J32RcghRkArw3NRW8ojwWXSWe2aZEBUajs8G2jbRsKviKRnz5KczNlU
 fUhGwadFqGwNfj1Iz3dqZk52VXT/RpQPgCA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-transfer-encoding
 :content-type:content-type:date:date:feedback-id:feedback-id
 :from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:sender:subject:subject:to:to:x-me-proxy
 :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=
 1700877259; x=1700963659; bh=+84e6iUofD21Py+B/Z8vOvEQU4vpdmJygTR
 4IY9+HTM=; b=qDcOhTCsQ2S0k1mNfo4+y4z7zRQJ+ISyW6MyNZ3ZRj3jH+21neR
 QTZAU5QLJYXEAk+CZ5sXbxhLuG+YlY6TsgDKU8qhel6wo2Q9Wj3A3KVBTy4V849F
 NX4SuYUhEgz6999fd93IqZZe/I1idtrOpFL1O5Rq2PxM6h6Lxv293IczxhzVk4Uq
 xpmKpbjkV6Lf+vOhJX8Cv+Cn+Hy6lixlU5sdNl9bR7koq57KR6qdr8Rfp2EYi9+V
 ZjhcM/D1U1HMaiVJIpwherU50r2ACJZvKdyaZwq4OY+CIfppSWhhiT0HI8zEO1xh
 rFhIrgTFiRcxQ8KShasoMaCqWW48TTrlFcg==
X-ME-Sender: <xms:ylNhZUCo_FRxpBV8rCe5TRL4f7P3QYX68U8mR7CcnygV7HMcm-vHng>
 <xme:ylNhZWg_sxH6FyjreoafPE3XbzhRRp1-ihpmVj_KFPriwm0WsaoS2cNc3Wep8Rils
 5OtSsgZwZ3MwwobYCc>
X-ME-Received: <xmr:ylNhZXnHiS8iFm-BR2GH9Vy9uj7eu2yjLabEcpkxN1PBVKnnA5qGzK6iKQu2y5MsnrA22g>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudehiedggedvucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi
 thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth
 htvghrnhepiefgteevheevveffheeltdeukeeiieekueefgedugfefgefhudelgfefveel
 vdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug
 hmihhtrhihsehguhhtohhvrdguvghv
X-ME-Proxy: <xmx:ylNhZawQUB0Uh9dgKiAUcJnQsoNZ9vbUxpEUaP16av4C4XXaw33Xdw>
 <xmx:ylNhZZRl5Swh52S7lTToQKOY-fyukV1EXF51BWopofObNZcKPKUcNg>
 <xmx:ylNhZVbURbTVhTgg3EicRJrkvqbnfJO4wkUsa2c-t1np2M2aJ_gZRg>
 <xmx:y1NhZUcR2JrVQqdClg9roMyx6SCQPvGjjSnTRBRmuEvxZj6YvjwTdA>
Feedback-ID: i0e71465a:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri,
 24 Nov 2023 20:54:17 -0500 (EST)
Message-ID: <ab8f5ad1-356e-e90d-eab4-d36a0b0821fc@HIDDEN>
Date: Sat, 25 Nov 2023 03:54:13 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.13.0
Subject: Re: bug#67310: [PATCH] Include the project--list as history when
 prompting for a project
Content-Language: en-US
To: Eli Zaretskii <eliz@HIDDEN>, Spencer Baugh <sbaugh@HIDDEN>
References: <ier8r6s42on.fsf@HIDDEN>
 <dc5ad8f4-b857-ea87-d178-bae903cee517@HIDDEN>
 <421e3ea8-d150-566e-f645-cbf1ccbcba61@HIDDEN>
 <ier34wz3zkx.fsf@HIDDEN>
 <81b6ed58-3fdc-3b5a-41a9-84d66475d5f1@HIDDEN>
 <ierr0khlq19.fsf@HIDDEN>
 <5c3eb6a1-38da-8af4-419a-e0567b163e3a@HIDDEN>
 <iercyw1l6rz.fsf@HIDDEN> <83bkblgeja.fsf@HIDDEN>
From: Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <83bkblgeja.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -2.9 (--)
X-Debbugs-Envelope-To: 67310
Cc: 67310 <at> debbugs.gnu.org, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.9 (---)

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'.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#67310; Package emacs. Full text available.

Message received at 67310 <at> debbugs.gnu.org:


Received: (at 67310) by debbugs.gnu.org; 24 Nov 2023 15:50:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 24 10:50:57 2023
Received: from localhost ([127.0.0.1]:37007 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r6YSH-0008Ni-1W
	for submit <at> debbugs.gnu.org; Fri, 24 Nov 2023 10:50:57 -0500
Received: from mxout5.mail.janestreet.com ([64.215.233.18]:57223)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <sbaugh@HIDDEN>) id 1r6YSD-0008NU-2z
 for 67310 <at> debbugs.gnu.org; Fri, 24 Nov 2023 10:50:55 -0500
From: Spencer Baugh <sbaugh@HIDDEN>
To: Dmitry Gutov <dmitry@HIDDEN>
Subject: Re: bug#67310: [PATCH] Include the project--list as history when
 prompting for a project
In-Reply-To: <dc3b5328-8719-8948-e617-e3e8cf13f274@HIDDEN> (Dmitry Gutov's
 message of "Thu, 23 Nov 2023 04:55:56 +0200")
References: <ier8r6s42on.fsf@HIDDEN>
 <dc5ad8f4-b857-ea87-d178-bae903cee517@HIDDEN>
 <421e3ea8-d150-566e-f645-cbf1ccbcba61@HIDDEN>
 <ier34wz3zkx.fsf@HIDDEN>
 <81b6ed58-3fdc-3b5a-41a9-84d66475d5f1@HIDDEN>
 <ierr0khlq19.fsf@HIDDEN>
 <5c3eb6a1-38da-8af4-419a-e0567b163e3a@HIDDEN>
 <iercyw1l6rz.fsf@HIDDEN>
 <dc3b5328-8719-8948-e617-e3e8cf13f274@HIDDEN>
Date: Fri, 24 Nov 2023 10:50:43 -0500
Message-ID: <ier8r6nkv58.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 67310
Cc: 67310 <at> debbugs.gnu.org, eliz@HIDDEN, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain

Dmitry Gutov <dmitry@HIDDEN> writes:
> 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).

Oops, sorry, that was just the old version of the patch.  Correct
version attached.

(Perhaps I should find a better workflow for submitting patches than
manually running format-patch and copy-pasting the resulting patch to
attach it to a subsequent email)


--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline;
 filename=0001-Use-the-project-list-as-history-when-prompting-for-a.patch

From 6b7b82be8a9a2d218a124e8205f3627d77dbb0a1 Mon Sep 17 00:00:00 2001
From: Spencer Baugh <sbaugh@HIDDEN>
Date: Tue, 21 Nov 2023 10:11:52 -0500
Subject: [PATCH] Use the project--list as history when prompting for a project

The project--list is already ordered such that the most recently used
projects are at the front.  Now we use it as the minibuffer history
when prompting for a project.

To avoid savehist from picking up project--list as a minibuffer
history variable and overriding our own persistence mechanism, we
don't pass project--list directly as a history variable, but instead
pass project--dir-history or project--name-history, dynamically-bound
to an appropriate value.  project--dir-history and
project--name-history won't be persisted since they're always unbound
at the top level; but if they are persisted anyway somehow, it won't
affect us.

If we later find a way to rely on savehist for persistence instead of
having our own mechanism, we can change the in-memory format of
project--list to be just a list of directories, and our explicit calls
to project--add-dir can be replaced by let-binding
history-delete-duplicates=t, history-length=t.

* lisp/progmodes/project.el (project--add-dir): Add.
(project-remember-project): Use project--add-dir.
(project--name-history, project-prompt-project-name)
(project--dir-history, project-prompt-project-dir): Pass a
preprocessed project--list as HIST to completing-read.  (bug#67310)
(project-switch-project): Call project--add-dir.
---
 lisp/progmodes/project.el | 39 ++++++++++++++++++++++++++++++---------
 1 file changed, 30 insertions(+), 9 deletions(-)

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 95db9d0ef4c..fb4f42a844c 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -1721,13 +1721,12 @@ project--write-project-list
             (current-buffer)))
       (write-region nil nil filename nil 'silent))))
 
-;;;###autoload
-(defun project-remember-project (pr &optional no-write)
-  "Add project PR to the front of the project list.
+(defun project--add-dir (root &optional no-write)
+  "Add project root ROOT to the front of the project list.
 Save the result in `project-list-file' if the list of projects
 has changed, and NO-WRITE is nil."
   (project--ensure-read-project-list)
-  (let ((dir (abbreviate-file-name (project-root pr))))
+  (let ((dir (abbreviate-file-name root)))
     (unless (equal (caar project--list) dir)
       (dolist (ent project--list)
         (when (equal dir (car ent))
@@ -1736,6 +1735,13 @@ project-remember-project
       (unless no-write
         (project--write-project-list)))))
 
+;;;###autoload
+(defun project-remember-project (pr &optional no-write)
+  "Add project PR to the front of the project list.
+Save the result in `project-list-file' if the list of projects
+has changed, and NO-WRITE is nil."
+  (project--add-dir (project-root pr) no-write))
+
 (defun project--remove-from-project-list (project-root report-message)
   "Remove directory PROJECT-ROOT of a missing project from the project list.
 If the directory was in the list before the removal, save the
@@ -1757,6 +1763,8 @@ project-forget-project
   (project--remove-from-project-list
    project-root "Project `%s' removed from known projects"))
 
+(defvar project--dir-history)
+
 (defun project-prompt-project-dir ()
   "Prompt the user for a directory that is one of the known project roots.
 The project is chosen among projects known from the project list,
@@ -1769,27 +1777,37 @@ project-prompt-project-dir
           ;; completion style).
           (project--file-completion-table
            (append project--list `(,dir-choice))))
+         (project--dir-history (project-known-project-roots))
          (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)
       pr-dir)))
 
+(defvar project--name-history)
+
 (defun project-prompt-project-name ()
   "Prompt the user for a project, by name, that is one of the known project roots.
 The project is chosen among projects known from the project list,
 see `project-list-file'.
 It's also possible to enter an arbitrary directory not in the list."
   (let* ((dir-choice "... (choose a dir)")
+         project--name-history
          (choices
           (let (ret)
-            (dolist (dir (project-known-project-roots))
+            ;; Iterate in reverse order so project--name-history is in
+            ;; the correct order.
+            (dolist (dir (reverse (project-known-project-roots)))
               ;; we filter out directories that no longer map to a project,
               ;; since they don't have a clean project-name.
-              (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))))
             ret))
          ;; XXX: Just using this for the category (for the substring
          ;; completion style).
@@ -1798,7 +1816,9 @@ project-prompt-project-name
          (pr-name ""))
     (while (equal pr-name "")
       ;; If the user simply pressed RET, do this again until they don't.
-      (setq pr-name (completing-read "Select project: " table nil t)))
+      (setq pr-name
+            (let ((history-add-new-input nil))
+              (completing-read "Select project: " table nil t nil 'project--name-history))))
     (if (equal pr-name dir-choice)
         (read-directory-name "Select directory: " default-directory nil t)
       (let ((proj (assoc pr-name choices)))
@@ -2064,6 +2084,7 @@ project-switch-project
 When called in a program, it will use the project corresponding
 to directory DIR."
   (interactive (list (funcall project-prompter)))
+  (project--add-dir dir)
   (let ((command (if (symbolp project-switch-commands)
                      project-switch-commands
                    (project--switch-project-command)))
-- 
2.39.3


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#67310; Package emacs. Full text available.

Message received at 67310 <at> debbugs.gnu.org:


Received: (at 67310) by debbugs.gnu.org; 23 Nov 2023 06:38:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Nov 23 01:38:54 2023
Received: from localhost ([127.0.0.1]:60420 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r63MU-0002vI-DH
	for submit <at> debbugs.gnu.org; Thu, 23 Nov 2023 01:38:54 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:40130)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1r63MR-0002v6-Up
 for 67310 <at> debbugs.gnu.org; Thu, 23 Nov 2023 01:38:53 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1r63MH-0007Hk-LW; Thu, 23 Nov 2023 01:38:41 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=e4mF4TPgCHKbtypqO6Ps0yMo9JzUT2v2IfYoWsedwu4=; b=WecQ7r3zxHPu
 t6k+ACzd+KV14KhNFST/QDw6vPXwGRFeLnF0peme+5UBSSNvKGvDnND1SFB06GtJOQ/pFxouW4fM0
 zt/qU/HP+KJYDRBrAnDXaj4tQMYs1bfIHyFaArgvuyC6qtH6wzftuWvNTrA/7pvf7kf0wMjat8t3D
 ZlvRRj5wiXqdtkcorBMCkrrHeLgJrfTA9rUDwocd+M6jYCsSrWwyvBb56UtoAGmT/6T55TH/fdgKk
 Fce5HJTgAGYHe2j/TtonIrAMFCAskRnfKtCrLAbPOhxeB1cvCteW+WnnFxJTxPlRgulgneHSimoXv
 5mzgA9yorMFxtvVmXZbh2w==;
Date: Thu, 23 Nov 2023 08:38:33 +0200
Message-Id: <83bkblgeja.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Spencer Baugh <sbaugh@HIDDEN>
In-Reply-To: <iercyw1l6rz.fsf@HIDDEN> (message from Spencer Baugh on
 Wed, 22 Nov 2023 18:14:56 -0500)
Subject: Re: bug#67310: [PATCH] Include the project--list as history when
 prompting for a project
References: <ier8r6s42on.fsf@HIDDEN>
 <dc5ad8f4-b857-ea87-d178-bae903cee517@HIDDEN>
 <421e3ea8-d150-566e-f645-cbf1ccbcba61@HIDDEN>
 <ier34wz3zkx.fsf@HIDDEN>
 <81b6ed58-3fdc-3b5a-41a9-84d66475d5f1@HIDDEN>
 <ierr0khlq19.fsf@HIDDEN>
 <5c3eb6a1-38da-8af4-419a-e0567b163e3a@HIDDEN>
 <iercyw1l6rz.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 67310
Cc: 67310 <at> debbugs.gnu.org, dmitry@HIDDEN, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Spencer Baugh <sbaugh@HIDDEN>
> Cc: 67310 <at> debbugs.gnu.org,  eliz@HIDDEN,  juri@HIDDEN
> Date: Wed, 22 Nov 2023 18:14:56 -0500
> 
>  (defvar project--list 'unset
> -  "List structure containing root directories of known projects.
> -With some possible metadata (to be decided).")
> +  "List of root directories of known projects.
> +
> +This is also the minibuffer history variable for
> +`project-prompt-project-dir' and `project-prompt-project-name'.")

Please add here cross-reference(s) to command(s) or option(s) used for
minibuffer-history handling.  IOW, don't assume that when you say
"minibuffer history variable", the reader immediately understands what
you mean and how this aspect is significant.

I also question the decision of making this variable an internal one.
I don't think any other minibuffer-history variables we have are
internal ones, and for good reasons.

> +      (let q((history-delete-duplicates t)
              ^^^
Typo?

> +            ;; Iterate in reverse order so project--name-history is in
> +            ;; the correct order.

What is the "correct" order?

> -              (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.

> +            (let ((history-add-new-input nil))

Why this non-standard way of let-binding a variable to nil?

> +        (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?

> -  (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?

Thanks.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#67310; Package emacs. Full text available.

Message received at 67310 <at> debbugs.gnu.org:


Received: (at 67310) by debbugs.gnu.org; 23 Nov 2023 02:56:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 22 21:56:13 2023
Received: from localhost ([127.0.0.1]:60295 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r5zsz-0002Vs-7T
	for submit <at> debbugs.gnu.org; Wed, 22 Nov 2023 21:56:13 -0500
Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:55615)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dmitry@HIDDEN>) id 1r5zsx-0002Va-LA
 for 67310 <at> debbugs.gnu.org; Wed, 22 Nov 2023 21:56:12 -0500
Received: from compute1.internal (compute1.nyi.internal [10.202.2.41])
 by mailout.west.internal (Postfix) with ESMTP id E1F6F3200A4A;
 Wed, 22 Nov 2023 21:56:01 -0500 (EST)
Received: from mailfrontend1 ([10.202.2.162])
 by compute1.internal (MEProxy); Wed, 22 Nov 2023 21:56:02 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc
 :cc:content-transfer-encoding:content-type:content-type:date
 :date:from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:sender:subject:subject:to:to; s=fm3; t=
 1700708161; x=1700794561; bh=CPJYDjB2B9/XWDj17Zgt0NYu8RKjTY/v6Rt
 lgjY0VLY=; b=di5z/CVcIjbvVjA4BE0krXl57RhNNmotGwhsQBdgY2s2aV7C0as
 KIqW0bggLUaBxHktmj2oqTKt+/VvXFQoxAeJF2dd6kn5CqBDPVVx0e7sivACnVvC
 V2Qa1mQeNpOyH312HCzDlC2m4f0MQvzzlbMS5KpxlDmvefr10bmSzCNZaW/oXhZn
 QEzYlOmj0oJQKegcDc3CUIi2AfVlG7z7axQ1T7mlz/+LyT5U32Nb1iUKHWwyzhgh
 ebzWDi7p8/BAbG1DlvvOsPyH69HDjRthKjcmZWzm+pyVxHzhD/dgmHTMZb58cHL9
 Nbn/ecyJp73SdXhcNv1tcIuWz1Tklo6Byhg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-transfer-encoding
 :content-type:content-type:date:date:feedback-id:feedback-id
 :from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:sender:subject:subject:to:to:x-me-proxy
 :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=
 1700708161; x=1700794561; bh=CPJYDjB2B9/XWDj17Zgt0NYu8RKjTY/v6Rt
 lgjY0VLY=; b=0JHUoXzSQIzGmVm4k/S/P7qLPUcupdVCp7KCbAX7mvVWP0V7hv/
 aoZSIqOKeYJQXpMhlfXsn50i6YlAQdt8+7qMyThCPbPe+vyd/2pLk/kJfYyYwCJG
 0GlQFWD0//jxjupuK7v14V7RSxVHStfC30Jkx3CFE47+vcIBHdqvlbXjPTbFxdXc
 bEXaIhIlGXPWkMnlf5H3IfT7qEw6YRRLP1j1BrxMVyRK0YcCC9N4zT2N4kvxMwPT
 gAzbwl/Lju/0LgBh+eeYqN/QSlh52+le8drRxKpFsq1kwHGyL9LUCOGsX9PpdGdy
 CEetaM0TACTRmV7f4e61pRJrQF5rYKwANgA==
X-ME-Sender: <xms:Qb9eZRjugfmJummxyZu2MWOMIlv0Ud0sMsGwYBxPkxxG1xQ0e6Ag-Q>
 <xme:Qb9eZWAMUo5j3oj9Tt0eiYDepEgpEDd9RFqZiu3tib9gbP-FByepBjH6ZXbX_o_-i
 HK5YGt8zux3wKl4Gy0>
X-ME-Received: <xmr:Qb9eZRHd7e_jipVO2mMCa3CzOVq4QvHEHNpYFOxOgPJD1vE1W5rsYvfXT5Wa4lbAs1_UAg>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudehvddghedvucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi
 thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth
 htvghrnhepiefgteevheevveffheeltdeukeeiieekueefgedugfefgefhudelgfefveel
 vdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug
 hmihhtrhihsehguhhtohhvrdguvghv
X-ME-Proxy: <xmx:Qb9eZWTSc6vTDnDM0AQ5arRNP8Xq_2ibsWReSMNcXAqEaeJ7If7y8w>
 <xmx:Qb9eZewwyvdqPRqcDwGpavR0WXoR0YluHU_TFwS5vMNAQbuIvDjMjg>
 <xmx:Qb9eZc54gWtSaNKKwdcun8d-PX-e2o36FI0Qj0E2rUh-v9QskP9YLA>
 <xmx:Qb9eZZ_vWejfmc4d6Iy0Ey91g-Z5DjW2rSEs5KGbEp7XUHssidLThg>
Feedback-ID: i0e71465a:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed,
 22 Nov 2023 21:55:59 -0500 (EST)
Message-ID: <dc3b5328-8719-8948-e617-e3e8cf13f274@HIDDEN>
Date: Thu, 23 Nov 2023 04:55:56 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.13.0
Subject: Re: bug#67310: [PATCH] Include the project--list as history when
 prompting for a project
Content-Language: en-US
To: Spencer Baugh <sbaugh@HIDDEN>
References: <ier8r6s42on.fsf@HIDDEN>
 <dc5ad8f4-b857-ea87-d178-bae903cee517@HIDDEN>
 <421e3ea8-d150-566e-f645-cbf1ccbcba61@HIDDEN>
 <ier34wz3zkx.fsf@HIDDEN>
 <81b6ed58-3fdc-3b5a-41a9-84d66475d5f1@HIDDEN>
 <ierr0khlq19.fsf@HIDDEN>
 <5c3eb6a1-38da-8af4-419a-e0567b163e3a@HIDDEN>
 <iercyw1l6rz.fsf@HIDDEN>
From: Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <iercyw1l6rz.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -2.9 (--)
X-Debbugs-Envelope-To: 67310
Cc: 67310 <at> debbugs.gnu.org, eliz@HIDDEN, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.9 (---)

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).




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#67310; Package emacs. Full text available.

Message received at 67310 <at> debbugs.gnu.org:


Received: (at 67310) by debbugs.gnu.org; 22 Nov 2023 23:15:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 22 18:15:08 2023
Received: from localhost ([127.0.0.1]:60052 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r5wR0-0002Wr-QT
	for submit <at> debbugs.gnu.org; Wed, 22 Nov 2023 18:15:08 -0500
Received: from mxout6.mail.janestreet.com ([64.215.233.21]:52061)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <sbaugh@HIDDEN>) id 1r5wQz-0002Ax-8u
 for 67310 <at> debbugs.gnu.org; Wed, 22 Nov 2023 18:15:06 -0500
From: Spencer Baugh <sbaugh@HIDDEN>
To: Dmitry Gutov <dmitry@HIDDEN>
Subject: Re: bug#67310: [PATCH] Include the project--list as history when
 prompting for a project
In-Reply-To: <5c3eb6a1-38da-8af4-419a-e0567b163e3a@HIDDEN> (Dmitry Gutov's
 message of "Wed, 22 Nov 2023 20:44:53 +0200")
References: <ier8r6s42on.fsf@HIDDEN>
 <dc5ad8f4-b857-ea87-d178-bae903cee517@HIDDEN>
 <421e3ea8-d150-566e-f645-cbf1ccbcba61@HIDDEN>
 <ier34wz3zkx.fsf@HIDDEN>
 <81b6ed58-3fdc-3b5a-41a9-84d66475d5f1@HIDDEN>
 <ierr0khlq19.fsf@HIDDEN>
 <5c3eb6a1-38da-8af4-419a-e0567b163e3a@HIDDEN>
Date: Wed, 22 Nov 2023 18:14:56 -0500
Message-ID: <iercyw1l6rz.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 67310
Cc: 67310 <at> debbugs.gnu.org, eliz@HIDDEN, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain

Dmitry Gutov <dmitry@HIDDEN> writes:
> On 22/11/2023 18:18, Spencer Baugh wrote:
>> Dmitry Gutov <dmitry@HIDDEN> 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?
>
> Hmm, maybe not. Anyway, that sentence was supposed to lead into the
> next paragraph anyway.
>
>> 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.
>
> I suppose project-switch-project could add a project-remember-project
> call as well?
>
> It's just that until recently it only supported project-related
> commands, and those would invoke (project-current t) right away --
> adding the just-selected root into the list.

Yes, that makes sense, done.  (We only have the project root directory
there, so we still need project--add-dir)


--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline;
 filename=0001-Include-the-project-list-as-history-when-prompting-f.patch

From 063fe822531d51040be53f47f3dbe35ea77f21be Mon Sep 17 00:00:00 2001
From: Spencer Baugh <sbaugh@HIDDEN>
Date: Mon, 20 Nov 2023 14:38:22 -0500
Subject: [PATCH] Include the project--list as history when prompting for a
 project

The project--list is already ordered such that the most recently used
projects are at the front.  Now we use it as the minibuffer history
when prompting for a project.

To support this, we minorly change the in-memory format of
project--list: Instead of a list of lists, each containing a
project-root, project--list is just a list whose elements are
project-roots.  This lets us pass it directly to add-to-history.  The
persistent format (what's saved in project-list-file) remains the
same.

To avoid savehist from picking up project--list as a minibuffer
history variable and overriding our own persistence mechanism, we
don't pass project--list directly as a history variable, but instead
pass project--dir-history or project--name-history, dynamically-bound
to an appropriate value.  project--dir-history and
project--name-history won't be persisted since they're always unbound
at the top level; but if they are persisted anyway somehow, it won't
affect us.

* lisp/progmodes/project.el (project--list): Update docstring for new
format.
(project-known-project-roots, project-remember-projects-under)
(project--read-project-list, project--write-project-list)
(project-remember-project, project--remove-from-project-list): Support
new format for project--list.
(project--dir-history, project-prompt-project-dir): Pass project--list
as HIST to completing-read.
(project--name-history, project-prompt-project-name): Pass a
preprocessed project--list as HIST to completing-read.
---
 lisp/progmodes/project.el | 99 +++++++++++++++++++++++++--------------
 1 file changed, 64 insertions(+), 35 deletions(-)

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 95db9d0ef4c..4baa76b932a 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -1678,11 +1678,16 @@ project-list-file
   :group 'project)
 
 (defvar project--list 'unset
-  "List structure containing root directories of known projects.
-With some possible metadata (to be decided).")
+  "List of root directories of known projects.
+
+This is also the minibuffer history variable for
+`project-prompt-project-dir' and `project-prompt-project-name'.")
 
 (defun project--read-project-list ()
-  "Initialize `project--list' using contents of `project-list-file'."
+  "Initialize `project--list' using contents of `project-list-file'.
+
+We expect `project-list-file' to contain a list of one-element
+lists, each containing a project root."
   (let ((filename project-list-file))
     (setq project--list
           (when (file-exists-p filename)
@@ -1691,11 +1696,11 @@ project--read-project-list
               (mapcar
                (lambda (elem)
                  (let ((name (car elem)))
-                   (list (if (file-remote-p name) name
-                           (abbreviate-file-name name)))))
+                   (if (file-remote-p name) name
+                     (abbreviate-file-name name))))
                (read (current-buffer))))))
     (unless (seq-every-p
-             (lambda (elt) (stringp (car-safe elt)))
+             (lambda (elt) (stringp elt))
              project--list)
       (warn "Contents of %s are in wrong format, resetting"
             project-list-file)
@@ -1707,16 +1712,18 @@ project--ensure-read-project-list
     (project--read-project-list)))
 
 (defun project--write-project-list ()
-  "Save `project--list' in `project-list-file'."
+  "Save `project--list' in `project-list-file'.
+
+We store `project--list' as a list of one-element lists, each
+containing a project root."
   (let ((filename project-list-file))
     (with-temp-buffer
       (insert ";;; -*- lisp-data -*-\n")
       (let ((print-length nil)
             (print-level nil))
-        (pp (mapcar (lambda (elem)
-                      (let ((name (car elem)))
-                        (list (if (file-remote-p name) name
-                                (expand-file-name name)))))
+        (pp (mapcar (lambda (name)
+                      (list (if (file-remote-p name) name
+                                (expand-file-name name))))
                     project--list)
             (current-buffer)))
       (write-region nil nil filename nil 'silent))))
@@ -1728,11 +1735,10 @@ project-remember-project
 has changed, and NO-WRITE is nil."
   (project--ensure-read-project-list)
   (let ((dir (abbreviate-file-name (project-root pr))))
-    (unless (equal (caar project--list) dir)
-      (dolist (ent project--list)
-        (when (equal dir (car ent))
-          (setq project--list (delq ent project--list))))
-      (push (list dir) project--list)
+    (unless (equal (car project--list) dir)
+      (let ((history-delete-duplicates t)
+            (history-length t))
+        (add-to-history 'project--list dir))
       (unless no-write
         (project--write-project-list)))))
 
@@ -1743,10 +1749,11 @@ project--remove-from-project-list
 from the list using REPORT-MESSAGE, which is a format string
 passed to `message' as its first argument."
   (project--ensure-read-project-list)
-  (when-let ((ent (assoc (abbreviate-file-name project-root) project--list)))
-    (setq project--list (delq ent project--list))
-    (message report-message project-root)
-    (project--write-project-list)))
+  (let ((dir (abbreviate-file-name project-root)))
+    (when (member dir project--list)
+      (setq project--list (delete dir project--list))
+      (message report-message project-root)
+      (project--write-project-list))))
 
 ;;;###autoload
 (defun project-forget-project (project-root)
@@ -1757,6 +1764,8 @@ project-forget-project
   (project--remove-from-project-list
    project-root "Project `%s' removed from known projects"))
 
+(defvar project--dir-history)
+
 (defun project-prompt-project-dir ()
   "Prompt the user for a directory that is one of the known project roots.
 The project is chosen among projects known from the project list,
@@ -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)
+            (history-length t))
+        (add-to-history 'project--list pr-dir))
       pr-dir)))
 
+(defvar project--name-history)
+
 (defun project-prompt-project-name ()
   "Prompt the user for a project, by name, that is one of the known project roots.
 The project is chosen among projects known from the project list,
 see `project-list-file'.
 It's also possible to enter an arbitrary directory not in the list."
   (let* ((dir-choice "... (choose a dir)")
+         project--name-history
          (choices
           (let (ret)
-            (dolist (dir (project-known-project-roots))
+            ;; Iterate in reverse order so project--name-history is in
+            ;; the correct order.
+            (dolist (dir (reverse project--list))
               ;; we filter out directories that no longer map to a project,
               ;; since they don't have a clean project-name.
-              (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))))
             ret))
          ;; XXX: Just using this for the category (for the substring
          ;; completion style).
@@ -1798,17 +1820,23 @@ project-prompt-project-name
          (pr-name ""))
     (while (equal pr-name "")
       ;; If the user simply pressed RET, do this again until they don't.
-      (setq pr-name (completing-read "Select project: " table nil t)))
+      (setq pr-name
+            (let ((history-add-new-input nil))
+              (completing-read "Select project: " table nil t nil 'project--name-history))))
     (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))))
+        (let ((history-delete-duplicates t)
+              (history-length t))
+          (add-to-history 'project--list root))
+        root))))
 
 ;;;###autoload
 (defun project-known-project-roots ()
   "Return the list of root directories of all known projects."
   (project--ensure-read-project-list)
-  (mapcar #'car project--list))
+  project--list)
 
 ;;;###autoload
 (defun project-execute-extended-command ()
@@ -1866,13 +1894,14 @@ project-remember-projects-under
 projects."
   (interactive "DDirectory: \nP")
   (project--ensure-read-project-list)
-  (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))
+    (dolist (project roots)
       (puthash project t known))
     (dolist (subdir dirs)
       (when-let (((file-directory-p subdir))
-- 
2.39.3


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#67310; Package emacs. Full text available.

Message received at 67310 <at> debbugs.gnu.org:


Received: (at 67310) by debbugs.gnu.org; 22 Nov 2023 18:45:09 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 22 13:45:08 2023
Received: from localhost ([127.0.0.1]:59904 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r5sDk-000319-HI
	for submit <at> debbugs.gnu.org; Wed, 22 Nov 2023 13:45:08 -0500
Received: from out1-smtp.messagingengine.com ([66.111.4.25]:53213)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dmitry@HIDDEN>) id 1r5sDi-00030K-KN
 for 67310 <at> debbugs.gnu.org; Wed, 22 Nov 2023 13:45:07 -0500
Received: from compute4.internal (compute4.nyi.internal [10.202.2.44])
 by mailout.nyi.internal (Postfix) with ESMTP id 13DC95C0248;
 Wed, 22 Nov 2023 13:44:58 -0500 (EST)
Received: from mailfrontend1 ([10.202.2.162])
 by compute4.internal (MEProxy); Wed, 22 Nov 2023 13:44:58 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc
 :cc:content-transfer-encoding:content-type:content-type:date
 :date:from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:sender:subject:subject:to:to; s=fm3; t=
 1700678698; x=1700765098; bh=ExhPsKDNczegp7fRImedrQ96aMtkzjImRZD
 PnVa0KOM=; b=OKLQNQE7/88XXJYWig6ClDOBVUuBlVQ8d+5MYrOWe1xLuvRNEAG
 HUB5St4g3ZG14i5v4x/N0PwKBqx5xMt3YeiWZUaSOhcpe6tlHLqC5HRJZXgiohmp
 jqPojprCJMNfBB2OR14SAxWA1PckkSEZ/hnH9ibD6RcVK8Ssm2UuERP1diOG2jo3
 J1bWR6B6x4wBTiDsN7XYKItfb/B64x8AdTH+c0v3sx4tMzRH00EAcubZH0GABq93
 uVQ8dJcYtXvrInBuWqTvPn8m2HKdAjw9sqAyiX1HhSJcVPujK8biKmTt7WkZNxPI
 U1muHi++CEzHRU2nRzkrg5BtR8/nXy0PxyQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-transfer-encoding
 :content-type:content-type:date:date:feedback-id:feedback-id
 :from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:sender:subject:subject:to:to:x-me-proxy
 :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=
 1700678698; x=1700765098; bh=ExhPsKDNczegp7fRImedrQ96aMtkzjImRZD
 PnVa0KOM=; b=W77s6hVb36dg0q/hwKrcPbWJ6WRoN0F4vbEQodmlMvf9Uv3VFpr
 QArcuHBQ8VbAxc7OsG3zjCttA98fcG9c8WffuLfIlckMWwZQwmWp38yE3ab9YbUo
 NyuUy/Yy1iOOsGkv736VZDThza8l017AbE5xwZEmlYGdrV8sQiJIEVQCDBsv453V
 B21tt6tpAwbK+6Q8IwTpFUeyCBfm1T0Zvsr0pLE5vkvE+XGHygoRekHbYOQVg5BZ
 5hfCxOdR+/4b7rOm7SrkMj7S3IuVgFdtGpERYpnPOCByx38X7kfOUQHB50zLdFRl
 sDszN1ik8ooTD+9MuNwT6MeDYuetgTrUcqQ==
X-ME-Sender: <xms:KUxeZT0DrL-DGyZcKtsAs0lG8CN8DfMzap0ogcfFAJRb7UNXZsuL3Q>
 <xme:KUxeZSFLWFG3Kr1cSDnS4TsLO78j3wYCoglNizf1AmlERd6plfitXGiPyke4b8RzC
 jjcFyW8LGAz_gTiNkc>
X-ME-Received: <xmr:KUxeZT77483nN5zDg81jDF6NIU43O3xuEQEFxdBzye8Ei9T5w4ATEh1tx8hwwWY4px-O8g>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudehuddgudduhecutefuodetggdotefrod
 ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh
 necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd
 enucfjughrpefkffggfgfuvfevfhfhjggtgfesthejredttdefjeenucfhrhhomhepffhm
 ihhtrhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrdguvghvqeenucggtffrrg
 htthgvrhhnpeeigfetveehveevffehledtueekieeikeeufeegudfgfeeghfdulefgfeev
 ledvveenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe
 gumhhithhrhiesghhuthhovhdruggvvh
X-ME-Proxy: <xmx:KUxeZY0Z1yMXlOD2V6Muqx4II3Jq40G7ii2Dn5JylZNsEDoIEPSN_Q>
 <xmx:KUxeZWFTypOtjmiDZJcYmA7SOLgMr7RP5YhocHPGxirIzWsDJxDfGA>
 <xmx:KUxeZZ9CYTAYm6JLrdVb49FvSn2Q2hjlySrygn-15erq1eYgLQ1NbQ>
 <xmx:KkxeZbQLrr-9kMueKjOY5WgZaphri-OkvId_Cv80J4JBKEz6Ceb0Sw>
Feedback-ID: i0e71465a:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed,
 22 Nov 2023 13:44:56 -0500 (EST)
Message-ID: <5c3eb6a1-38da-8af4-419a-e0567b163e3a@HIDDEN>
Date: Wed, 22 Nov 2023 20:44:53 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.13.0
Subject: Re: bug#67310: [PATCH] Include the project--list as history when
 prompting for a project
Content-Language: en-US
To: Spencer Baugh <sbaugh@HIDDEN>
References: <ier8r6s42on.fsf@HIDDEN>
 <dc5ad8f4-b857-ea87-d178-bae903cee517@HIDDEN>
 <421e3ea8-d150-566e-f645-cbf1ccbcba61@HIDDEN>
 <ier34wz3zkx.fsf@HIDDEN>
 <81b6ed58-3fdc-3b5a-41a9-84d66475d5f1@HIDDEN>
 <ierr0khlq19.fsf@HIDDEN>
From: Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <ierr0khlq19.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -2.9 (--)
X-Debbugs-Envelope-To: 67310
Cc: 67310 <at> debbugs.gnu.org, eliz@HIDDEN, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.9 (---)

On 22/11/2023 18:18, Spencer Baugh wrote:
> Dmitry Gutov <dmitry@HIDDEN> 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?

Hmm, maybe not. Anyway, that sentence was supposed to lead into the next 
paragraph anyway.

> 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.

I suppose project-switch-project could add a project-remember-project 
call as well?

It's just that until recently it only supported project-related 
commands, and those would invoke (project-current t) right away -- 
adding the just-selected root into the list.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#67310; Package emacs. Full text available.

Message received at 67310 <at> debbugs.gnu.org:


Received: (at 67310) by debbugs.gnu.org; 22 Nov 2023 16:21:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 22 11:21:15 2023
Received: from localhost ([127.0.0.1]:59777 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r5pyV-0007bH-Dc
	for submit <at> debbugs.gnu.org; Wed, 22 Nov 2023 11:21:15 -0500
Received: from mxout5.mail.janestreet.com ([64.215.233.18]:42311)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <sbaugh@HIDDEN>) id 1r5pyU-0007b5-1z
 for 67310 <at> debbugs.gnu.org; Wed, 22 Nov 2023 11:21:14 -0500
From: Spencer Baugh <sbaugh@HIDDEN>
To: Dmitry Gutov <dmitry@HIDDEN>
Subject: Re: bug#67310: [PATCH] Include the project--list as history when
 prompting for a project
In-Reply-To: <c8c71e33-d7d9-d01c-fd5f-10f4421e7893@HIDDEN> (Dmitry Gutov's
 message of "Wed, 22 Nov 2023 03:42:57 +0200")
References: <ier8r6s42on.fsf@HIDDEN>
 <dc5ad8f4-b857-ea87-d178-bae903cee517@HIDDEN>
 <421e3ea8-d150-566e-f645-cbf1ccbcba61@HIDDEN>
 <ier34wz3zkx.fsf@HIDDEN>
 <c8c71e33-d7d9-d01c-fd5f-10f4421e7893@HIDDEN>
Date: Wed, 22 Nov 2023 11:21:05 -0500
Message-ID: <iero7fllpxq.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 67310
Cc: 67310 <at> debbugs.gnu.org, eliz@HIDDEN, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Dmitry Gutov <dmitry@HIDDEN> writes:
> On 21/11/2023 17:17, Spencer Baugh wrote:
>> I also stopped changing the format of project--list, so the patch is
>> overall simpler and more compatible.
>
> This part I didn't mind at all, actually (if not for the associated
> breakage in the project-list-file's contents).

Yeah but it makes the patch a fair bit harder to test in a running
Emacs, since project--list changes, and there's not much point to it
yet.  I think it's better to do it later, when it's actually bringing a
real benefit.  (allowing using savehist)




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#67310; Package emacs. Full text available.

Message received at 67310 <at> debbugs.gnu.org:


Received: (at 67310) by debbugs.gnu.org; 22 Nov 2023 16:19:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 22 11:19:11 2023
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 <at> debbugs.gnu.org>)
	id 1r5pwU-0007XP-SW
	for submit <at> debbugs.gnu.org; Wed, 22 Nov 2023 11:19:11 -0500
Received: from mxout1.mail.janestreet.com ([38.105.200.78]:53969)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <sbaugh@HIDDEN>) id 1r5pwS-0007Ws-I1
 for 67310 <at> debbugs.gnu.org; Wed, 22 Nov 2023 11:19:09 -0500
From: Spencer Baugh <sbaugh@HIDDEN>
To: Dmitry Gutov <dmitry@HIDDEN>
Subject: Re: bug#67310: [PATCH] Include the project--list as history when
 prompting for a project
In-Reply-To: <81b6ed58-3fdc-3b5a-41a9-84d66475d5f1@HIDDEN> (Dmitry Gutov's
 message of "Wed, 22 Nov 2023 03:40:28 +0200")
References: <ier8r6s42on.fsf@HIDDEN>
 <dc5ad8f4-b857-ea87-d178-bae903cee517@HIDDEN>
 <421e3ea8-d150-566e-f645-cbf1ccbcba61@HIDDEN>
 <ier34wz3zkx.fsf@HIDDEN>
 <81b6ed58-3fdc-3b5a-41a9-84d66475d5f1@HIDDEN>
Date: Wed, 22 Nov 2023 11:18:58 -0500
Message-ID: <ierr0khlq19.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 67310
Cc: 67310 <at> debbugs.gnu.org, eliz@HIDDEN, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Dmitry Gutov <dmitry@HIDDEN> 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.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#67310; Package emacs. Full text available.

Message received at 67310 <at> debbugs.gnu.org:


Received: (at 67310) by debbugs.gnu.org; 22 Nov 2023 01:43:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Nov 21 20:43:10 2023
Received: from localhost ([127.0.0.1]:57758 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r5cGk-00062j-9M
	for submit <at> debbugs.gnu.org; Tue, 21 Nov 2023 20:43:10 -0500
Received: from out4-smtp.messagingengine.com ([66.111.4.28]:53883)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dmitry@HIDDEN>) id 1r5cGi-00062V-Mo
 for 67310 <at> debbugs.gnu.org; Tue, 21 Nov 2023 20:43:09 -0500
Received: from compute3.internal (compute3.nyi.internal [10.202.2.43])
 by mailout.nyi.internal (Postfix) with ESMTP id 4E8715C07E6;
 Tue, 21 Nov 2023 20:43:00 -0500 (EST)
Received: from mailfrontend1 ([10.202.2.162])
 by compute3.internal (MEProxy); Tue, 21 Nov 2023 20:43:00 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc
 :cc:content-transfer-encoding:content-type:content-type:date
 :date:from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:sender:subject:subject:to:to; s=fm2; t=
 1700617380; x=1700703780; bh=C/V6aYc0A9esgQ1ykHWEqpAz5mK+KcsWwMc
 z+ga9LzM=; b=ms+doY6tMTgLRizArXyED8K0lCbvestbaUEUuq7kjiAlTv4WSab
 ziExOWyYXPUIXJ26AjEGRbXe3iaF2Fi+FOt1Sptv+b4jhW7mw5wFt9taLYA6pB9+
 gyjBw/+ZjtF9zy6wE/dln63BTtu9CfPJDTA9P76z6rLHgZG6JJDcTsWkKx+qTV1b
 5qKcBEmvjV/gr0U5fyQzzgcW/O+WPgOCnO/39aSpXr/n7vj7sG9vALCzKXI8pLvr
 u7AH/tjJo6lK3FFIx8op3sV2cwr+hZn9kZABr2FghtcUn13gJJtKqE+ZQytoKEws
 wi5acXmFItGepXIh+h4KL+iUmC679G+3FYw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-transfer-encoding
 :content-type:content-type:date:date:feedback-id:feedback-id
 :from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:sender:subject:subject:to:to:x-me-proxy
 :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=
 1700617380; x=1700703780; bh=C/V6aYc0A9esgQ1ykHWEqpAz5mK+KcsWwMc
 z+ga9LzM=; b=BgfX5kj2TmAnCsAkShlTgGFZYDimfsbk3a5vc/1J5Cygl0J7HCN
 3CBG3XxTBFxUCLTZNxFyMf4KBgnxGWz2oxz7OgCUNCPJq8+Qkrs3mq3zqO8Nw45r
 uwdkMm1YmMJ+eEaVOVsCwMB9IspVvBs+AhvSU6OzFtqrhyO5iZcCNqJHNuLs+MLQ
 pHqwNlPMaAyJWbFT7zv2aWoY1k+Z2oNVLjF/ux2xbGOm4Vwu2E9YVXrX+bIElf4P
 sGaPhHuwgsivh9WYu1Oi6Ox+fxNyWyZn1paywhRdTffsDA80K5d0xAhThZ+VYDz2
 hSaiVOCpx6lZXrJBIDcXxsOx6QmKrtlt9Eg==
X-ME-Sender: <xms:pFxdZdhpeGSXYgXBlov-b7ztL_dGQsKZw5dArFjhf_K3bOMjtUJxjQ>
 <xme:pFxdZSA9cyEXDuKU7o9jJc-5Qsxo80NWVqXimmMpxz1dAj4HeBMmz40fC7OS0dRnq
 4SiMowvk74e3GRN7Z0>
X-ME-Received: <xmr:pFxdZdEe3NfZnLyZeV5g5GPvKuw21D_PcAIMS3vghmSkH4qV__1AZi9zwYsejDokaBTveA>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudehtddgfeeiucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi
 thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth
 htvghrnhepiefgteevheevveffheeltdeukeeiieekueefgedugfefgefhudelgfefveel
 vdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug
 hmihhtrhihsehguhhtohhvrdguvghv
X-ME-Proxy: <xmx:pFxdZSRR-JdRrkJOYWKe_gE3JotJodYmYaYGdY2zbQ0sMnYHzLlXeA>
 <xmx:pFxdZayoFA91jWnbPCGlwfVWTMqP8Yit0xCSjCJgmm4M4LhYBOiLVw>
 <xmx:pFxdZY71zCJmPq6I3xDsqN5WYyGCFs_7nu_qdG7ZkFLMInKvfvnPgQ>
 <xmx:pFxdZV-fE7iZGXfSI0TfQgLdgIY4US8WOL_lYyMztUAP-ARzDt07TQ>
Feedback-ID: i0e71465a:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue,
 21 Nov 2023 20:42:58 -0500 (EST)
Message-ID: <c8c71e33-d7d9-d01c-fd5f-10f4421e7893@HIDDEN>
Date: Wed, 22 Nov 2023 03:42:57 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.13.0
Subject: Re: bug#67310: [PATCH] Include the project--list as history when
 prompting for a project
Content-Language: en-US
To: Spencer Baugh <sbaugh@HIDDEN>
References: <ier8r6s42on.fsf@HIDDEN>
 <dc5ad8f4-b857-ea87-d178-bae903cee517@HIDDEN>
 <421e3ea8-d150-566e-f645-cbf1ccbcba61@HIDDEN>
 <ier34wz3zkx.fsf@HIDDEN>
From: Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <ier34wz3zkx.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -2.9 (--)
X-Debbugs-Envelope-To: 67310
Cc: 67310 <at> debbugs.gnu.org, eliz@HIDDEN, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.9 (---)

On 21/11/2023 17:17, Spencer Baugh wrote:
> I also stopped changing the format of project--list, so the patch is
> overall simpler and more compatible.

This part I didn't mind at all, actually (if not for the associated 
breakage in the project-list-file's contents).




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#67310; Package emacs. Full text available.

Message received at 67310 <at> debbugs.gnu.org:


Received: (at 67310) by debbugs.gnu.org; 22 Nov 2023 01:40:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Nov 21 20:40:44 2023
Received: from localhost ([127.0.0.1]:57753 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r5cEN-0005yO-Ml
	for submit <at> debbugs.gnu.org; Tue, 21 Nov 2023 20:40:44 -0500
Received: from out1-smtp.messagingengine.com ([66.111.4.25]:36327)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dmitry@HIDDEN>) id 1r5cEL-0005yB-Sk
 for 67310 <at> debbugs.gnu.org; Tue, 21 Nov 2023 20:40:42 -0500
Received: from compute2.internal (compute2.nyi.internal [10.202.2.46])
 by mailout.nyi.internal (Postfix) with ESMTP id B2C925C09EF;
 Tue, 21 Nov 2023 20:40:33 -0500 (EST)
Received: from mailfrontend1 ([10.202.2.162])
 by compute2.internal (MEProxy); Tue, 21 Nov 2023 20:40:33 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc
 :cc:content-transfer-encoding:content-type:content-type:date
 :date:from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:sender:subject:subject:to:to; s=fm2; t=
 1700617233; x=1700703633; bh=7lh3r6PTqLdw8VWKxqmdVBEQFSMOtSspoWa
 9X02aeLg=; b=FUe7CnjloFDJZNQ0HhCIdfJMVtNtP+DFxJjZQr62rFTyQ59/B+C
 QO+zaOsNGTzqGDglTf3H5La1XFOxTKrx09y1wKcCTvibSPRyOhcsfY/NzLk+Dpcs
 z4YwetVLtrXGVfKxmgI7Use50S6eCNO9CMa6NdfSiV6AB3Zu0Q9R0PRLkgGJSKYn
 FltdGILw+LytGQZn+RWHijgbBueU8T8JE6ME1wQvyYLFKFSlMLDnR4A5OdC0ZYpr
 FSbP4zz0Ag9YKNZG4BLMMyiMkfUAQPpUgh3/V10wv0E6XDYuEkrr+ylwTjkMWn7t
 7TdmEkRfDriGyE0/AjGeuc/1J7zJpBqcugg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-transfer-encoding
 :content-type:content-type:date:date:feedback-id:feedback-id
 :from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:sender:subject:subject:to:to:x-me-proxy
 :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=
 1700617233; x=1700703633; bh=7lh3r6PTqLdw8VWKxqmdVBEQFSMOtSspoWa
 9X02aeLg=; b=hHWSq6oyU2hJihfaV6K3CSFXgqXjF4Y6U4bTWueS7+Y2S7LG4v+
 x92LyWsp9NhCeaB15xUywLyn+OpgWM5/OScRNOgrth+6eQlegC4hCbvG0tCAmgNJ
 BT4slpwzIyr4uek269g3mm5E3bmq1G6dCEmDDEUCNF5Tnvhe/tsS71c7TiUe1+G3
 sBjAMsQLR0Jj8M/lJj1ykcBFyEYBW93cjYI+P4AvU9fNfLgFGDXH5IO2eWuLQ7Bz
 FJRRC8fD8c29oPElM3Ptqj3M+OblQ78ucWNKnAqoIxTadmEhsZGXWeVfXFWpCQBY
 PLBmoS2uSX6+30/B9zc04jLIYYLmGSDLBmA==
X-ME-Sender: <xms:EVxdZTBpA4sww-oo7CDOTqwtmPs_EbunKVMDhNBlXXWggWPoXciRIg>
 <xme:EVxdZZgFKyFxv2I_tAXWmYPdpPhrxZOEtFplypz1sRLcu-gS1c3HjceWNRlmaeNSz
 vJCaUqT5JQ1oc4byAs>
X-ME-Received: <xmr:EVxdZelJ2LVo27RjaiovhHyrTvS-31pqXwc-H7MLSdCwsgomYNHAoZpWWwjkIHNfz8DW-g>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudehtddgfeeiucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi
 thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth
 htvghrnhepiefgteevheevveffheeltdeukeeiieekueefgedugfefgefhudelgfefveel
 vdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug
 hmihhtrhihsehguhhtohhvrdguvghv
X-ME-Proxy: <xmx:EVxdZVw6LjVFEFFQfcAxqq1pW2Dv43JRiT2Lj_wCRYS5OO0gy2PMWw>
 <xmx:EVxdZYRFMf74XmOj3vQH52YyKdVVpAPRQNFnx-28wyiFls3DYaeJmQ>
 <xmx:EVxdZYbNBY7QmRkeLbNfuqqsHP2qE5WBNoE9Drd5TixTwgk0HRovMA>
 <xmx:EVxdZTf_ZSNHpAgHkgxZyVevhohhpwiaUvVXhgrseZsD70b0hZVvHw>
Feedback-ID: i0e71465a:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue,
 21 Nov 2023 20:40:32 -0500 (EST)
Message-ID: <81b6ed58-3fdc-3b5a-41a9-84d66475d5f1@HIDDEN>
Date: Wed, 22 Nov 2023 03:40:28 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.13.0
Subject: Re: bug#67310: [PATCH] Include the project--list as history when
 prompting for a project
Content-Language: en-US
To: Spencer Baugh <sbaugh@HIDDEN>
References: <ier8r6s42on.fsf@HIDDEN>
 <dc5ad8f4-b857-ea87-d178-bae903cee517@HIDDEN>
 <421e3ea8-d150-566e-f645-cbf1ccbcba61@HIDDEN>
 <ier34wz3zkx.fsf@HIDDEN>
From: Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <ier34wz3zkx.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -2.9 (--)
X-Debbugs-Envelope-To: 67310
Cc: 67310 <at> debbugs.gnu.org, eliz@HIDDEN, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.9 (---)

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?

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?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#67310; Package emacs. Full text available.

Message received at 67310 <at> debbugs.gnu.org:


Received: (at 67310) by debbugs.gnu.org; 21 Nov 2023 15:18:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Nov 21 10:18:02 2023
Received: from localhost ([127.0.0.1]:57218 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r5SVl-0005cY-Gz
	for submit <at> debbugs.gnu.org; Tue, 21 Nov 2023 10:18:02 -0500
Received: from mxout5.mail.janestreet.com ([64.215.233.18]:37697)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <sbaugh@HIDDEN>) id 1r5SVj-0005cF-4V
 for 67310 <at> debbugs.gnu.org; Tue, 21 Nov 2023 10:17:59 -0500
From: Spencer Baugh <sbaugh@HIDDEN>
To: Dmitry Gutov <dmitry@HIDDEN>
Subject: Re: bug#67310: [PATCH] Include the project--list as history when
 prompting for a project
In-Reply-To: <421e3ea8-d150-566e-f645-cbf1ccbcba61@HIDDEN> (Dmitry Gutov's
 message of "Tue, 21 Nov 2023 13:14:29 +0200")
References: <ier8r6s42on.fsf@HIDDEN>
 <dc5ad8f4-b857-ea87-d178-bae903cee517@HIDDEN>
 <421e3ea8-d150-566e-f645-cbf1ccbcba61@HIDDEN>
Date: Tue, 21 Nov 2023 10:17:50 -0500
Message-ID: <ier34wz3zkx.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 67310
Cc: 67310 <at> debbugs.gnu.org, eliz@HIDDEN, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Dmitry Gutov <dmitry@HIDDEN> writes:
> On 21/11/2023 13:06, Dmitry Gutov wrote:
>> On 20/11/2023 21:58, Spencer Baugh wrote:
>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0 (completing-read "Select project: " choices nil t
>>> nil 'project--list))))
>> I wonder if this will make 'project--list' to be automatically
>> managed my savehist-mode (because of what savehist-minibuffer-hook
>> does).
>> And then the contents of this var might be restored by savehist-mode
>> (when enabled) at a time or in a way that project.el is not
>> expecting.
>
> Sorry, I sent this by accident, it was in drafts.
>
> You explained this in the patch's message. But could there be a way
> that the list of overwritten anyway? Like when the user enables
> savehist-mode mid-session (or simply after project--list is used for
> the first time), and savehist-mode reads the histories from a saved
> file, overwriting the current session's values?

Oh, good point.

> Perhaps it would be more reliable to have separate history variables
> (one for directory names, and one for project names), and construct
> their values dynamically before reading the project.

Agreed, done in this patch.

I also stopped changing the format of project--list, so the patch is
overall simpler and more compatible.


--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline;
 filename=0001-Use-the-project-list-as-history-when-prompting-for-a.patch

From c42a43008657fa6a203c533dd15499765a0bcfbf Mon Sep 17 00:00:00 2001
From: Spencer Baugh <sbaugh@HIDDEN>
Date: Tue, 21 Nov 2023 10:11:52 -0500
Subject: [PATCH] Use the project--list as history when prompting for a project

The project--list is already ordered such that the most recently used
projects are at the front.  Now we use it as the minibuffer history
when prompting for a project.

To avoid savehist from picking up project--list as a minibuffer
history variable and overriding our own persistence mechanism, we
don't pass project--list directly as a history variable, but instead
pass project--dir-history or project--name-history, dynamically-bound
to an appropriate value.  project--dir-history and
project--name-history won't be persisted since they're always unbound
at the top level; but if they are persisted anyway somehow, it won't
affect us.

If we later find a way to rely on savehist for persistence instead of
having our own mechanism, we can change the in-memory format of
project--list to be just a list of directories, and our explicit calls
to project--add-dir can be replaced by let-binding
history-delete-duplicates=t, history-length=t.

* lisp/progmodes/project.el (project--add-dir): Add.
(project-remember-project): Use project--add-dir.
(project--name-history, project-prompt-project-name)
(project--dir-history, project-prompt-project-dir): Pass a
preprocessed project--list as HIST to completing-read and call
project-add-dir afterwards.
---
 lisp/progmodes/project.el | 45 +++++++++++++++++++++++++++++----------
 1 file changed, 34 insertions(+), 11 deletions(-)

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 95db9d0ef4c..a2fbfe2aab3 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -1721,13 +1721,12 @@ project--write-project-list
             (current-buffer)))
       (write-region nil nil filename nil 'silent))))
 
-;;;###autoload
-(defun project-remember-project (pr &optional no-write)
-  "Add project PR to the front of the project list.
+(defun project--add-dir (root &optional no-write)
+  "Add project root ROOT to the front of the project list.
 Save the result in `project-list-file' if the list of projects
 has changed, and NO-WRITE is nil."
   (project--ensure-read-project-list)
-  (let ((dir (abbreviate-file-name (project-root pr))))
+  (let ((dir (abbreviate-file-name root)))
     (unless (equal (caar project--list) dir)
       (dolist (ent project--list)
         (when (equal dir (car ent))
@@ -1736,6 +1735,13 @@ project-remember-project
       (unless no-write
         (project--write-project-list)))))
 
+;;;###autoload
+(defun project-remember-project (pr &optional no-write)
+  "Add project PR to the front of the project list.
+Save the result in `project-list-file' if the list of projects
+has changed, and NO-WRITE is nil."
+  (project--add-dir (project-root pr) no-write))
+
 (defun project--remove-from-project-list (project-root report-message)
   "Remove directory PROJECT-ROOT of a missing project from the project list.
 If the directory was in the list before the removal, save the
@@ -1757,6 +1763,8 @@ project-forget-project
   (project--remove-from-project-list
    project-root "Project `%s' removed from known projects"))
 
+(defvar project--dir-history)
+
 (defun project-prompt-project-dir ()
   "Prompt the user for a directory that is one of the known project roots.
 The project is chosen among projects known from the project list,
@@ -1769,27 +1777,38 @@ project-prompt-project-dir
           ;; completion style).
           (project--file-completion-table
            (append project--list `(,dir-choice))))
+         (project--dir-history (project-known-project-roots))
          (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)
+      (project--add-dir pr-dir)
       pr-dir)))
 
+(defvar project--name-history)
+
 (defun project-prompt-project-name ()
   "Prompt the user for a project, by name, that is one of the known project roots.
 The project is chosen among projects known from the project list,
 see `project-list-file'.
 It's also possible to enter an arbitrary directory not in the list."
   (let* ((dir-choice "... (choose a dir)")
+         project--name-history
          (choices
           (let (ret)
-            (dolist (dir (project-known-project-roots))
+            ;; Iterate in reverse order so project--name-history is in
+            ;; the correct order.
+            (dolist (dir (reverse (project-known-project-roots)))
               ;; we filter out directories that no longer map to a project,
               ;; since they don't have a clean project-name.
-              (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))))
             ret))
          ;; XXX: Just using this for the category (for the substring
          ;; completion style).
@@ -1798,11 +1817,15 @@ project-prompt-project-name
          (pr-name ""))
     (while (equal pr-name "")
       ;; If the user simply pressed RET, do this again until they don't.
-      (setq pr-name (completing-read "Select project: " table nil t)))
+      (setq pr-name
+            (let ((history-add-new-input nil))
+              (completing-read "Select project: " table nil t nil 'project--name-history))))
     (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))))
 
 ;;;###autoload
 (defun project-known-project-roots ()
-- 
2.39.3


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#67310; Package emacs. Full text available.

Message received at 67310 <at> debbugs.gnu.org:


Received: (at 67310) by debbugs.gnu.org; 21 Nov 2023 11:14:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Nov 21 06:14:42 2023
Received: from localhost ([127.0.0.1]:55253 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r5OiI-0004lv-Be
	for submit <at> debbugs.gnu.org; Tue, 21 Nov 2023 06:14:42 -0500
Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:60589)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dmitry@HIDDEN>) id 1r5OiG-0004lj-TU
 for 67310 <at> debbugs.gnu.org; Tue, 21 Nov 2023 06:14:41 -0500
Received: from compute1.internal (compute1.nyi.internal [10.202.2.41])
 by mailout.west.internal (Postfix) with ESMTP id 63A573201333;
 Tue, 21 Nov 2023 06:14:32 -0500 (EST)
Received: from mailfrontend1 ([10.202.2.162])
 by compute1.internal (MEProxy); Tue, 21 Nov 2023 06:14:32 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc
 :cc:content-transfer-encoding:content-type:content-type:date
 :date:from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:sender:subject:subject:to:to; s=fm2; t=
 1700565271; x=1700651671; bh=dw1LDb+EaxpKbgb4isvH/GXBB20RDQ/oLNi
 +H8yqV+Y=; b=iw48Km1W81DtrEB/JCqzpnma5OMp/34IGDJwWZkmWKV7tCtaWd9
 lwCci0Hgz2UNzH8VVcAcr4WBZO+zS9Gd7NPm8pg2a/cpgXkH/sSFKPC7nrBdgyq1
 +zMfk5Kn1BYoZ6LF3oA3s/yNuQTYhiJXWwzop9yGhpiXEqgcw2hcop7R95SR4F/Z
 mg/qo8lmhj9M7/LZ9wNpIoKjZcN0Pgeu6GywitocnSvbwkrvwuvi0WvSs4acZg26
 PXl6SbDH7h0Hi1cIp7Y6zVJZk7GFnYz/r7RmJtzG9mV1kbNoMbL27uHlau4ffYdL
 XvVcMm28MnqRm/2aZg+Wb872c6K1jLI1c0g==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-transfer-encoding
 :content-type:content-type:date:date:feedback-id:feedback-id
 :from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:sender:subject:subject:to:to:x-me-proxy
 :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=
 1700565271; x=1700651671; bh=dw1LDb+EaxpKbgb4isvH/GXBB20RDQ/oLNi
 +H8yqV+Y=; b=v79sD8FJBSOF5YebCngfBqVITDuBPI4y+kGOf1b3IKszZM2NXrq
 bSHgmre9pRi22Ng3aaThKiOlQsVL1LMJuz+4nPAjegbQcvyVMYom62XfGrdRcFJE
 1OGO1LNQ95VS5CgVXK8JcWznCdiDhTwkoyvtrwfaHly/WsdNbpyhGIre+OUXb0hH
 ibudzDZDdeYuV5VYBknAYrrKlNBKElMA/C6MAWEyN65Fd6B40EtbVE+Kvsw7vAxD
 jiWNBig0KDdJp3YmViJhYqx6EKm/vnHPyohpb/OaVfSfIqOoRXeq1iWtdJ90QL4b
 +qgQXUyaDTZ18KSMXZq0ycYM1r8kLLhwYlQ==
X-ME-Sender: <xms:F5FcZWcphGk3UKMiYGsJSnm5eiPDVLa6CB4nR6wgnbWjaMNx5FN7IA>
 <xme:F5FcZQNHYm9C6A4ZQmEaRBVt3AGRzhJwNRA2Tlz5rkcTybWLlOcAndrXuMGVshnyj
 RJ_llqc4oDLY0MM_GU>
X-ME-Received: <xmr:F5FcZXhGycAy-4gbD9B7Z2xs_E8qQ3y2XRAqEcxEOX-AhqQnNzLHnc9dkwGp1fHc2hfeUw>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudegledgvddvucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhepkfffgggfuffhvfevfhgjtgfgsehtkeertddtfeejnecuhfhrohhmpeffmhhi
 thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth
 htvghrnhephfeftdejleetffelhfffteefgfeggfejgfdtudeuvedttdetvdelffekvdeg
 udetnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug
 hmihhtrhihsehguhhtohhvrdguvghv
X-ME-Proxy: <xmx:F5FcZT89hjbbxvws_yPFUWH5XKJF14D9ge2y6kEfqERzSWoNePy_Ow>
 <xmx:F5FcZStyhiawqgWl3w47gDGJsalioWl0ppISb0_WQn6vlQezN8t-uA>
 <xmx:F5FcZaHaWzz39JawMYqFKHxxiVT3xWvKD0yrSkLQloEc67yF-ToG6w>
 <xmx:F5FcZb55P2pL4-SPth-ZxHRH41wfO2lgaQeag0C7BwgB1d6ZAuYehQ>
Feedback-ID: i0e71465a:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue,
 21 Nov 2023 06:14:30 -0500 (EST)
Message-ID: <421e3ea8-d150-566e-f645-cbf1ccbcba61@HIDDEN>
Date: Tue, 21 Nov 2023 13:14:29 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.13.0
Subject: Re: bug#67310: [PATCH] Include the project--list as history when
 prompting for a project
Content-Language: en-US
From: Dmitry Gutov <dmitry@HIDDEN>
To: Spencer Baugh <sbaugh@HIDDEN>, 67310 <at> debbugs.gnu.org
References: <ier8r6s42on.fsf@HIDDEN>
 <dc5ad8f4-b857-ea87-d178-bae903cee517@HIDDEN>
In-Reply-To: <dc5ad8f4-b857-ea87-d178-bae903cee517@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.9 (--)
X-Debbugs-Envelope-To: 67310
Cc: eliz@HIDDEN, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.9 (---)

On 21/11/2023 13:06, Dmitry Gutov wrote:
> On 20/11/2023 21:58, Spencer Baugh wrote:
>> +              (completing-read "Select project: " choices nil t nil 
>> 'project--list))))
> 
> I wonder if this will make 'project--list' to be automatically managed 
> my savehist-mode (because of what savehist-minibuffer-hook does).
> 
> And then the contents of this var might be restored by savehist-mode 
> (when enabled) at a time or in a way that project.el is not expecting.

Sorry, I sent this by accident, it was in drafts.

You explained this in the patch's message. But could there be a way that 
the list of overwritten anyway? Like when the user enables savehist-mode 
mid-session (or simply after project--list is used for the first time), 
and savehist-mode reads the histories from a saved file, overwriting the 
current session's values?

Perhaps it would be more reliable to have separate history variables 
(one for directory names, and one for project names), and construct 
their values dynamically before reading the project.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#67310; Package emacs. Full text available.

Message received at 67310 <at> debbugs.gnu.org:


Received: (at 67310) by debbugs.gnu.org; 21 Nov 2023 11:07:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Nov 21 06:07:02 2023
Received: from localhost ([127.0.0.1]:55238 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r5Oaq-0004Zs-9B
	for submit <at> debbugs.gnu.org; Tue, 21 Nov 2023 06:07:02 -0500
Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:58541)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dmitry@HIDDEN>) id 1r5Oak-0004ZZ-C1
 for 67310 <at> debbugs.gnu.org; Tue, 21 Nov 2023 06:06:58 -0500
Received: from compute1.internal (compute1.nyi.internal [10.202.2.41])
 by mailout.west.internal (Postfix) with ESMTP id A30853201365;
 Tue, 21 Nov 2023 06:06:45 -0500 (EST)
Received: from mailfrontend1 ([10.202.2.162])
 by compute1.internal (MEProxy); Tue, 21 Nov 2023 06:06:46 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc
 :cc:content-transfer-encoding:content-type:content-type:date
 :date:from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:sender:subject:subject:to:to; s=fm2; t=
 1700564805; x=1700651205; bh=Xz98MqswZmn/Bp4YJQBFUrslqFmesy0Ilzo
 S5FVFNTA=; b=hXSMu3EFcgZUOz5PBPNUnlalcKaiAJ0mzI5yiEd/Vkmq28tuMr0
 /aAzAjixuzzuVMx+lnIptiaJeqv9eSHrBkUTmqx+VrOVpz4ryq1SYJIkoUVDv+i7
 0PYM8tVpaOuW1uGSBoVkHtfUcVR6e2LJW/ZDAMCtnFyDsi6VoE7nPmyYRwLlEPZb
 8zTcJZcrfNDKLhmjIvPhMJb/zKHi4sGUaubml5gcTUgKwIclD2t7RL4McZqdn64S
 6/Xk/+lRyyEUKwzGxd2sy7kjXzAQKpQXN59jd4wkqPtdl+yIo5nda+ax/UG/22J7
 fM07RMsbmUtnK99Uf6FbpoY+HFcmiYl+X7Q==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-transfer-encoding
 :content-type:content-type:date:date:feedback-id:feedback-id
 :from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:sender:subject:subject:to:to:x-me-proxy
 :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=
 1700564805; x=1700651205; bh=Xz98MqswZmn/Bp4YJQBFUrslqFmesy0Ilzo
 S5FVFNTA=; b=tV4DZw8+QfVHnRQkvJQY4cOyQHmUxixI7B2vMYy21EdEg4HT62T
 Jr9ACDCNtmzZ3r6UvoOwJJ1sNmg7q4PtomSo9fDwSBL0r8TOyfq0wQzlEKWQsNyD
 +0FcUAjO+Az8UuzyduL65Yw1dkJikA59VtQy/+OY4/xisXN5p8XLW8pq9ev49z0/
 RlrjreACv6Ljuz+/h3hOiGSF32FvlLv9jX+GTDs8n5Bb1ta50CyVRenOYs91MfU1
 J5s5Z6QyFA20CbcnKdgnAe0x/+CsFecLUshOagpIxXyBXlKF6R2hUgyoFR3jkX+V
 1Jv5pNa0kISn477BMvz9XghMAql6ZxPA3Rg==
X-ME-Sender: <xms:RI9cZVqS87Ovy-0o76oeHDj75NfvaeTIjelfSCt4QTeVxW4uX_JJag>
 <xme:RI9cZXpIILOmGPct08HKIYcXuF8YmIEzbo04VMtFOzebq8RLeYPwZtf47hiX8VDOP
 h12oTYPX91HWUvmm70>
X-ME-Received: <xmr:RI9cZSPQtNmBMM8F7_4_Wj-dUmzDBshDNgy6plA5u_4lJSbDRy-TVJ5PzRO1R-EpEH7Y8w>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudegledgvdduucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi
 thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth
 htvghrnhepiefgteevheevveffheeltdeukeeiieekueefgedugfefgefhudelgfefveel
 vdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug
 hmihhtrhihsehguhhtohhvrdguvghv
X-ME-Proxy: <xmx:RI9cZQ59I6RBE-8F2WrT5Mjyctuye20rAzIIO3L1HDtltV1TLZG7tw>
 <xmx:RI9cZU6Xom5_A_VaptCASYqm0Tj1qpXJAbBa4GYBO0VcXc9woETEAA>
 <xmx:RI9cZYgc-c_-jRFkxFn_GS5ZrsOKeNCNIZP8bWZrwYOeOX2jl6g7EA>
 <xmx:RY9cZUEAAEz3Xa1PHblbByZ1PJ1FZKX7Qlqt63uY98iilxyYTSieTw>
Feedback-ID: i0e71465a:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue,
 21 Nov 2023 06:06:43 -0500 (EST)
Message-ID: <dc5ad8f4-b857-ea87-d178-bae903cee517@HIDDEN>
Date: Tue, 21 Nov 2023 13:06:40 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.13.0
Subject: Re: bug#67310: [PATCH] Include the project--list as history when
 prompting for a project
Content-Language: en-US
To: Spencer Baugh <sbaugh@HIDDEN>, 67310 <at> debbugs.gnu.org
References: <ier8r6s42on.fsf@HIDDEN>
From: Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <ier8r6s42on.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -2.2 (--)
X-Debbugs-Envelope-To: 67310
Cc: eliz@HIDDEN, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.9 (---)

On 20/11/2023 21:58, Spencer Baugh wrote:
> +              (completing-read "Select project: " choices nil t nil 'project--list))))

I wonder if this will make 'project--list' to be automatically managed 
my savehist-mode (because of what savehist-minibuffer-hook does).

And then the contents of this var might be restored by savehist-mode 
(when enabled) at a time or in a way that project.el is not expecting.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#67310; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 20 Nov 2023 19:58:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Nov 20 14:58:46 2023
Received: from localhost ([127.0.0.1]:54696 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r5APu-0005Sq-3a
	for submit <at> debbugs.gnu.org; Mon, 20 Nov 2023 14:58:46 -0500
Received: from lists.gnu.org ([2001:470:142::17]:42646)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <sbaugh@HIDDEN>) id 1r5APs-0005Sb-Dn
 for submit <at> debbugs.gnu.org; Mon, 20 Nov 2023 14:58:45 -0500
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 <sbaugh@HIDDEN>)
 id 1r5APk-0007GO-Kw
 for bug-gnu-emacs@HIDDEN; Mon, 20 Nov 2023 14:58:36 -0500
Received: from mxout5.mail.janestreet.com ([64.215.233.18])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <sbaugh@HIDDEN>)
 id 1r5APi-0007PL-6b
 for bug-gnu-emacs@HIDDEN; Mon, 20 Nov 2023 14:58:36 -0500
From: Spencer Baugh <sbaugh@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: [PATCH] Include the project--list as history when prompting for a
 project
Date: Mon, 20 Nov 2023 14:58:32 -0500
Message-ID: <ier8r6s42on.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=64.215.233.18; envelope-from=sbaugh@HIDDEN;
 helo=mxout5.mail.janestreet.com
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_MSPIKE_H5=0.001,
 RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-Debbugs-Envelope-To: submit
Cc: dmitry@HIDDEN, eliz@HIDDEN, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.1 (/)

--=-=-=
Content-Type: text/plain

Tags: patch


The following patch uses project--list as a minibuffer history variable.
Now one can more easily switch between several related projects.

Independent from ongoing discussion about how to persist project--list
in bug#66993, this should be a useful improvement on its own.

This patch takes special care to avoid relying on savehist's persistent
mechanism, since savehist now knows about project--list as a minibuffer
history variable.

This patch does change the in-memory format of project--list, but not
the on-disk format, and project-known-project-roots still works, so this
patch should be backwards compatible.

In GNU Emacs 29.1.90 (build 2, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.15.12, Xaw scroll bars) of 2023-11-20 built on
 igm-qws-u22796a
Repository revision: dd8669b14b8a2b9a6d214a9d142dd8ac604f83d2
Repository branch: emacs-29
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Rocky Linux 8.8 (Green Obsidian)

Configured using:
 'configure --config-cache --with-x-toolkit=lucid
 --with-gif=ifavailable'


--=-=-=
Content-Type: text/patch
Content-Disposition: attachment;
 filename=0001-Include-the-project-list-as-history-when-prompting-f.patch

From 89a4df13ca4c678bd9915e134c078607486348fe Mon Sep 17 00:00:00 2001
From: Spencer Baugh <sbaugh@HIDDEN>
Date: Mon, 20 Nov 2023 14:38:22 -0500
Subject: [PATCH] Include the project--list as history when prompting for a
 project

The project--list is already ordered such that the most recently used
projects are at the front.  Now we pass it as the history variable
when prompting for a project, so it can be used as minibuffer history.

To support this, we minorly change its in-memory format: Instead of a
list of lists, each containing a project-root, it's just a list of
project-roots directly.  This lets us pass it directly to functions
completing-read and add-to-history.  The persistent format (what's
saved in project-list-file) remains the same.

Since project--list is now a minibuffer history variable, if the user
has savehist enabled, project--list will be saved and restored by
savehist.  To avoid that overriding our own persistence mechanism, we
need a separate project--list-initialized variable.

* lisp/progmodes/project.el (project--list): Update docstring for new
format.
(project--list-initialized): Add.
(project--ensure-read-project-list): Check project--list-initialized.
(project-known-project-roots, project-remember-projects-under)
(project--read-project-list, project--write-project-list)
(project-remember-project, project--remove-from-project-list): Support
new format for project--list.
(project-prompt-project-dir): Pass project--list as HIST to
completing-read.
(project--name-history, project-prompt-project-name): Pass a
preprocessed project--list as HIST to completing-read.
---
 lisp/progmodes/project.el | 99 +++++++++++++++++++++++++--------------
 1 file changed, 63 insertions(+), 36 deletions(-)

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 95db9d0ef4c..bba1248fd73 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -1678,11 +1678,18 @@ project-list-file
   :group 'project)
 
 (defvar project--list 'unset
-  "List structure containing root directories of known projects.
-With some possible metadata (to be decided).")
+  "List of root directories of known projects.
+
+This is also the minibuffer history variable for
+`project-prompt-project-dir' and `project-prompt-project-name'.")
+
+(defvar project--list-initialized nil)
 
 (defun project--read-project-list ()
-  "Initialize `project--list' using contents of `project-list-file'."
+  "Initialize `project--list' using contents of `project-list-file'.
+
+We expect `project-list-file' to contain a list of one-element
+lists, each containing a project root."
   (let ((filename project-list-file))
     (setq project--list
           (when (file-exists-p filename)
@@ -1691,11 +1698,12 @@ project--read-project-list
               (mapcar
                (lambda (elem)
                  (let ((name (car elem)))
-                   (list (if (file-remote-p name) name
-                           (abbreviate-file-name name)))))
+                   (if (file-remote-p name) name
+                     (abbreviate-file-name name))))
                (read (current-buffer))))))
+    (setq project--list-initialized t)
     (unless (seq-every-p
-             (lambda (elt) (stringp (car-safe elt)))
+             (lambda (elt) (stringp elt))
              project--list)
       (warn "Contents of %s are in wrong format, resetting"
             project-list-file)
@@ -1703,20 +1711,22 @@ project--read-project-list
 
 (defun project--ensure-read-project-list ()
   "Initialize `project--list' if it isn't already initialized."
-  (when (eq project--list 'unset)
+  (unless project--list-initialized
     (project--read-project-list)))
 
 (defun project--write-project-list ()
-  "Save `project--list' in `project-list-file'."
+  "Save `project--list' in `project-list-file'.
+
+We store `project--list' as a list of one-element lists, each
+containing a project root."
   (let ((filename project-list-file))
     (with-temp-buffer
       (insert ";;; -*- lisp-data -*-\n")
       (let ((print-length nil)
             (print-level nil))
-        (pp (mapcar (lambda (elem)
-                      (let ((name (car elem)))
-                        (list (if (file-remote-p name) name
-                                (expand-file-name name)))))
+        (pp (mapcar (lambda (name)
+                      (list (if (file-remote-p name) name
+                                (expand-file-name name))))
                     project--list)
             (current-buffer)))
       (write-region nil nil filename nil 'silent))))
@@ -1728,11 +1738,10 @@ project-remember-project
 has changed, and NO-WRITE is nil."
   (project--ensure-read-project-list)
   (let ((dir (abbreviate-file-name (project-root pr))))
-    (unless (equal (caar project--list) dir)
-      (dolist (ent project--list)
-        (when (equal dir (car ent))
-          (setq project--list (delq ent project--list))))
-      (push (list dir) project--list)
+    (unless (equal (car project--list) dir)
+      (let ((history-delete-duplicates t)
+            (history-length t))
+        (add-to-history 'project--list dir))
       (unless no-write
         (project--write-project-list)))))
 
@@ -1743,10 +1752,11 @@ project--remove-from-project-list
 from the list using REPORT-MESSAGE, which is a format string
 passed to `message' as its first argument."
   (project--ensure-read-project-list)
-  (when-let ((ent (assoc (abbreviate-file-name project-root) project--list)))
-    (setq project--list (delq ent project--list))
-    (message report-message project-root)
-    (project--write-project-list)))
+  (let ((dir (abbreviate-file-name project-root)))
+    (when (member dir project--list)
+      (setq project--list (delete dir project--list))
+      (message report-message project-root)
+      (project--write-project-list))))
 
 ;;;###autoload
 (defun project-forget-project (project-root)
@@ -1772,24 +1782,34 @@ project-prompt-project-dir
          (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-delete-duplicates t)
+                  (history-length t))
+              (completing-read "Select project: " choices nil t nil 'project--list))))
     (if (equal pr-dir dir-choice)
         (read-directory-name "Select directory: " default-directory nil t)
       pr-dir)))
 
+(defvar project--name-history)
+
 (defun project-prompt-project-name ()
   "Prompt the user for a project, by name, that is one of the known project roots.
 The project is chosen among projects known from the project list,
 see `project-list-file'.
 It's also possible to enter an arbitrary directory not in the list."
   (let* ((dir-choice "... (choose a dir)")
+         project--name-history
          (choices
           (let (ret)
-            (dolist (dir (project-known-project-roots))
+            ;; Iterate in reverse order so project--name-history is in
+            ;; the correct order.
+            (dolist (dir (reverse project--list))
               ;; we filter out directories that no longer map to a project,
               ;; since they don't have a clean project-name.
-              (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))))
             ret))
          ;; XXX: Just using this for the category (for the substring
          ;; completion style).
@@ -1798,17 +1818,23 @@ project-prompt-project-name
          (pr-name ""))
     (while (equal pr-name "")
       ;; If the user simply pressed RET, do this again until they don't.
-      (setq pr-name (completing-read "Select project: " table nil t)))
+      (setq pr-name
+            (let ((history-add-new-input nil))
+              (completing-read "Select project: " table nil t nil 'project--name-history))))
     (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))))
+        (let ((history-delete-duplicates t)
+              (history-length t))
+          (add-to-history 'project--list root))
+        root))))
 
 ;;;###autoload
 (defun project-known-project-roots ()
   "Return the list of root directories of all known projects."
   (project--ensure-read-project-list)
-  (mapcar #'car project--list))
+  project--list)
 
 ;;;###autoload
 (defun project-execute-extended-command ()
@@ -1866,13 +1892,14 @@ project-remember-projects-under
 projects."
   (interactive "DDirectory: \nP")
   (project--ensure-read-project-list)
-  (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))
+    (dolist (project roots)
       (puthash project t known))
     (dolist (subdir dirs)
       (when-let (((file-directory-p subdir))
-- 
2.39.3


--=-=-=--




Acknowledgement sent to Spencer Baugh <sbaugh@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#67310; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sat, 20 Jan 2024 12:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.