From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: Dmitry Gutov <dmitry@gutov.dev>
Newsgroups: gmane.emacs.bugs
Subject: bug#67310: [PATCH] Include the project--list as history when
 prompting for a project
Date: Sun, 10 Dec 2023 05:04:27 +0200
Message-ID: <dfbd2b3e-a14b-b5b4-a7c0-aa837ea6220c@gutov.dev>
References: <ier8r6s42on.fsf@janestreet.com>
 <dc5ad8f4-b857-ea87-d178-bae903cee517@gutov.dev>
 <421e3ea8-d150-566e-f645-cbf1ccbcba61@gutov.dev>
 <ier34wz3zkx.fsf@janestreet.com>
 <81b6ed58-3fdc-3b5a-41a9-84d66475d5f1@gutov.dev>
 <ierr0khlq19.fsf@janestreet.com>
 <5c3eb6a1-38da-8af4-419a-e0567b163e3a@gutov.dev>
 <iercyw1l6rz.fsf@janestreet.com>
 <dc3b5328-8719-8948-e617-e3e8cf13f274@gutov.dev>
 <ier8r6nkv58.fsf@janestreet.com> <8634wr6s1t.fsf@mail.linkov.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
	logging-data="33001"; mail-complaints-to="usenet@ciao.gmane.io"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.13.0
Cc: 67310@debbugs.gnu.org, eliz@gnu.org
To: Juri Linkov <juri@linkov.net>, Spencer Baugh <sbaugh@janestreet.com>
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 10 04:05:08 2023
Return-path: <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>
Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org
Original-Received: from lists.gnu.org ([209.51.188.17])
	by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
	(Exim 4.92)
	(envelope-from <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>)
	id 1rCA7u-0008H4-UU
	for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 10 Dec 2023 04:05:07 +0100
Original-Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <bug-gnu-emacs-bounces@gnu.org>)
	id 1rCA7e-0005nK-Eq; Sat, 09 Dec 2023 22:04:50 -0500
Original-Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1rCA7c-0005mq-O6
 for bug-gnu-emacs@gnu.org; Sat, 09 Dec 2023 22:04:48 -0500
Original-Received: from debbugs.gnu.org ([2001:470:142:5::43])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1rCA7c-0007vr-Fj
 for bug-gnu-emacs@gnu.org; Sat, 09 Dec 2023 22:04:48 -0500
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1rCA7p-00083o-Ta
 for bug-gnu-emacs@gnu.org; Sat, 09 Dec 2023 22:05:01 -0500
X-Loop: help-debbugs@gnu.org
Resent-From: Dmitry Gutov <dmitry@gutov.dev>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Sun, 10 Dec 2023 03:05:01 +0000
Resent-Message-ID: <handler.67310.B67310.170217749430967@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 67310
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
Original-Received: via spool by 67310-submit@debbugs.gnu.org id=B67310.170217749430967
 (code B ref 67310); Sun, 10 Dec 2023 03:05:01 +0000
Original-Received: (at 67310) by debbugs.gnu.org; 10 Dec 2023 03:04:54 +0000
Original-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@debbugs.gnu.org>)
 id 1rCA7h-00083P-H5
 for submit@debbugs.gnu.org; Sat, 09 Dec 2023 22:04:53 -0500
Original-Received: from wout4-smtp.messagingengine.com ([64.147.123.20]:34321)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dmitry@gutov.dev>) id 1rCA7e-00083A-Jc
 for 67310@debbugs.gnu.org; Sat, 09 Dec 2023 22:04:52 -0500
Original-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)
Original-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
Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat,
 9 Dec 2023 22:04:28 -0500 (EST)
Content-Language: en-US
In-Reply-To: <8634wr6s1t.fsf@mail.linkov.net>
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
X-BeenThere: bug-gnu-emacs@gnu.org
List-Id: "Bug reports for GNU Emacs,
 the Swiss army knife of text editors" <bug-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/bug-gnu-emacs>
List-Post: <mailto:bug-gnu-emacs@gnu.org>
List-Help: <mailto:bug-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=subscribe>
Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org
Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org
Xref: news.gmane.io gmane.emacs.bugs:275892
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/275892>

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.