GNU bug report logs - #63648
29.0.90; project.el: with switch-use-entire-map, switch-project errors on non-project commands

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; Reported by: Spencer Baugh <sbaugh@HIDDEN>; dated Mon, 22 May 2023 16:29:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

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


Received: (at 63648) by debbugs.gnu.org; 18 Sep 2023 11:00:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 18 07:00:23 2023
Received: from localhost ([127.0.0.1]:52190 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qiBzK-0008IH-QQ
	for submit <at> debbugs.gnu.org; Mon, 18 Sep 2023 07:00:23 -0400
Received: from wout1-smtp.messagingengine.com ([64.147.123.24]:46451)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dmitry@HIDDEN>) id 1qiBzI-0008Hz-ER
 for 63648 <at> debbugs.gnu.org; Mon, 18 Sep 2023 07:00:21 -0400
Received: from compute5.internal (compute5.nyi.internal [10.202.2.45])
 by mailout.west.internal (Postfix) with ESMTP id 46BC13200922;
 Mon, 18 Sep 2023 07:00:06 -0400 (EDT)
Received: from mailfrontend2 ([10.202.2.163])
 by compute5.internal (MEProxy); Mon, 18 Sep 2023 07:00:06 -0400
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=
 1695034805; x=1695121205; bh=b2tYBfic7sKKDZZv5KMBZkD3Rbqv+Odgkhc
 UgshrLug=; b=koCwf9JnxuNT8NViOlQHFzZ4ysPrvQp+4Pbvhif1lXI07eko78b
 aGkpxOblIW71W87Bsum/l7ef0Ec/4oebVVJCHQE3ta7yZ06RuE8s91WZAPGar22R
 EXDc7+44nUC52rK2lZPcPHJksxbJGi7lWD3sx/61qC6QmZSPFhIeZRvXSn6RiUO7
 i+fkzEuiBtvNEh8VU6G2tSx7wy4Odo6N9iE35e2p2qYKeiv5oxIrQ6DH3RvkJRoO
 8C7Psg/A0s2si6CaKkTMtAQqPgMsI+V8ZvdxxPiDiUZcVYaxOs9fQ1asR5EyMC4e
 0k4se1gYiM+QlXxR90FAlMtJbU5bNK79VCw==
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=fm2; t=
 1695034805; x=1695121205; bh=b2tYBfic7sKKDZZv5KMBZkD3Rbqv+Odgkhc
 UgshrLug=; b=c8MOziG7lyuA40mxQ4RfSz4hqkT+6uS7sKKirNQwoJFc154UeMC
 Eho18RnyhMC+Q+0uQ05ciJt49rePZTdSakadRS1F4KcojU0ZjrM7UgrPyXjJ80cM
 11tvBI75mTeVSaxb+Bc3sTciJ2xLLsMc5a1NVSkcFv2UhZdJ6I4wYnvQyMb1uFiT
 Ve11HVTmiblH3DTIRdhn/mj0Y3cy/9XBbH1el8jjGKzrbHQ0Jam+meNhPtjo/cBi
 Y1V8fgd0ZKK4Pei0Lc3Kg/aaIPKeBLWyy/mNpIcTqZPiZ5pxp6SHeBJb0xy9+0Zl
 C2HRaAf3aTvy48nKvvuWh3WKCSbA6BM23Eg==
X-ME-Sender: <xms:tS0IZWC5oYWmu13YEnAq6fjTbM0c2JBt1VvQ_s3XAP385v6M1vNXaQ>
 <xme:tS0IZQhK3p40dE3L3ZwWPtoJNwkjeZGJfChEx85TNy6XuYSMWy--Zaw8mF08-lOyv
 xJf4PKuy7tFA6Gqnws>
X-ME-Received: <xmr:tS0IZZkN6YHYb4VXZrnagWh8loqlZ8LXOVoJaIW_h6zhInZk1iOCF-CZrc8ufUA>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudejkedgfeegucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi
 thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth
 htvghrnhepiefgteevheevveffheeltdeukeeiieekueefgedugfefgefhudelgfefveel
 vdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug
 hmihhtrhihsehguhhtohhvrdguvghv
X-ME-Proxy: <xmx:tS0IZUysYS6JuDRGfja2gaEoxSaseG_c-gCqDRA91HX_47bZVhPI9Q>
 <xmx:tS0IZbRotnr49AmJodqJa388gRTJyQk5WIstLaEndZSckdcbnd96rg>
 <xmx:tS0IZfbokkBawixmgmK9moI13wegUgOdCHpWqvAP8L-IBI1y4_O6Fw>
 <xmx:tS0IZWdYWsdeSF16iKLo_DFDuG2aQ3p3i_mKXxUw155SJko_Kpu2ug>
Feedback-ID: i0e71465a:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon,
 18 Sep 2023 07:00:04 -0400 (EDT)
Message-ID: <4367c45c-95b3-6a29-4ba3-068a3c748452@HIDDEN>
Date: Mon, 18 Sep 2023 14:00:03 +0300
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#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
Content-Language: en-US
To: Juri Linkov <juri@HIDDEN>
References: <ierttw472m1.fsf@HIDDEN> <86bki9y68h.fsf@HIDDEN>
 <86cz2f7bvo.fsf@HIDDEN>
 <e698de3a-dec8-424a-21ff-dcb5bd22c8d4@HIDDEN>
 <86353axu48.fsf@HIDDEN> <87o7jfi00b.fsf@HIDDEN>
 <ier7cplhnky.fsf@HIDDEN> <86msyhwrrg.fsf@HIDDEN>
 <ef5bd8eb-40f9-663d-9a13-f59f9745652e@HIDDEN>
 <86y1hs4kkg.fsf@HIDDEN>
 <c239b9eb-f12f-07e7-ded6-df93c6724c88@HIDDEN>
 <86h6of66o3.fsf@HIDDEN>
 <d2b7993b-73a8-6e66-94ae-da8f4fc42ffd@HIDDEN>
 <86wmxb2qvh.fsf@HIDDEN>
 <ab1ef1f6-3e54-3f5e-c16e-905c4d46cacd@HIDDEN>
 <8634zyjt0k.fsf@HIDDEN>
 <8d1fb7ac-5c82-0ec2-8ae2-d09c131ec165@HIDDEN>
 <86edj6hyem.fsf@HIDDEN>
 <c7ab6061-3c8b-f6ab-37cf-da641aec6d21@HIDDEN>
 <8634zitwoy.fsf@HIDDEN>
 <50d46d30-a796-b855-0d4c-690d6cb3d15b@HIDDEN>
 <86il88x9cy.fsf@HIDDEN>
From: Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <86il88x9cy.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -2.2 (--)
X-Debbugs-Envelope-To: 63648
Cc: Spencer Baugh <sbaugh@HIDDEN>, 63648 <at> debbugs.gnu.org,
 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: -3.2 (---)

On 18/09/2023 09:51, Juri Linkov wrote:
>>> 'C-x p p C-x v L' to see a vc log in another project, and
>>> 'C-x p p C-x v d' to open vc-dir, etc.
>> All right, so we also want to support non-project commands. And you wanted
>> to use a common approach for both.
>>
>> What if we handle them differently, though? For "project" commands (those
>> that internally call project-current) we can set one variable, and for the
>> rest -- alter default-directory. Then restore the previous value in
>> post-command.
>>
>> The detection of "project commands" could work like this:
>>
>> - Is it in one of the special maps? E.g. in project-prefix-map. Or maybe
>>    it's in project-switch-commands.
>> - Does the function name start with 'project-'?
>> - Finally, for user-defined commands we could also introduce a property
>>    'project-command-p', although the distinction between using
>>    project-current-directory-override vs default-directory will not be
>>    important for every such command, so maybe being this thorough is not too
>>   important.
> Sorry, I don't understand how 'C-x p p' could read the user's mind
> whether the user afterwards will type a key for a project command
> or a non-project command?  And depending on user's intention will
> either set project-current-directory-override or default-directory.

Ah, I forgot that in the general case we don't read the sequence, find 
the command and do the thing. We leave the event loop up to Emacs.

What about pre-command-hook? this-command will already be set by then.




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

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


Received: (at 63648) by debbugs.gnu.org; 18 Sep 2023 06:59:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 18 02:59:37 2023
Received: from localhost ([127.0.0.1]:51918 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qi8EL-0004e8-0k
	for submit <at> debbugs.gnu.org; Mon, 18 Sep 2023 02:59:37 -0400
Received: from relay5-d.mail.gandi.net ([217.70.183.197]:43511)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1qi8EA-0004dL-IY
 for 63648 <at> debbugs.gnu.org; Mon, 18 Sep 2023 02:59:32 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id 2BEEE1C0005;
 Mon, 18 Sep 2023 06:59:09 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Dmitry Gutov <dmitry@HIDDEN>
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
In-Reply-To: <50d46d30-a796-b855-0d4c-690d6cb3d15b@HIDDEN> (Dmitry Gutov's
 message of "Mon, 18 Sep 2023 03:12:08 +0300")
Organization: LINKOV.NET
References: <ierttw472m1.fsf@HIDDEN> <86bki9y68h.fsf@HIDDEN>
 <86cz2f7bvo.fsf@HIDDEN>
 <e698de3a-dec8-424a-21ff-dcb5bd22c8d4@HIDDEN>
 <86353axu48.fsf@HIDDEN> <87o7jfi00b.fsf@HIDDEN>
 <ier7cplhnky.fsf@HIDDEN> <86msyhwrrg.fsf@HIDDEN>
 <ef5bd8eb-40f9-663d-9a13-f59f9745652e@HIDDEN>
 <86y1hs4kkg.fsf@HIDDEN>
 <c239b9eb-f12f-07e7-ded6-df93c6724c88@HIDDEN>
 <86h6of66o3.fsf@HIDDEN>
 <d2b7993b-73a8-6e66-94ae-da8f4fc42ffd@HIDDEN>
 <86wmxb2qvh.fsf@HIDDEN>
 <ab1ef1f6-3e54-3f5e-c16e-905c4d46cacd@HIDDEN>
 <8634zyjt0k.fsf@HIDDEN>
 <8d1fb7ac-5c82-0ec2-8ae2-d09c131ec165@HIDDEN>
 <86edj6hyem.fsf@HIDDEN>
 <c7ab6061-3c8b-f6ab-37cf-da641aec6d21@HIDDEN>
 <8634zitwoy.fsf@HIDDEN>
 <50d46d30-a796-b855-0d4c-690d6cb3d15b@HIDDEN>
Date: Mon, 18 Sep 2023 09:51:09 +0300
Message-ID: <86il88x9cy.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: 63648
Cc: Spencer Baugh <sbaugh@HIDDEN>, 63648 <at> debbugs.gnu.org,
 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 (-)

>> 'C-x p p C-x v L' to see a vc log in another project, and
>> 'C-x p p C-x v d' to open vc-dir, etc.
>
> All right, so we also want to support non-project commands. And you wanted
> to use a common approach for both.
>
> What if we handle them differently, though? For "project" commands (those
> that internally call project-current) we can set one variable, and for the
> rest -- alter default-directory. Then restore the previous value in
> post-command.
>
> The detection of "project commands" could work like this:
>
> - Is it in one of the special maps? E.g. in project-prefix-map. Or maybe
>   it's in project-switch-commands.
> - Does the function name start with 'project-'?
> - Finally, for user-defined commands we could also introduce a property
>   'project-command-p', although the distinction between using
>   project-current-directory-override vs default-directory will not be
>   important for every such command, so maybe being this thorough is not too
>  important.

Sorry, I don't understand how 'C-x p p' could read the user's mind
whether the user afterwards will type a key for a project command
or a non-project command?  And depending on user's intention will
either set project-current-directory-override or default-directory.




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

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


Received: (at 63648) by debbugs.gnu.org; 18 Sep 2023 00:12:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 17 20:12:31 2023
Received: from localhost ([127.0.0.1]:51638 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qi1sN-0000zA-Df
	for submit <at> debbugs.gnu.org; Sun, 17 Sep 2023 20:12:31 -0400
Received: from wout5-smtp.messagingengine.com ([64.147.123.21]:56911)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dmitry@HIDDEN>) id 1qi1sK-0000yu-JZ
 for 63648 <at> debbugs.gnu.org; Sun, 17 Sep 2023 20:12:30 -0400
Received: from compute3.internal (compute3.nyi.internal [10.202.2.43])
 by mailout.west.internal (Postfix) with ESMTP id 2DBF03200583;
 Sun, 17 Sep 2023 20:12:13 -0400 (EDT)
Received: from mailfrontend2 ([10.202.2.163])
 by compute3.internal (MEProxy); Sun, 17 Sep 2023 20:12:13 -0400
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=
 1694995932; x=1695082332; bh=c9g5SzpkQiuBToOYLBMvNb4q3Td9qUYVC1V
 3EWVZRwY=; b=lYnwdGLXva49IqglFWSXvuuKhKLQ8bl1tyW5BHqReorCdPbSJ6T
 cu0llghfdFjFiTKDfLjz8eaPpiqh47RWIyF7EZR9Nub8Bj2wFAVTqvNLmJ4aa8Vt
 SNr84B0DzNeplR8Vpe3dGZl1ztTFVhQ3SFtkZbPQXjU+aqtzz/F7vA+BqFEPB2PS
 HL0GkMVcPlrdLVVYQDR3dC9CSyCkWsMgN30R+3zBhtuvBWbfLH/ylglclKD6RVou
 0S4aAVzEnhAzj9hBrNXIQ4dHGTq3N9GeUupfUd12IHtFt4k2ukmonVAF+oTLyxZO
 isBKQeut8TAdskoAkL3Sl2ymcgNsS7kQPAQ==
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=fm2; t=
 1694995932; x=1695082332; bh=c9g5SzpkQiuBToOYLBMvNb4q3Td9qUYVC1V
 3EWVZRwY=; b=PbHNfLJHoY8Z7RsesFy/JIfDO0/eHZZD+k0/4GYv8SGfcVHPom2
 7Q4qLDu0hv7sJPHpTv1iF/1rvq0ofYreCZXHlfygzYVuUiQ3sF7fWrcF6suWyhD3
 A2FD/tpxPQ28jQK8RFYda8lDPPevRUlkg6gNQxI4y5uJgFG2NvwkpZWxuEpv0Fk3
 gJP5ejWBwcXxxn/wqCUCRX5YgXOI3d9f4O7OaNmiFmOgX7YE4FWHhHq+JAKZQGpW
 /5Z2JgGKBUG/s5Cv7xr7+3i2QARVvJBpgbUtv558ObivqK8uHUuCe4I/n5XFGxyE
 Nx7SsGtd8sC9jjPvNByl5zfEVHGmPae61DQ==
X-ME-Sender: <xms:3JUHZTnl2rwayPqiZASyAHkDhG8kMJS59t-Ne2NAYSDAdn9MX1eNnw>
 <xme:3JUHZW3rphkVEJ1TmtHQp6Ku2xhCVaJrC5XLMlnaCCYB28NU7ub_ZmUa97eWKV6eU
 zIwYOGvqFpKbpe_2w8>
X-ME-Received: <xmr:3JUHZZqDcmkK3z9uVzZiGCFjKdVw3BmRPRbyr6j8JF4wOECexP9bXcm40eSl3Vg>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudejjedgfedvucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi
 thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth
 htvghrnhepiefgteevheevveffheeltdeukeeiieekueefgedugfefgefhudelgfefveel
 vdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug
 hmihhtrhihsehguhhtohhvrdguvghv
X-ME-Proxy: <xmx:3JUHZbnQ2eqmjkhVfJtoUrO9Drtuusn4MpYtKQon2tfpZXFDyir12w>
 <xmx:3JUHZR3ZE8URnrlAAujBuw0Eo9PjD_OoCjYraFFIJn_JoaGp07GAIw>
 <xmx:3JUHZasbJowB793jOfvu8q4hCrLBov2dzcin8lHAXnW5TIXKTw3Igg>
 <xmx:3JUHZfAMZNwlPzQMlNJaSehZXC42FUmbwW-4zwbPCvrIUri-A8Y_ew>
Feedback-ID: i0e71465a:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun,
 17 Sep 2023 20:12:11 -0400 (EDT)
Message-ID: <50d46d30-a796-b855-0d4c-690d6cb3d15b@HIDDEN>
Date: Mon, 18 Sep 2023 03:12:08 +0300
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#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
Content-Language: en-US
To: Juri Linkov <juri@HIDDEN>
References: <ierttw472m1.fsf@HIDDEN> <86o7m91z22.fsf@HIDDEN>
 <86pm6py6k4.fsf@HIDDEN> <86bki9y68h.fsf@HIDDEN>
 <86cz2f7bvo.fsf@HIDDEN>
 <e698de3a-dec8-424a-21ff-dcb5bd22c8d4@HIDDEN>
 <86353axu48.fsf@HIDDEN> <87o7jfi00b.fsf@HIDDEN>
 <ier7cplhnky.fsf@HIDDEN> <86msyhwrrg.fsf@HIDDEN>
 <ef5bd8eb-40f9-663d-9a13-f59f9745652e@HIDDEN>
 <86y1hs4kkg.fsf@HIDDEN>
 <c239b9eb-f12f-07e7-ded6-df93c6724c88@HIDDEN>
 <86h6of66o3.fsf@HIDDEN>
 <d2b7993b-73a8-6e66-94ae-da8f4fc42ffd@HIDDEN>
 <86wmxb2qvh.fsf@HIDDEN>
 <ab1ef1f6-3e54-3f5e-c16e-905c4d46cacd@HIDDEN>
 <8634zyjt0k.fsf@HIDDEN>
 <8d1fb7ac-5c82-0ec2-8ae2-d09c131ec165@HIDDEN>
 <86edj6hyem.fsf@HIDDEN>
 <c7ab6061-3c8b-f6ab-37cf-da641aec6d21@HIDDEN>
 <8634zitwoy.fsf@HIDDEN>
From: Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <8634zitwoy.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -2.2 (--)
X-Debbugs-Envelope-To: 63648
Cc: Spencer Baugh <sbaugh@HIDDEN>, 63648 <at> debbugs.gnu.org,
 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: -3.2 (---)

Sorry about the wait.

On 13/09/2023 09:47, Juri Linkov wrote:
>>> So here is a complete tested patch that maintains backward-compatibility
>>> with older versions, and is localized to project.el without the need to
>>> discuss more fundamental changes on emacs-devel, and handles 100% of
>>> known cases such as reported in bug#58784, bug#63829, etc.
>> It sounds like a possibly concise solution, but I'm still wrapping my head
>> around it.
>>
>>> +(make-obsolete-variable
>>> + 'project-current-directory-override
>>> + 'project-current-directory-old
>>> + "30.1")
>> Aren't those variables sufficiently different that making one an alias for
>> another would confuse things?
> Indeed, during development I mistakenly made one an alias for another
> with 'define-obsolete-variable-alias', and this broke both variables.
> So I replaced it with 'make-obsolete-variable' that doesn't make an alias.
> It just designates it as obsolete to show the intention to remove it
> in later versions.

I suppose that would make us liable to support it for a version or two?

>>> +      (setq-local project-current-directory-old default-directory)
>>> +      (setq-local default-directory dir)
>> Could you explain: if we can just set these here and then clean up in
>> postfun, couldn't we likewise set (and then later clean up) the value of
>> project-current-directory-override?
> We need to set 'default-directory' to support non-project commands.
> I already started to use this feature, and it becomes indispensable.
> For example, the most often used commands are vc commands such as
> 'C-x p p C-x v L' to see a vc log in another project, and
> 'C-x p p C-x v d' to open vc-dir, etc.

All right, so we also want to support non-project commands. And you 
wanted to use a common approach for both.

What if we handle them differently, though? For "project" commands 
(those that internally call project-current) we can set one variable, 
and for the rest -- alter default-directory. Then restore the previous 
value in post-command.

The detection of "project commands" could work like this:

- Is it in one of the special maps? E.g. in project-prefix-map. Or maybe 
it's in project-switch-commands.
- Does the function name start with 'project-'?
- Finally, for user-defined commands we could also introduce a property 
'project-command-p', although the distinction between using 
project-current-directory-override vs default-directory will not be 
important for every such command, so maybe being this thorough is not 
too important.




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

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


Received: (at 63648) by debbugs.gnu.org; 13 Sep 2023 06:56:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 13 02:56:13 2023
Received: from localhost ([127.0.0.1]:60578 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qgJnI-00011a-MQ
	for submit <at> debbugs.gnu.org; Wed, 13 Sep 2023 02:56:13 -0400
Received: from relay5-d.mail.gandi.net ([2001:4b98:dc4:8::225]:44915)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1qgJnC-00010y-8Z
 for 63648 <at> debbugs.gnu.org; Wed, 13 Sep 2023 02:56:11 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id 7AE861C0009;
 Wed, 13 Sep 2023 06:55:51 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Dmitry Gutov <dmitry@HIDDEN>
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
In-Reply-To: <c7ab6061-3c8b-f6ab-37cf-da641aec6d21@HIDDEN> (Dmitry Gutov's
 message of "Wed, 13 Sep 2023 02:47:49 +0300")
Organization: LINKOV.NET
References: <ierttw472m1.fsf@HIDDEN> <86o7m91z22.fsf@HIDDEN>
 <86pm6py6k4.fsf@HIDDEN> <86bki9y68h.fsf@HIDDEN>
 <86cz2f7bvo.fsf@HIDDEN>
 <e698de3a-dec8-424a-21ff-dcb5bd22c8d4@HIDDEN>
 <86353axu48.fsf@HIDDEN> <87o7jfi00b.fsf@HIDDEN>
 <ier7cplhnky.fsf@HIDDEN> <86msyhwrrg.fsf@HIDDEN>
 <ef5bd8eb-40f9-663d-9a13-f59f9745652e@HIDDEN>
 <86y1hs4kkg.fsf@HIDDEN>
 <c239b9eb-f12f-07e7-ded6-df93c6724c88@HIDDEN>
 <86h6of66o3.fsf@HIDDEN>
 <d2b7993b-73a8-6e66-94ae-da8f4fc42ffd@HIDDEN>
 <86wmxb2qvh.fsf@HIDDEN>
 <ab1ef1f6-3e54-3f5e-c16e-905c4d46cacd@HIDDEN>
 <8634zyjt0k.fsf@HIDDEN>
 <8d1fb7ac-5c82-0ec2-8ae2-d09c131ec165@HIDDEN>
 <86edj6hyem.fsf@HIDDEN>
 <c7ab6061-3c8b-f6ab-37cf-da641aec6d21@HIDDEN>
Date: Wed, 13 Sep 2023 09:47:09 +0300
Message-ID: <8634zitwoy.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: 63648
Cc: Spencer Baugh <sbaugh@HIDDEN>, 63648 <at> debbugs.gnu.org,
 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 (-)

>> So here is a complete tested patch that maintains backward-compatibility
>> with older versions, and is localized to project.el without the need to
>> discuss more fundamental changes on emacs-devel, and handles 100% of
>> known cases such as reported in bug#58784, bug#63829, etc.
>
> It sounds like a possibly concise solution, but I'm still wrapping my head
> around it.
>
>> +(make-obsolete-variable
>> + 'project-current-directory-override
>> + 'project-current-directory-old
>> + "30.1")
>
> Aren't those variables sufficiently different that making one an alias for
> another would confuse things?

Indeed, during development I mistakenly made one an alias for another
with 'define-obsolete-variable-alias', and this broke both variables.
So I replaced it with 'make-obsolete-variable' that doesn't make an alias.
It just designates it as obsolete to show the intention to remove it
in later versions.

>> +(defvar-local project-current-directory-old nil
>> +  "Value to use instead of `default-directory' when detecting the project.
>> +For the next command after switching the project, this buffer-local
>> +variable contains the original value of `default-directory'.
>> +Whereas the buffer-local `default-directory' is temporarily set
>> +to the root directory of the switched project.
>> +When it is non-nil, `project-current' will always skip prompting too.")
>
> The docstring is valuable, but I wonder how it looks to somebody from the
> outside trying to write code that would use it.

I don't believe that someone might want to use this variable in more commands
than the current project commands that rely on 'project-buffers'.  But we could
add a few more lines with explanations for them too.

>> +                   (or (buffer-local-value 'project-current-directory-old buf)
>> +                       (buffer-local-value 'default-directory buf))))
> ...
>> +                (or (buffer-local-value 'project-current-directory-old buf)
>> +                    (buffer-local-value 'default-directory buf))))
>
> So, this part looks like what we would be paying for this solution: any
> code looking to decide whether a buffer "belongs" to the project, would
> have to reproduce this exact expression. Wouldn't it?

Then maybe this code should be moved to a separate function?

>> +      (setq-local project-current-directory-old default-directory)
>> +      (setq-local default-directory dir)
>
> Could you explain: if we can just set these here and then clean up in
> postfun, couldn't we likewise set (and then later clean up) the value of
> project-current-directory-override?

We need to set 'default-directory' to support non-project commands.
I already started to use this feature, and it becomes indispensable.
For example, the most often used commands are vc commands such as
'C-x p p C-x v L' to see a vc log in another project, and
'C-x p p C-x v d' to open vc-dir, etc.

>> -		     (eq this-command command))
>> +		     (eq this-command command)
>> +		     (eq this-command 'other-project-prefix))
>
> Did this part of the patch get in by accident? If it's "localized to
> project.el". Or do we have further plans to "generalize" that place
> somehow? Just making sure.

This part is optional and could be generalized later.




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

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


Received: (at 63648) by debbugs.gnu.org; 12 Sep 2023 23:48:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 12 19:48:07 2023
Received: from localhost ([127.0.0.1]:60308 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qgD71-0001Ys-4s
	for submit <at> debbugs.gnu.org; Tue, 12 Sep 2023 19:48:07 -0400
Received: from out3-smtp.messagingengine.com ([66.111.4.27]:46927)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dmitry@HIDDEN>) id 1qgD6y-0001Xj-3K
 for 63648 <at> debbugs.gnu.org; Tue, 12 Sep 2023 19:48:05 -0400
Received: from compute6.internal (compute6.nyi.internal [10.202.2.47])
 by mailout.nyi.internal (Postfix) with ESMTP id 99F535C01BA;
 Tue, 12 Sep 2023 19:47:53 -0400 (EDT)
Received: from mailfrontend2 ([10.202.2.163])
 by compute6.internal (MEProxy); Tue, 12 Sep 2023 19:47:53 -0400
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=
 1694562473; x=1694648873; bh=XeNsYfG9WKCynHuOxiL5exiO2OCqL3JeO4u
 6PYZDsEY=; b=oVhNUC8sFOwZlROjH3bTn4Mxy4AjF/B+T/OxGZhUL7pL8+Rk1/F
 Lc0KcaVhF2qdQuEC1rEqF2qtQxrPM7Ny8tJZ72VqaVeRp97LjQsqjGUzBDm26oS5
 mFOABDmWPVhA9ttQ5uCw0qn4C1HNIFmCyFTODVs+3QVTRYUMgs7KY4tWA88d+bVf
 mAX0XLQZ+4eVgkNbtKoBvM85h2rO53RzF9qkQGoSquBn0BTA/4ZV107I6IttnjVs
 vTRB/xoz6mKGkz2DFtC9xTRLz1F5dMNPkSxZvDBl5yUhVdeGm0AqXSR7XRi2n7SJ
 YBndL7utTVJk+DB/ifQZKkTEfvtI5g9Jemg==
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=
 1694562473; x=1694648873; bh=XeNsYfG9WKCynHuOxiL5exiO2OCqL3JeO4u
 6PYZDsEY=; b=bMs5FSfQloOOpKRmpu9LtY6UF2/FhZwtasvL4dW7EQSEQw0H1zl
 PjfyXMurPAOs9LiW1Q3Sw8ehk+llROKHZa/crQPr07mmlC6aAAVMTkuJyTWrrR7H
 smVtPgE2gApwk4wOFFBW5BimE1qEme0eeZ5VwDbP9hQAzM9Xz6OvffpzS7QitTXV
 06QT32G/UFM0JrqVVWB3/3XcOb3At8DcLfdhwA08wxvjIFdkfU6w866lkbQhSf0r
 OyA2lkSR7RSp/9LKyV6lXxd2UhMwRE/X5G9Ugo8+K5OhBxn8YajkJu2a0FDYwXVq
 QtvoLGMqXEusBaxpdGSjFnBzHopJ3KpVajA==
X-ME-Sender: <xms:qPgAZfQcCkV_1U3WCtiIEyDky2FxkDP4IVY5eU8TGRWnreH50q5B2w>
 <xme:qPgAZQyoNwxzfHfVMKZotXibjZZQJCLx5paVmCr2iMEIuE6wvsWtUda-7tYq8vc2t
 ShHO3lQLOUH0msnrCI>
X-ME-Received: <xmr:qPgAZU2tHX9hOb-5MxwRyeU_QQNOzGez_-Gau2cB86gZFlSus_DpYVy_BgSZbIo>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudeijedgvdejucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi
 thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth
 htvghrnhepiefgteevheevveffheeltdeukeeiieekueefgedugfefgefhudelgfefveel
 vdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug
 hmihhtrhihsehguhhtohhvrdguvghv
X-ME-Proxy: <xmx:qPgAZfBjNZfFnZll67EYYQdUokuyCUiiYROsGxWjN47sxAQVw7EEIg>
 <xmx:qPgAZYjxCNdpX0BBeolY56NM5f8j0asbAEHuY-EYK3leldfV5zOSTg>
 <xmx:qPgAZTqjFbLc9IQlK0AvCEc4UkthurdV3-MHQ2mR3-f60KE8BVH-sQ>
 <xmx:qfgAZbunnWNOoQV0Sga8SZDLNb2XtXjqc_zaaMT7sUUzraA_BLqCfw>
Feedback-ID: i0e71465a:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue,
 12 Sep 2023 19:47:51 -0400 (EDT)
Message-ID: <c7ab6061-3c8b-f6ab-37cf-da641aec6d21@HIDDEN>
Date: Wed, 13 Sep 2023 02:47:49 +0300
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#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
Content-Language: en-US
To: Juri Linkov <juri@HIDDEN>
References: <ierttw472m1.fsf@HIDDEN> <86jzwyxnxb.fsf@HIDDEN>
 <feead847-869a-86a8-d62d-065871024a74@HIDDEN>
 <86o7m91z22.fsf@HIDDEN> <86pm6py6k4.fsf@HIDDEN>
 <86bki9y68h.fsf@HIDDEN> <86cz2f7bvo.fsf@HIDDEN>
 <e698de3a-dec8-424a-21ff-dcb5bd22c8d4@HIDDEN>
 <86353axu48.fsf@HIDDEN> <87o7jfi00b.fsf@HIDDEN>
 <ier7cplhnky.fsf@HIDDEN> <86msyhwrrg.fsf@HIDDEN>
 <ef5bd8eb-40f9-663d-9a13-f59f9745652e@HIDDEN>
 <86y1hs4kkg.fsf@HIDDEN>
 <c239b9eb-f12f-07e7-ded6-df93c6724c88@HIDDEN>
 <86h6of66o3.fsf@HIDDEN>
 <d2b7993b-73a8-6e66-94ae-da8f4fc42ffd@HIDDEN>
 <86wmxb2qvh.fsf@HIDDEN>
 <ab1ef1f6-3e54-3f5e-c16e-905c4d46cacd@HIDDEN>
 <8634zyjt0k.fsf@HIDDEN>
 <8d1fb7ac-5c82-0ec2-8ae2-d09c131ec165@HIDDEN>
 <86edj6hyem.fsf@HIDDEN>
From: Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <86edj6hyem.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -2.2 (--)
X-Debbugs-Envelope-To: 63648
Cc: Spencer Baugh <sbaugh@HIDDEN>, 63648 <at> debbugs.gnu.org,
 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: -3.2 (---)

Hi Juri,

On 10/09/2023 18:30, Juri Linkov wrote:
> So here is a complete tested patch that maintains backward-compatibility
> with older versions, and is localized to project.el without the need to
> discuss more fundamental changes on emacs-devel, and handles 100% of
> known cases such as reported in bug#58784, bug#63829, etc.

It sounds like a possibly concise solution, but I'm still wrapping my 
head around it.

> +(make-obsolete-variable
> + 'project-current-directory-override
> + 'project-current-directory-old
> + "30.1")

Aren't those variables sufficiently different that making one an alias 
for another would confuse things?

> +(defvar-local project-current-directory-old nil
> +  "Value to use instead of `default-directory' when detecting the project.
> +For the next command after switching the project, this buffer-local
> +variable contains the original value of `default-directory'.
> +Whereas the buffer-local `default-directory' is temporarily set
> +to the root directory of the switched project.
> +When it is non-nil, `project-current' will always skip prompting too.")

The docstring is valuable, but I wonder how it looks to somebody from 
the outside trying to write code that would use it.

> +                   (or (buffer-local-value 'project-current-directory-old buf)
> +                       (buffer-local-value 'default-directory buf))))
...
> +                (or (buffer-local-value 'project-current-directory-old buf)
> +                    (buffer-local-value 'default-directory buf))))

So, this part looks like what we would be paying for this solution: any 
code looking to decide whether a buffer "belongs" to the project, would 
have to reproduce this exact expression. Wouldn't it?

> +      (setq-local project-current-directory-old default-directory)
> +      (setq-local default-directory dir)

Could you explain: if we can just set these here and then clean up in 
postfun, couldn't we likewise set (and then later clean up) the value of 
project-current-directory-override?

> -		     (eq this-command command))
> +		     (eq this-command command)
> +		     (eq this-command 'other-project-prefix))

Did this part of the patch get in by accident? If it's "localized to 
project.el". Or do we have further plans to "generalize" that place 
somehow? Just making sure.




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

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


Received: (at 63648) by debbugs.gnu.org; 12 Sep 2023 07:34:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 12 03:34:01 2023
Received: from localhost ([127.0.0.1]:55977 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qfxuK-0006b5-SN
	for submit <at> debbugs.gnu.org; Tue, 12 Sep 2023 03:34:01 -0400
Received: from relay6-d.mail.gandi.net ([2001:4b98:dc4:8::226]:60945)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1qfxuI-0006aq-Dz
 for 63648 <at> debbugs.gnu.org; Tue, 12 Sep 2023 03:33:59 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id E0A9AC0053;
 Tue, 12 Sep 2023 07:32:00 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Spencer Baugh <sbaugh@HIDDEN>
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
In-Reply-To: <ier4jk0bh4i.fsf@HIDDEN> (Spencer Baugh's message of
 "Mon, 11 Sep 2023 16:16:13 -0400")
Organization: LINKOV.NET
References: <ierttw472m1.fsf@HIDDEN> <86pm6py6k4.fsf@HIDDEN>
 <86bki9y68h.fsf@HIDDEN> <86cz2f7bvo.fsf@HIDDEN>
 <e698de3a-dec8-424a-21ff-dcb5bd22c8d4@HIDDEN>
 <86353axu48.fsf@HIDDEN> <87o7jfi00b.fsf@HIDDEN>
 <ier7cplhnky.fsf@HIDDEN> <86msyhwrrg.fsf@HIDDEN>
 <ef5bd8eb-40f9-663d-9a13-f59f9745652e@HIDDEN>
 <86y1hs4kkg.fsf@HIDDEN>
 <c239b9eb-f12f-07e7-ded6-df93c6724c88@HIDDEN>
 <86h6of66o3.fsf@HIDDEN>
 <d2b7993b-73a8-6e66-94ae-da8f4fc42ffd@HIDDEN>
 <86wmxb2qvh.fsf@HIDDEN>
 <ab1ef1f6-3e54-3f5e-c16e-905c4d46cacd@HIDDEN>
 <8634zyjt0k.fsf@HIDDEN>
 <8d1fb7ac-5c82-0ec2-8ae2-d09c131ec165@HIDDEN>
 <ierv8ctubo2.fsf@HIDDEN> <86il8r4g96.fsf@HIDDEN>
 <ier4jk0bh4i.fsf@HIDDEN>
Date: Tue, 12 Sep 2023 09:55:25 +0300
Message-ID: <861qf3ontm.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: 63648
Cc: Dmitry Gutov <dmitry@HIDDEN>, 63648 <at> debbugs.gnu.org, 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 (-)

>> 1. wants to print the new value of default-directory
>>    because 'C-h v' is the next command for which
>>    the value of default-directory was explicitly set.
>>
>> 2. wants to print the original value of default-directory
>>    because 'C-h v' was invoked in the buffer where
>>    the value of default-directory should stay unchanged.
>
> I would argue that it's in class 1.  Or at least, it would make sense
> for C-h v to print the new value.

I agree.  And the latest patch does this.  It prints the new value
on 'C-x p p ... C-h v'.  Then you can type 'g' and it reverts to
the original value.




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

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


Received: (at 63648) by debbugs.gnu.org; 11 Sep 2023 20:16:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 11 16:16:28 2023
Received: from localhost ([127.0.0.1]:54920 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qfnKe-0003rw-5L
	for submit <at> debbugs.gnu.org; Mon, 11 Sep 2023 16:16:28 -0400
Received: from mxout5.mail.janestreet.com ([64.215.233.18]:55191)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <sbaugh@HIDDEN>) id 1qfnKa-0003rh-Ue
 for 63648 <at> debbugs.gnu.org; Mon, 11 Sep 2023 16:16:27 -0400
From: Spencer Baugh <sbaugh@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
In-Reply-To: <86il8r4g96.fsf@HIDDEN> (Juri Linkov's message of "Sun, 
 03 Sep 2023 20:11:57 +0300")
References: <ierttw472m1.fsf@HIDDEN> <86o7m91z22.fsf@HIDDEN>
 <86pm6py6k4.fsf@HIDDEN> <86bki9y68h.fsf@HIDDEN>
 <86cz2f7bvo.fsf@HIDDEN>
 <e698de3a-dec8-424a-21ff-dcb5bd22c8d4@HIDDEN>
 <86353axu48.fsf@HIDDEN> <87o7jfi00b.fsf@HIDDEN>
 <ier7cplhnky.fsf@HIDDEN> <86msyhwrrg.fsf@HIDDEN>
 <ef5bd8eb-40f9-663d-9a13-f59f9745652e@HIDDEN>
 <86y1hs4kkg.fsf@HIDDEN>
 <c239b9eb-f12f-07e7-ded6-df93c6724c88@HIDDEN>
 <86h6of66o3.fsf@HIDDEN>
 <d2b7993b-73a8-6e66-94ae-da8f4fc42ffd@HIDDEN>
 <86wmxb2qvh.fsf@HIDDEN>
 <ab1ef1f6-3e54-3f5e-c16e-905c4d46cacd@HIDDEN>
 <8634zyjt0k.fsf@HIDDEN>
 <8d1fb7ac-5c82-0ec2-8ae2-d09c131ec165@HIDDEN>
 <ierv8ctubo2.fsf@HIDDEN> <86il8r4g96.fsf@HIDDEN>
Date: Mon, 11 Sep 2023 16:16:13 -0400
Message-ID: <ier4jk0bh4i.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 63648
Cc: Dmitry Gutov <dmitry@HIDDEN>, 63648 <at> debbugs.gnu.org, 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.0 (-)

Juri Linkov <juri@HIDDEN> writes:

>> Thinking about it, I guess there's (roughly) two classes of commands
>> which want different things from default-directory, classes 1 and 2:
>>
>> 1. wants whatever the current value of default-directory is (and gets
>> this by just using default-directory as a variable)
>>
>> 2. wants the value of default-directory for some specific buffer X (and
>> gets this either with buffer-local-value or by using
>> with-current-buffer)
>>
>> If we could change 1 without changing 2, then we'd be happy.
>
> I think we can't solve this logical paradox because it contains
> self-contradictory requirements.  Here is the command that
> illustrates this paradox.  What should this command print?
>
>   C-x p p ... C-h v default-directory RET
>
> Like Schr=C3=B6dinger's cat, it belongs simultaneously to both classes:
>
> 1. wants to print the new value of default-directory
>    because 'C-h v' is the next command for which
>    the value of default-directory was explicitly set.
>
> 2. wants to print the original value of default-directory
>    because 'C-h v' was invoked in the buffer where
>    the value of default-directory should stay unchanged.

I would argue that it's in class 1.  Or at least, it would make sense
for C-h v to print the new value.




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

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


Received: (at 63648) by debbugs.gnu.org; 10 Sep 2023 15:33:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 10 11:33:06 2023
Received: from localhost ([127.0.0.1]:51102 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qfMQr-0007Fk-HJ
	for submit <at> debbugs.gnu.org; Sun, 10 Sep 2023 11:33:06 -0400
Received: from relay4-d.mail.gandi.net ([217.70.183.196]:44853)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1qfMQp-0007FE-0l
 for 63648 <at> debbugs.gnu.org; Sun, 10 Sep 2023 11:33:04 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id 8A3ABE0005;
 Sun, 10 Sep 2023 15:32:50 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Dmitry Gutov <dmitry@HIDDEN>
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
In-Reply-To: <8d1fb7ac-5c82-0ec2-8ae2-d09c131ec165@HIDDEN> (Dmitry Gutov's
 message of "Fri, 1 Sep 2023 12:53:02 +0300")
Organization: LINKOV.NET
References: <ierttw472m1.fsf@HIDDEN> <86jzwyxnxb.fsf@HIDDEN>
 <feead847-869a-86a8-d62d-065871024a74@HIDDEN>
 <86o7m91z22.fsf@HIDDEN> <86pm6py6k4.fsf@HIDDEN>
 <86bki9y68h.fsf@HIDDEN> <86cz2f7bvo.fsf@HIDDEN>
 <e698de3a-dec8-424a-21ff-dcb5bd22c8d4@HIDDEN>
 <86353axu48.fsf@HIDDEN> <87o7jfi00b.fsf@HIDDEN>
 <ier7cplhnky.fsf@HIDDEN> <86msyhwrrg.fsf@HIDDEN>
 <ef5bd8eb-40f9-663d-9a13-f59f9745652e@HIDDEN>
 <86y1hs4kkg.fsf@HIDDEN>
 <c239b9eb-f12f-07e7-ded6-df93c6724c88@HIDDEN>
 <86h6of66o3.fsf@HIDDEN>
 <d2b7993b-73a8-6e66-94ae-da8f4fc42ffd@HIDDEN>
 <86wmxb2qvh.fsf@HIDDEN>
 <ab1ef1f6-3e54-3f5e-c16e-905c4d46cacd@HIDDEN>
 <8634zyjt0k.fsf@HIDDEN>
 <8d1fb7ac-5c82-0ec2-8ae2-d09c131ec165@HIDDEN>
Date: Sun, 10 Sep 2023 18:30:09 +0300
Message-ID: <86edj6hyem.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: multipart/mixed; boundary="=-=-="
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 63648
Cc: Spencer Baugh <sbaugh@HIDDEN>, 63648 <at> debbugs.gnu.org,
 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 (-)

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

>>>> This could be fixed by adding special-handling of the default-directory
>>>> for the current buffer in 'project-buffers'.
>>> What kind of special handling? The "real" buffer-local value is hidden
>>> until the "let" exists, the global value is nil, and if the buffer is not
>>> a file-visiting one, there is no other file name to test against.
>> Additional buffer-local variable like 'buffer-default-directory' could help.
>> Or additional global variable 'global-default-directory'.  Or even
>> using the global value of the existing variable 'default-directory'.
>
> What code would use it instead of the local value of default-directory?
> Only project-related code? Or other code as well? If it's the former, we
> have an existing variable in the project package. If the latter, we'd need
> some formal description of those usage rules to proceed.

The former.  So given all the considered constraints we have to admit
there is a possibility that some rare non-project command that checks
default-directory in all buffers might get a wrong value for one buffer
when it's called immediately after 'C-x p p'.

OTOH, such a reasonable compromise can help us fix other bugs
such as bug#65558.

So here is a complete tested patch that maintains backward-compatibility
with older versions, and is localized to project.el without the need to
discuss more fundamental changes on emacs-devel, and handles 100% of
known cases such as reported in bug#58784, bug#63829, etc.


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline; filename=other-project-prefix.patch

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 2e6ae89a443..257c0da4264 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -197,6 +197,19 @@ project-current-directory-override
   "Value to use instead of `default-directory' when detecting the project.
 When it is non-nil, `project-current' will always skip prompting too.")
 
+(make-obsolete-variable
+ 'project-current-directory-override
+ 'project-current-directory-old
+ "30.1")
+
+(defvar-local project-current-directory-old nil
+  "Value to use instead of `default-directory' when detecting the project.
+For the next command after switching the project, this buffer-local
+variable contains the original value of `default-directory'.
+Whereas the buffer-local `default-directory' is temporarily set
+to the root directory of the switched project.
+When it is non-nil, `project-current' will always skip prompting too.")
+
 (defcustom project-prompter #'project-prompt-project-dir
   "Function to call to prompt for a project.
 Called with no arguments and should return a project root dir."
@@ -232,7 +245,8 @@ project-current
   (let ((pr (project--find-in-directory directory)))
     (cond
      (pr)
-     ((unless project-current-directory-override
+     ((unless (or project-current-directory-override
+                  project-current-directory-old)
         maybe-prompt)
       (setq directory (funcall project-prompter)
             pr (project--find-in-directory directory))))
@@ -397,8 +411,10 @@ project-buffers
   (let ((root (expand-file-name (file-name-as-directory (project-root project))))
         bufs)
     (dolist (buf (buffer-list))
-      (when (string-prefix-p root (expand-file-name
-                                   (buffer-local-value 'default-directory buf)))
+      (when (string-prefix-p
+             root (expand-file-name
+                   (or (buffer-local-value 'project-current-directory-old buf)
+                       (buffer-local-value 'default-directory buf))))
         (push buf bufs)))
     (nreverse bufs)))
 
@@ -813,7 +829,9 @@ project-buffers
          dd
          bufs)
     (dolist (buf (buffer-list))
-      (setq dd (expand-file-name (buffer-local-value 'default-directory buf)))
+      (setq dd (expand-file-name
+                (or (buffer-local-value 'project-current-directory-old buf)
+                    (buffer-local-value 'default-directory buf))))
       (when (and (string-prefix-p root dd)
                  (not (cl-find-if (lambda (module) (string-prefix-p module dd))
                                   modules)))
@@ -842,7 +860,9 @@ project-prefix-map
     (define-key map "c" 'project-compile)
     (define-key map "e" 'project-eshell)
     (define-key map "k" 'project-kill-buffers)
-    (define-key map "p" 'project-switch-project)
+    (define-key map "p" (if (< emacs-major-version 30)
+                            'project-switch-project
+                          'other-project-prefix))
     (define-key map "g" 'project-find-regexp)
     (define-key map "G" 'project-or-external-find-regexp)
     (define-key map "r" 'project-query-replace-regexp)
@@ -889,10 +909,16 @@ project-other-window-command
 \\{project-prefix-map}
 \\{project-other-window-map}"
   (interactive)
-  (project--other-place-command '((display-buffer-pop-up-window)
-                                  (inhibit-same-window . t))
-                                project-other-window-map))
+  (if (< emacs-major-version 30)
+      (project--other-place-command '((display-buffer-pop-up-window)
+                                      (inhibit-same-window . t))
+                                    project-other-window-map)
+    (let ((inhibit-message t)) (other-window-prefix))
+    (message "Display next project command buffer in a new window...")
+    (set-transient-map (make-composed-keymap project-prefix-map
+                                             project-other-window-map))))
 
+;; TODO: maybe rename to project-other-window-prefix
 ;;;###autoload (define-key ctl-x-4-map "p" #'project-other-window-command)
 
 ;;;###autoload
@@ -904,8 +930,13 @@ project-other-frame-command
 \\{project-prefix-map}
 \\{project-other-frame-map}"
   (interactive)
-  (project--other-place-command '((display-buffer-pop-up-frame))
-                                project-other-frame-map))
+  (if (< emacs-major-version 30)
+      (project--other-place-command '((display-buffer-pop-up-frame))
+                                    project-other-frame-map)
+    (let ((inhibit-message t)) (other-frame-prefix))
+    (message "Display next project command buffer in a new frame...")
+    (set-transient-map (make-composed-keymap project-prefix-map
+                                             project-other-frame-map))))
 
 ;;;###autoload (define-key ctl-x-5-map "p" #'project-other-frame-command)
 
@@ -917,7 +948,11 @@ project-other-tab-command
 
 \\{project-prefix-map}"
   (interactive)
-  (project--other-place-command '((display-buffer-in-new-tab))))
+  (if (< emacs-major-version 30)
+      (project--other-place-command '((display-buffer-in-new-tab)))
+    (let ((inhibit-message t)) (other-tab-prefix))
+    (message "Display next project command buffer in a new tab...")
+    (set-transient-map project-prefix-map)))
 
 ;;;###autoload
 (when (bound-and-true-p tab-prefix-map)
@@ -1000,14 +1035,16 @@ project--find-default-from
   "Ensure FILENAME is in PROJECT.
 
 Usually, just return FILENAME.  But if
-`project-current-directory-override' is set, adjust it to be
+`project-current-directory-old' is set, adjust it to be
 relative to PROJECT instead.
 
 This supports using a relative file name from the current buffer
 when switching projects with `project-switch-project' and then
 using a command like `project-find-file'."
-  (if-let (filename-proj (and project-current-directory-override
-                            (project-current nil default-directory)))
+  (if-let (filename-proj (or (and project-current-directory-override
+                                  (project-current nil default-directory))
+                             (and project-current-directory-old
+                                  (project-current nil project-current-directory-old))))
       ;; file-name-concat requires Emacs 28+
       (concat (file-name-as-directory (project-root project))
               (file-relative-name filename (project-root filename-proj)))
@@ -1993,6 +2030,50 @@ project-switch-project
     (let ((project-current-directory-override dir))
       (call-interactively command))))
 
+;;;###autoload
+(defun other-project-prefix (dir)
+  "\"Switch\" to another project before running an Emacs command.
+The available commands are presented as a dispatch menu
+made from `project-switch-commands'.
+
+When called in a program, it will use the project corresponding
+to directory DIR."
+  (interactive (list (funcall project-prompter)))
+  (if (symbolp project-switch-commands)
+      (let* ((project-current-directory-old default-directory)
+             (default-directory dir))
+        (call-interactively project-switch-commands))
+    (prefix-command-preserve-state)
+    (letrec ((minibuffer-depth (minibuffer-depth))
+             (command this-command)
+             (old-buffer (current-buffer))
+             (echofun (lambda () "[switch-project]"))
+             (postfun
+              (lambda ()
+                (unless (or (eq this-command command)
+                            (> (minibuffer-depth) minibuffer-depth))
+                  (remove-hook 'post-command-hook postfun)
+                  (remove-hook 'prefix-command-echo-keystrokes-functions
+                               echofun)
+                  (when (buffer-live-p old-buffer)
+                    (with-current-buffer old-buffer
+                      (when project-current-directory-old
+                        (setq-local default-directory project-current-directory-old)
+                        (kill-local-variable 'project-current-directory-old))))))))
+      (add-hook 'post-command-hook postfun)
+      (add-hook 'prefix-command-echo-keystrokes-functions echofun)
+      (setq-local project-current-directory-old default-directory)
+      (setq-local default-directory dir)
+      (message (project--keymap-prompt))
+      (let ((commands-map
+             (let ((temp-map (make-sparse-keymap)))
+               (set-keymap-parent temp-map project-prefix-map)
+               (dolist (row project-switch-commands temp-map)
+                 (when-let ((cmd (nth 0 row))
+                            (keychar (nth 2 row)))
+                   (define-key temp-map (vector keychar) cmd))))))
+        (set-transient-map commands-map)))))
+
 ;;;###autoload
 (defun project-uniquify-dirname-transform (dirname)
   "Uniquify name of directory DIRNAME using `project-name', if in a project.
diff --git a/lisp/window.el b/lisp/window.el
index b9b032c33e9..b67b3dced9c 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -9122,7 +9114,8 @@ display-buffer-override-next-command
 		     (> (minibuffer-depth) minibuffer-depth)
 		     ;; But don't remove immediately after
 		     ;; adding the hook by the same command below.
-		     (eq this-command command))
+		     (eq this-command command)
+		     (eq this-command 'other-project-prefix))
               (funcall exitfun))))
     ;; Call post-function after the next command finishes (bug#49057).
     (add-hook 'post-command-hook postfun)

--=-=-=--




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

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


Received: (at 63648) by debbugs.gnu.org; 3 Sep 2023 17:35:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 03 13:35:24 2023
Received: from localhost ([127.0.0.1]:46790 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qcr0O-0000vZ-0X
	for submit <at> debbugs.gnu.org; Sun, 03 Sep 2023 13:35:24 -0400
Received: from relay1-d.mail.gandi.net ([2001:4b98:dc4:8::221]:47611)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1qcr0K-0000uz-Bt
 for 63648 <at> debbugs.gnu.org; Sun, 03 Sep 2023 13:35:22 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id 28901240005;
 Sun,  3 Sep 2023 17:35:10 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Spencer Baugh <sbaugh@HIDDEN>
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
In-Reply-To: <ierv8ctubo2.fsf@HIDDEN> (Spencer Baugh's message of
 "Fri, 01 Sep 2023 11:59:41 -0400")
Organization: LINKOV.NET
References: <ierttw472m1.fsf@HIDDEN>
 <feead847-869a-86a8-d62d-065871024a74@HIDDEN>
 <86o7m91z22.fsf@HIDDEN> <86pm6py6k4.fsf@HIDDEN>
 <86bki9y68h.fsf@HIDDEN> <86cz2f7bvo.fsf@HIDDEN>
 <e698de3a-dec8-424a-21ff-dcb5bd22c8d4@HIDDEN>
 <86353axu48.fsf@HIDDEN> <87o7jfi00b.fsf@HIDDEN>
 <ier7cplhnky.fsf@HIDDEN> <86msyhwrrg.fsf@HIDDEN>
 <ef5bd8eb-40f9-663d-9a13-f59f9745652e@HIDDEN>
 <86y1hs4kkg.fsf@HIDDEN>
 <c239b9eb-f12f-07e7-ded6-df93c6724c88@HIDDEN>
 <86h6of66o3.fsf@HIDDEN>
 <d2b7993b-73a8-6e66-94ae-da8f4fc42ffd@HIDDEN>
 <86wmxb2qvh.fsf@HIDDEN>
 <ab1ef1f6-3e54-3f5e-c16e-905c4d46cacd@HIDDEN>
 <8634zyjt0k.fsf@HIDDEN>
 <8d1fb7ac-5c82-0ec2-8ae2-d09c131ec165@HIDDEN>
 <ierv8ctubo2.fsf@HIDDEN>
Date: Sun, 03 Sep 2023 20:11:57 +0300
Message-ID: <86il8r4g96.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; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 63648
Cc: Dmitry Gutov <dmitry@HIDDEN>, 63648 <at> debbugs.gnu.org, 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 (-)

> Thinking about it, I guess there's (roughly) two classes of commands
> which want different things from default-directory, classes 1 and 2:
>
> 1. wants whatever the current value of default-directory is (and gets
> this by just using default-directory as a variable)
>
> 2. wants the value of default-directory for some specific buffer X (and
> gets this either with buffer-local-value or by using
> with-current-buffer)
>
> If we could change 1 without changing 2, then we'd be happy.

I think we can't solve this logical paradox because it contains
self-contradictory requirements.  Here is the command that
illustrates this paradox.  What should this command print?

  C-x p p ... C-h v default-directory RET

Like Schrödinger's cat, it belongs simultaneously to both classes:

1. wants to print the new value of default-directory
   because 'C-h v' is the next command for which
   the value of default-directory was explicitly set.

2. wants to print the original value of default-directory
   because 'C-h v' was invoked in the buffer where
   the value of default-directory should stay unchanged.




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

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


Received: (at 63648) by debbugs.gnu.org; 2 Sep 2023 01:48:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 01 21:48:06 2023
Received: from localhost ([127.0.0.1]:34592 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qcFk5-0001GH-PL
	for submit <at> debbugs.gnu.org; Fri, 01 Sep 2023 21:48:06 -0400
Received: from wout3-smtp.messagingengine.com ([64.147.123.19]:38751)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dmitry@HIDDEN>) id 1qcFk4-0001FG-0e
 for 63648 <at> debbugs.gnu.org; Fri, 01 Sep 2023 21:48:05 -0400
Received: from compute4.internal (compute4.nyi.internal [10.202.2.44])
 by mailout.west.internal (Postfix) with ESMTP id 02B4B320092D;
 Fri,  1 Sep 2023 21:47:47 -0400 (EDT)
Received: from mailfrontend1 ([10.202.2.162])
 by compute4.internal (MEProxy); Fri, 01 Sep 2023 21:47:48 -0400
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=
 1693619267; x=1693705667; bh=oPeP6Z1pqJ55uWj0b1bQAHmUbBeEnz3BR6W
 pcPY7I9Y=; b=EU829/wdgJ+H/igtOys3Jz2wl2xhcKcJS3Hnrum5GesPSZ93+xb
 ia/4kjsgFlC60rx9TWwX1A4E4pS5coD/LuarIhsNbPOC/BwDdoWqYgdY3yj6PnvK
 tB+EfIdXFHOnpLZwa1W5gHUDVt0qFldwA5rrFXtx/FuQIyHAILTW4T2c56lzkJDh
 7QHeIljmXdU9Xeco8WB9UjV5Q8+JD51lXan7h3NsosDhS366p1tODMqnqgA5iH4s
 0LrYlQl7XvCkmGHebRcpsCmmjCBQApogHKcgs1pIe2b3MUzoDETrWayjHhdeWA9O
 FdA5Cr/eImVTsJQWxvgpN34qdPiEmJ653lw==
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=
 1693619267; x=1693705667; bh=oPeP6Z1pqJ55uWj0b1bQAHmUbBeEnz3BR6W
 pcPY7I9Y=; b=HQzbEWhADBptRWxdY/nd1bmfYt6CwlVxFiuzTUAF9pa2auLDdB1
 IWaCfO+Xb6FAWeQJcGfd9hMMs2bIL6/cA1bmQwPIGJg5teTlLY3U8SfzqzfvaQR5
 fO7Rdu5shMnSCx10saYK1e9HsMFytmWFEXm0o8avfIXYg5v6h7GC5DaI2S+/faq5
 mmtdE2biZuzQ1om+vkFErIInvdXbo0koWHCQJHlC5QkEh3NTSk14bmLu8z4CbYxy
 I9sGtaDSsngDtoyvTdcqMp2rlk4menKDdK4euPakJgtvYlPe/A+OwLZ9agDw/rYu
 C2zUJhBLLHGFl00hKzdED8rNr/hhqv6bxdQ==
X-ME-Sender: <xms:Q5TyZA-B69m2cnpQOjiwgSrzgU7Qp0HRkcTf-RTo0DcGDKTScF-AXw>
 <xme:Q5TyZIuJA6NJLSYg1dUAu8Xj7iwFrNhuGTN61axVXo-7RI7y5dBmlb7HEsf_d5D0d
 3MHf4mcwHaPYEzvQYA>
X-ME-Received: <xmr:Q5TyZGDKmOPZ2s5lex05zIOGBdqXcW91nv8iLkVtpJ9pPjYBfPyqJRTrrRKj9FQ>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudegfedghedvucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi
 thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth
 htvghrnhepiefgteevheevveffheeltdeukeeiieekueefgedugfefgefhudelgfefveel
 vdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug
 hmihhtrhihsehguhhtohhvrdguvghv
X-ME-Proxy: <xmx:Q5TyZAfXQ0MfOz5T-M7NTIs7YM5sy0MGdpVZYFUOJ1bIq6KFWG-NSw>
 <xmx:Q5TyZFOcyh8rflY_kgayciuTck7gMl60glao9GzAnxkD_HJaDh2jwg>
 <xmx:Q5TyZKm9ISnTakGNHiW_OBDMpcwADFXvH-g3JLtp7Hk1Lo0AVPCBhA>
 <xmx:Q5TyZObA_9E1o5hlJDG5OWaJ93wiOWKClLHi5nIgIlhIZuVB1qppvg>
Feedback-ID: i0e71465a:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri,
 1 Sep 2023 21:47:45 -0400 (EDT)
Message-ID: <09a33cba-b94a-55a1-6b2a-ea5e08f751fc@HIDDEN>
Date: Sat, 2 Sep 2023 04:47:44 +0300
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#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
Content-Language: en-US
To: Spencer Baugh <sbaugh@HIDDEN>
References: <ierttw472m1.fsf@HIDDEN> <86jzwyxnxb.fsf@HIDDEN>
 <feead847-869a-86a8-d62d-065871024a74@HIDDEN>
 <86o7m91z22.fsf@HIDDEN> <86pm6py6k4.fsf@HIDDEN>
 <86bki9y68h.fsf@HIDDEN> <86cz2f7bvo.fsf@HIDDEN>
 <e698de3a-dec8-424a-21ff-dcb5bd22c8d4@HIDDEN>
 <86353axu48.fsf@HIDDEN> <87o7jfi00b.fsf@HIDDEN>
 <ier7cplhnky.fsf@HIDDEN> <86msyhwrrg.fsf@HIDDEN>
 <ef5bd8eb-40f9-663d-9a13-f59f9745652e@HIDDEN>
 <86y1hs4kkg.fsf@HIDDEN>
 <c239b9eb-f12f-07e7-ded6-df93c6724c88@HIDDEN>
 <86h6of66o3.fsf@HIDDEN>
 <d2b7993b-73a8-6e66-94ae-da8f4fc42ffd@HIDDEN>
 <86wmxb2qvh.fsf@HIDDEN>
 <ab1ef1f6-3e54-3f5e-c16e-905c4d46cacd@HIDDEN>
 <8634zyjt0k.fsf@HIDDEN>
 <8d1fb7ac-5c82-0ec2-8ae2-d09c131ec165@HIDDEN>
 <ierv8ctubo2.fsf@HIDDEN>
From: Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <ierv8ctubo2.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -4.2 (----)
X-Debbugs-Envelope-To: 63648
Cc: sbaugh@HIDDEN, 63648 <at> debbugs.gnu.org, 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: -5.2 (-----)

On 01/09/2023 18:59, Spencer Baugh wrote:
>>> Hopefully there should be not much trouble such as in 'project-buffers'.
>>
>> I think there exists a class of commands (existing and potential ones)
>> that would use default-directory with exact same purpose and
>> expectations.
> 
> Thinking about it, I guess there's (roughly) two classes of commands
> which want different things from default-directory, classes 1 and 2:
> 
> 1. wants whatever the current value of default-directory is (and gets
> this by just using default-directory as a variable)
> 
> 2. wants the value of default-directory for some specific buffer X (and
> gets this either with buffer-local-value or by using
> with-current-buffer)
> 
> If we could change 1 without changing 2, then we'd be happy.

Yes, maybe.

> This gets back to my earlier suggestion, that we have some way of
> binding a variable which does not change the buffer-local value.
> Supporting that would require fairly deep changes in C of course.
> 
> (But actually, maybe it would be useful for Lisp threads?  In fact,
> maybe Lisp threads already support this?  Because when you're in a
> thread and you bind default-directory, you don't want that to affect any
> other threads, you only want it to affect code running directly under
> you.)

It might be useful, sure. But as for how reasonable would be to have 
such a primitive, I'd rather defer to our language gurus (a question on 
emacs-devel would be a good idea).

> Anyway, I'm coming around to the idea that actually the "changing the
> local value of default-directory" problem isn't that big of a deal.  We
> can do something special for project-buffers, and that would make things
> work OK with the next-default-directory approach, and if we run into
> further problems in the future, we'll rethink at that time.
 >
> Maybe with more time running with the code, we will come up with
> something new and clever.

It's a minor problem, but we've already went through two rounds on 
bug#58784 (first finding one solution, then a problem with it, and 
ending up with project-current-directory-override). I'd rather not throw 
out a solution that covers the known edge cases too eagerly.

So I don't like an idea of a "special fix" in project-buffers, but if 
anyone has a specific patch to show, please go ahead.




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

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


Received: (at 63648) by debbugs.gnu.org; 1 Sep 2023 15:59:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 01 11:59:59 2023
Received: from localhost ([127.0.0.1]:33709 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qc6Yx-0006tJ-0T
	for submit <at> debbugs.gnu.org; Fri, 01 Sep 2023 11:59:59 -0400
Received: from mxout5.mail.janestreet.com ([64.215.233.18]:50041)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <sbaugh@HIDDEN>) id 1qc6Yv-0006t3-2Q
 for 63648 <at> debbugs.gnu.org; Fri, 01 Sep 2023 11:59:58 -0400
From: Spencer Baugh <sbaugh@HIDDEN>
To: Dmitry Gutov <dmitry@HIDDEN>
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
In-Reply-To: <8d1fb7ac-5c82-0ec2-8ae2-d09c131ec165@HIDDEN> (Dmitry Gutov's
 message of "Fri, 1 Sep 2023 12:53:02 +0300")
References: <ierttw472m1.fsf@HIDDEN> <86jzwyxnxb.fsf@HIDDEN>
 <feead847-869a-86a8-d62d-065871024a74@HIDDEN>
 <86o7m91z22.fsf@HIDDEN> <86pm6py6k4.fsf@HIDDEN>
 <86bki9y68h.fsf@HIDDEN> <86cz2f7bvo.fsf@HIDDEN>
 <e698de3a-dec8-424a-21ff-dcb5bd22c8d4@HIDDEN>
 <86353axu48.fsf@HIDDEN> <87o7jfi00b.fsf@HIDDEN>
 <ier7cplhnky.fsf@HIDDEN> <86msyhwrrg.fsf@HIDDEN>
 <ef5bd8eb-40f9-663d-9a13-f59f9745652e@HIDDEN>
 <86y1hs4kkg.fsf@HIDDEN>
 <c239b9eb-f12f-07e7-ded6-df93c6724c88@HIDDEN>
 <86h6of66o3.fsf@HIDDEN>
 <d2b7993b-73a8-6e66-94ae-da8f4fc42ffd@HIDDEN>
 <86wmxb2qvh.fsf@HIDDEN>
 <ab1ef1f6-3e54-3f5e-c16e-905c4d46cacd@HIDDEN>
 <8634zyjt0k.fsf@HIDDEN>
 <8d1fb7ac-5c82-0ec2-8ae2-d09c131ec165@HIDDEN>
Date: Fri, 01 Sep 2023 11:59:41 -0400
Message-ID: <ierv8ctubo2.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: 63648
Cc: sbaugh@HIDDEN, 63648 <at> debbugs.gnu.org, 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: -1.0 (-)

Dmitry Gutov <dmitry@HIDDEN> writes:
> On 01/09/2023 09:46, Juri Linkov wrote:
>>>> (let ((default-directory "/tmp/"))
>>>>     (list default-directory
>>>>           (buffer-local-value 'default-directory (current-buffer))))
>>>> => ("/tmp/""/tmp/")
>>>> Here is the shortest test case: 'C-x p p C-b' shows buffers
>>>> from two projects when using let-binding for default-directory,
>>>> because 'project-buffers' relies on
>>>>     (buffer-local-value 'default-directory buf)
>>>> This could be fixed by adding special-handling of the default-directory
>>>> for the current buffer in 'project-buffers'.
>>> What kind of special handling? The "real" buffer-local value is hidden
>>> until the "let" exists, the global value is nil, and if the buffer is not
>>> a file-visiting one, there is no other file name to test against.
>> Additional buffer-local variable like 'buffer-default-directory' could help.
>> Or additional global variable 'global-default-directory'.  Or even
>> using the global value of the existing variable 'default-directory'.
>
> What code would use it instead of the local value of
> default-directory? Only project-related code? Or other code as well?
> If it's the former, we have an existing variable in the project
> package. If the latter, we'd need some formal description of those
> usage rules to proceed.
>
>>> Finally, whatever special handling we invent, would have to be mirrored by
>>> all subsequent new commands (built-in and third-party) which look up the
>>> value of default-directory. Especially project-related ones. How to
>>> popularize that knowledge, would be the next question for whatever solution
>>> we invent.
>> Hopefully there should be not much trouble such as in 'project-buffers'.
>
> I think there exists a class of commands (existing and potential ones)
> that would use default-directory with exact same purpose and
> expectations.

Thinking about it, I guess there's (roughly) two classes of commands
which want different things from default-directory, classes 1 and 2:

1. wants whatever the current value of default-directory is (and gets
this by just using default-directory as a variable)

2. wants the value of default-directory for some specific buffer X (and
gets this either with buffer-local-value or by using
with-current-buffer)

If we could change 1 without changing 2, then we'd be happy.

This gets back to my earlier suggestion, that we have some way of
binding a variable which does not change the buffer-local value.
Supporting that would require fairly deep changes in C of course.

(But actually, maybe it would be useful for Lisp threads?  In fact,
maybe Lisp threads already support this?  Because when you're in a
thread and you bind default-directory, you don't want that to affect any
other threads, you only want it to affect code running directly under
you.)

---

Anyway, I'm coming around to the idea that actually the "changing the
local value of default-directory" problem isn't that big of a deal.  We
can do something special for project-buffers, and that would make things
work OK with the next-default-directory approach, and if we run into
further problems in the future, we'll rethink at that time.

Maybe with more time running with the code, we will come up with
something new and clever.




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

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


Received: (at 63648) by debbugs.gnu.org; 1 Sep 2023 09:53:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 01 05:53:23 2023
Received: from localhost ([127.0.0.1]:59894 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qc0qA-0000aI-NK
	for submit <at> debbugs.gnu.org; Fri, 01 Sep 2023 05:53:23 -0400
Received: from wout4-smtp.messagingengine.com ([64.147.123.20]:39713)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dmitry@HIDDEN>) id 1qc0q8-0000a3-OL
 for 63648 <at> debbugs.gnu.org; Fri, 01 Sep 2023 05:53:21 -0400
Received: from compute2.internal (compute2.nyi.internal [10.202.2.46])
 by mailout.west.internal (Postfix) with ESMTP id 8891B3200926;
 Fri,  1 Sep 2023 05:53:05 -0400 (EDT)
Received: from mailfrontend1 ([10.202.2.162])
 by compute2.internal (MEProxy); Fri, 01 Sep 2023 05:53:05 -0400
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=
 1693561985; x=1693648385; bh=ljX6vArHzwX7PPNuoN749XdGX/98fR3qO2i
 u4bQCck8=; b=b68Gl3kl5V3BidlSKif1GsiwoFUu2nyC37g2iGiWehKhI36EI3J
 rF71u09uSZFzYBkj79J1Sd3d+epe1e/hrhii8+E4lb6+9d831TeC/yLpjZcTt0pK
 Vut29UOLI4uwDBhF/aUJT9oUDA0aW3RFCgedeeqZ1+6m/RXisu831prziTUW076Y
 9c9T5CY1oqqNcBtRynRHQ/E99e97Vw3rbO51TKC52tTQI0fjMh2oh7o7K/3kMP3G
 WGNHx+vC8w7xTAqb6rb9ut7AWB/YZ9W5m4xoTttJiEAJFeayx+0yeWkZ6ifs+1wK
 PndwimM4xyNEhtlYc1H9FTnhp5EJX0RIZWg==
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=
 1693561985; x=1693648385; bh=ljX6vArHzwX7PPNuoN749XdGX/98fR3qO2i
 u4bQCck8=; b=zLyyABRcuoWPdeOOinNitkDVsz3scnDhFx14vsmSyDecyyBJMTN
 0vUcijbhpM73gXe2cveYBWRnKGPp5G10dU0HqnYDAcwACbg/Smif1w7Z/tGQgl0K
 HdAubmADmz1lxHa4X5TpjRzR/0Cz55CTo+OssT3QM0vBrBOKEA66XPvJdYrDtXDy
 +J4R81AeHxOmCK7OTym1PxzQoiKaIkEUmXJkjjux1RySHLiuIL/YtG61S+tVwwJk
 SgnQM46+Yk60soKsPR/fPyPRsD7XYVrfZYqqnKP8KqJHffrM7kgHVC3xiSC4a3j9
 TdkKY9qK6kxBpy22dj2EYl7Nol2eJudN1JA==
X-ME-Sender: <xms:gLTxZP7K57IfTRB8r6YvCRLtxKGcGUNhdFu-EKSx39TbXpEqKU-qTQ>
 <xme:gLTxZE6-Lxvw0c86Ci-R4uElmHSESi__LZ9y1Q5lNgpwf23tLcnPLASToSKGNkkLd
 MpPiRLAxnskhM7_w7I>
X-ME-Received: <xmr:gLTxZGdzloODQrd8HxG61kSn9ukQ4KqQtMzZjFRCkFNvHpia7KCHMjuNwp2ZAB0>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudegvddgvddtucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi
 thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth
 htvghrnhepiefgteevheevveffheeltdeukeeiieekueefgedugfefgefhudelgfefveel
 vdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug
 hmihhtrhihsehguhhtohhvrdguvghv
X-ME-Proxy: <xmx:gLTxZAIZlSwauwz8oMcrL9Gld3O2fGzulk9LRHUZVYxEeC2v-JlGRA>
 <xmx:gLTxZDI2D_b5CGyAQ6XecipPU7avXtz2wfxKmc6VI8JXSIv23WrpCg>
 <xmx:gLTxZJybKUL5_pwClgQj6jlETnw_UEwDOFEBg_1tD5bE1QPZKpBu2g>
 <xmx:gbTxZKUXpMpNdXkdRSYt2-71-kDDmB4UghVEFTXKbWIs6yQv7zhnDw>
Feedback-ID: i0e71465a:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri,
 1 Sep 2023 05:53:03 -0400 (EDT)
Message-ID: <8d1fb7ac-5c82-0ec2-8ae2-d09c131ec165@HIDDEN>
Date: Fri, 1 Sep 2023 12:53:02 +0300
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#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
Content-Language: en-US
To: Juri Linkov <juri@HIDDEN>
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <482a1ebc-165c-a0a4-98c0-5c404d1b1d0d@HIDDEN>
 <86jzwyxnxb.fsf@HIDDEN>
 <feead847-869a-86a8-d62d-065871024a74@HIDDEN>
 <86o7m91z22.fsf@HIDDEN> <86pm6py6k4.fsf@HIDDEN>
 <86bki9y68h.fsf@HIDDEN> <86cz2f7bvo.fsf@HIDDEN>
 <e698de3a-dec8-424a-21ff-dcb5bd22c8d4@HIDDEN>
 <86353axu48.fsf@HIDDEN> <87o7jfi00b.fsf@HIDDEN>
 <ier7cplhnky.fsf@HIDDEN> <86msyhwrrg.fsf@HIDDEN>
 <ef5bd8eb-40f9-663d-9a13-f59f9745652e@HIDDEN>
 <86y1hs4kkg.fsf@HIDDEN>
 <c239b9eb-f12f-07e7-ded6-df93c6724c88@HIDDEN>
 <86h6of66o3.fsf@HIDDEN>
 <d2b7993b-73a8-6e66-94ae-da8f4fc42ffd@HIDDEN>
 <86wmxb2qvh.fsf@HIDDEN>
 <ab1ef1f6-3e54-3f5e-c16e-905c4d46cacd@HIDDEN>
 <8634zyjt0k.fsf@HIDDEN>
From: Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <8634zyjt0k.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -4.2 (----)
X-Debbugs-Envelope-To: 63648
Cc: Spencer Baugh <sbaugh@HIDDEN>, 63648 <at> debbugs.gnu.org,
 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: -5.2 (-----)

On 01/09/2023 09:46, Juri Linkov wrote:
>>> (let ((default-directory "/tmp/"))
>>>     (list default-directory
>>>           (buffer-local-value 'default-directory (current-buffer))))
>>> => ("/tmp/""/tmp/")
>>> Here is the shortest test case: 'C-x p p C-b' shows buffers
>>> from two projects when using let-binding for default-directory,
>>> because 'project-buffers' relies on
>>>     (buffer-local-value 'default-directory buf)
>>> This could be fixed by adding special-handling of the default-directory
>>> for the current buffer in 'project-buffers'.
>> What kind of special handling? The "real" buffer-local value is hidden
>> until the "let" exists, the global value is nil, and if the buffer is not
>> a file-visiting one, there is no other file name to test against.
> Additional buffer-local variable like 'buffer-default-directory' could help.
> Or additional global variable 'global-default-directory'.  Or even
> using the global value of the existing variable 'default-directory'.

What code would use it instead of the local value of default-directory? 
Only project-related code? Or other code as well? If it's the former, we 
have an existing variable in the project package. If the latter, we'd 
need some formal description of those usage rules to proceed.

>> Finally, whatever special handling we invent, would have to be mirrored by
>> all subsequent new commands (built-in and third-party) which look up the
>> value of default-directory. Especially project-related ones. How to
>> popularize that knowledge, would be the next question for whatever solution
>> we invent.
> Hopefully there should be not much trouble such as in 'project-buffers'.

I think there exists a class of commands (existing and potential ones) 
that would use default-directory with exact same purpose and expectations.




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

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


Received: (at 63648) by debbugs.gnu.org; 1 Sep 2023 07:04:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 01 03:04:56 2023
Received: from localhost ([127.0.0.1]:59759 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qbyD9-0004fv-R5
	for submit <at> debbugs.gnu.org; Fri, 01 Sep 2023 03:04:56 -0400
Received: from relay2-d.mail.gandi.net ([2001:4b98:dc4:8::222]:34897)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1qbyD7-0004ff-OI
 for 63648 <at> debbugs.gnu.org; Fri, 01 Sep 2023 03:04:54 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id 289014000A;
 Fri,  1 Sep 2023 07:04:34 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Dmitry Gutov <dmitry@HIDDEN>
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
In-Reply-To: <ab1ef1f6-3e54-3f5e-c16e-905c4d46cacd@HIDDEN> (Dmitry Gutov's
 message of "Fri, 1 Sep 2023 04:11:40 +0300")
Organization: LINKOV.NET
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <482a1ebc-165c-a0a4-98c0-5c404d1b1d0d@HIDDEN>
 <86jzwyxnxb.fsf@HIDDEN>
 <feead847-869a-86a8-d62d-065871024a74@HIDDEN>
 <86o7m91z22.fsf@HIDDEN> <86pm6py6k4.fsf@HIDDEN>
 <86bki9y68h.fsf@HIDDEN> <86cz2f7bvo.fsf@HIDDEN>
 <e698de3a-dec8-424a-21ff-dcb5bd22c8d4@HIDDEN>
 <86353axu48.fsf@HIDDEN> <87o7jfi00b.fsf@HIDDEN>
 <ier7cplhnky.fsf@HIDDEN> <86msyhwrrg.fsf@HIDDEN>
 <ef5bd8eb-40f9-663d-9a13-f59f9745652e@HIDDEN>
 <86y1hs4kkg.fsf@HIDDEN>
 <c239b9eb-f12f-07e7-ded6-df93c6724c88@HIDDEN>
 <86h6of66o3.fsf@HIDDEN>
 <d2b7993b-73a8-6e66-94ae-da8f4fc42ffd@HIDDEN>
 <86wmxb2qvh.fsf@HIDDEN>
 <ab1ef1f6-3e54-3f5e-c16e-905c4d46cacd@HIDDEN>
Date: Fri, 01 Sep 2023 09:46:27 +0300
Message-ID: <8634zyjt0k.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: 63648
Cc: Spencer Baugh <sbaugh@HIDDEN>, 63648 <at> debbugs.gnu.org,
 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 (-)

>> (let ((default-directory "/tmp/"))
>>    (list default-directory
>>          (buffer-local-value 'default-directory (current-buffer))))
>> => ("/tmp/" "/tmp/")
>> Here is the shortest test case: 'C-x p p C-b' shows buffers
>> from two projects when using let-binding for default-directory,
>> because 'project-buffers' relies on
>>    (buffer-local-value 'default-directory buf)
>> This could be fixed by adding special-handling of the default-directory
>> for the current buffer in 'project-buffers'.
>
> What kind of special handling? The "real" buffer-local value is hidden
> until the "let" exists, the global value is nil, and if the buffer is not
> a file-visiting one, there is no other file name to test against.

Additional buffer-local variable like 'buffer-default-directory' could help.
Or additional global variable 'global-default-directory'.  Or even
using the global value of the existing variable 'default-directory'.

> Finally, whatever special handling we invent, would have to be mirrored by
> all subsequent new commands (built-in and third-party) which look up the
> value of default-directory. Especially project-related ones. How to
> popularize that knowledge, would be the next question for whatever solution
> we invent.

Hopefully there should be not much trouble such as in 'project-buffers'.

>>> A general question regarding this approach, for me, is: is a "prefix
>>> command" a real command?
>> It's a real command that prepares some transient values for the next
>> command.
>> Most existing prefix commands have no problems because they modify global
>> values.  But 'default-directory' is the first buffer-local variable
>> used for the next command, therefore it requires special-handling.
>> Too bad that 'default-directory' is not a function.
>
> I suppose the new code could check against some property or dynamic var to
> distinguish prefix commands from "terminal" ones.

Currently I see no need for this.

>>> And would they "swallow" these prepared variable bindings too early?
>> The scope of the modified variable depends on concrete needs.
>> For example, set-transient-map restores its old value in pre-command-hook,
>> but display-buffer-override-next-command does this in post-command-hook.
>
> That can also work - though the odds of getting into an unrecoverable state
> (such as one I described) would be higher.

This is strange, no one reported an unrecoverable state for set-transient-map.




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

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


Received: (at 63648) by debbugs.gnu.org; 1 Sep 2023 01:12:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Aug 31 21:12:01 2023
Received: from localhost ([127.0.0.1]:59498 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qbshc-0001GS-TO
	for submit <at> debbugs.gnu.org; Thu, 31 Aug 2023 21:12:01 -0400
Received: from wout5-smtp.messagingengine.com ([64.147.123.21]:51301)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dmitry@HIDDEN>) id 1qbshb-0001GF-Fd
 for 63648 <at> debbugs.gnu.org; Thu, 31 Aug 2023 21:12:00 -0400
Received: from compute3.internal (compute3.nyi.internal [10.202.2.43])
 by mailout.west.internal (Postfix) with ESMTP id 2B3F3320039A;
 Thu, 31 Aug 2023 21:11:44 -0400 (EDT)
Received: from mailfrontend1 ([10.202.2.162])
 by compute3.internal (MEProxy); Thu, 31 Aug 2023 21:11:44 -0400
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=
 1693530703; x=1693617103; bh=cwwxBVHoswxO4PKTx+dqSNoIXMnRklsY11j
 246wypsU=; b=I8pdLgOVgRBKYLprZ6WVsnrFxhUJKrFnpcGvRsYoi5kUxGYLKPC
 gJWJbT8Noh3/I6dwMGqVLn5cZdWzwjTAwA0+iDFZ1ViL75hsDo89uIToz/mb/Bh6
 56L7u/sMBLMTLZjDZXKvUC+5h9EElIDEqzfQfmGiK6s2vHgPgk/V9zZgBAUk/BI8
 ujkpgOzjWu2Kbm0QaFrYKBstiJUvtZACl0CzgojitmTM0bN4zibGFxLSxnuDvkPj
 j35j8oid5aETtXOgcuMlNATVmhhY49M+O/JcfnfbBetbdQSlkb/S9/vCeD7lGBTt
 okbE4b6r726g6JIOUtTA9rJDbPmksvW+/oQ==
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=
 1693530703; x=1693617103; bh=cwwxBVHoswxO4PKTx+dqSNoIXMnRklsY11j
 246wypsU=; b=SKsXKHDftay17UYst3q/p2VhkYq3VelLxoG56kIY4u5K9z5zlr7
 C9CXf6beWgbJLsMd1g4FX9O5RAKLv3ZzrkT7sb+RNrOcurD6wZ6BxhNCWyIjeST9
 q+hDtjbbkLZ2y2ry/4iPd2FiBHxbmUFr4UFb2dNYQPjFd9oc2+2QaJPHaioKVdgz
 JgXWAzhB1HTrh5PPa2Dp74HN7yGXoS/j+OBAyBx5yys7LWs31adIojENvTqe1Ao8
 icmNz8HkmW1epNAtFbc4foXk9g3NC2eJulJZGVj0EPOYnFdrZm5EiqCmqPlu/OZb
 Dn6t4KGGvjdAxrqUaEBI/OE39XBQBsCu07A==
X-ME-Sender: <xms:TzrxZJWhSx3W830pUvbsaKtR1UD_AXxVPU1TsoRrPs0_3dlnCQHNRw>
 <xme:TzrxZJnGsd9UMIID1aG6RnDwftIxbqhSYNIIEkiRdttv9IwXzJFobzaLEFTzXxBkB
 7J8isTtRKwjKqp_0-k>
X-ME-Received: <xmr:TzrxZFZdi7G752K6RJ7VvXGJ7qsQbkNHDrCgwb_DCRHsucW3xHPTr81uVrqAuw8>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudeguddggedvucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi
 thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth
 htvghrnhephfeutdekveeggeetteekfeejffegudduudfhueevleeftdffffeggeeivddv
 jeelnecuffhomhgrihhnpehgnhhurdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenuc
 frrghrrghmpehmrghilhhfrhhomhepughmihhtrhihsehguhhtohhvrdguvghv
X-ME-Proxy: <xmx:TzrxZMVtXbKcmgf9QZENfkOlOCGN8-6buaX-iccpB5t4rhYEUYdviQ>
 <xmx:TzrxZDl_RiaulnuHAuRA9ogXxh2z9b3ObuAXHPwi983DrQ-NVIY__g>
 <xmx:TzrxZJf9w9mh6Zd3ZNOw5dTzZGBYqRpwQE37QstbLJUGh03fFA6DrQ>
 <xmx:TzrxZIzaIj_A19DL9bkQLJQKwgZizoJTpEJvvZGBNz1OWvAUuEctYA>
Feedback-ID: i0e71465a:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu,
 31 Aug 2023 21:11:41 -0400 (EDT)
Message-ID: <ab1ef1f6-3e54-3f5e-c16e-905c4d46cacd@HIDDEN>
Date: Fri, 1 Sep 2023 04:11:40 +0300
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#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
Content-Language: en-US
To: Juri Linkov <juri@HIDDEN>
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <482a1ebc-165c-a0a4-98c0-5c404d1b1d0d@HIDDEN>
 <86jzwyxnxb.fsf@HIDDEN>
 <feead847-869a-86a8-d62d-065871024a74@HIDDEN>
 <86o7m91z22.fsf@HIDDEN> <86pm6py6k4.fsf@HIDDEN>
 <86bki9y68h.fsf@HIDDEN> <86cz2f7bvo.fsf@HIDDEN>
 <e698de3a-dec8-424a-21ff-dcb5bd22c8d4@HIDDEN>
 <86353axu48.fsf@HIDDEN> <87o7jfi00b.fsf@HIDDEN>
 <ier7cplhnky.fsf@HIDDEN> <86msyhwrrg.fsf@HIDDEN>
 <ef5bd8eb-40f9-663d-9a13-f59f9745652e@HIDDEN>
 <86y1hs4kkg.fsf@HIDDEN>
 <c239b9eb-f12f-07e7-ded6-df93c6724c88@HIDDEN>
 <86h6of66o3.fsf@HIDDEN>
 <d2b7993b-73a8-6e66-94ae-da8f4fc42ffd@HIDDEN>
 <86wmxb2qvh.fsf@HIDDEN>
From: Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <86wmxb2qvh.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -4.2 (----)
X-Debbugs-Envelope-To: 63648
Cc: Spencer Baugh <sbaugh@HIDDEN>, 63648 <at> debbugs.gnu.org,
 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: -5.2 (-----)

On 31/08/2023 19:36, Juri Linkov wrote:
>>>> - Unfortunately, using default-directory instead of the specialized
>>>>     variable which we added lately (project-current-directory-override)
>>>>     brings back the bug it was added for: https://debbugs.gnu.org/58784. The
>>>>     switch to a different design didn't fix the problem of the temporary
>>>>     binding for d-d in the buffer which is current when the command is
>>>>     executed. So adding the next-default-directory variable might not be the
>>>>     best idea after all. But the advice thingy can set a binding for any
>>>>     variable, including the *-override one.
>>> I didn't test yet the cases from bug#58784.  So this might require more
>>> changes.
>>
>> We tried to make the default-directory binding work with a couple of
>> different changes - it didn't work out.
> 
> The problem is that let-binding overrides the buffer-local value:

Yep.

> ```
> (let ((default-directory "/tmp/"))
>    (list default-directory
>          (buffer-local-value 'default-directory (current-buffer))))
> => ("/tmp/" "/tmp/")
> ```
> 
> Here is the shortest test case: 'C-x p p C-b' shows buffers
> from two projects when using let-binding for default-directory,
> because 'project-buffers' relies on
> 
>    (buffer-local-value 'default-directory buf)
> 
> This could be fixed by adding special-handling of the default-directory
> for the current buffer in 'project-buffers'.

What kind of special handling? The "real" buffer-local value is hidden 
until the "let" exists, the global value is nil, and if the buffer is 
not a file-visiting one, there is no other file name to test against.

Finally, whatever special handling we invent, would have to be mirrored 
by all subsequent new commands (built-in and third-party) which look up 
the value of default-directory. Especially project-related ones. How to 
popularize that knowledge, would be the next question for whatever 
solution we invent.

>> A general question regarding this approach, for me, is: is a "prefix
>> command" a real command?
> 
> It's a real command that prepares some transient values for the next command.
> Most existing prefix commands have no problems because they modify global
> values.  But 'default-directory' is the first buffer-local variable
> used for the next command, therefore it requires special-handling.
> Too bad that 'default-directory' is not a function.

I suppose the new code could check against some property or dynamic var 
to distinguish prefix commands from "terminal" ones.

>> And would they "swallow" these prepared variable bindings too early?
> 
> The scope of the modified variable depends on concrete needs.
> For example, set-transient-map restores its old value in pre-command-hook,
> but display-buffer-override-next-command does this in post-command-hook.

That can also work - though the odds of getting into an unrecoverable 
state (such as one I described) would be higher.




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

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


Received: (at 63648) by debbugs.gnu.org; 31 Aug 2023 16:43:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Aug 31 12:43:21 2023
Received: from localhost ([127.0.0.1]:56935 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qbklM-0002uY-W6
	for submit <at> debbugs.gnu.org; Thu, 31 Aug 2023 12:43:21 -0400
Received: from relay6-d.mail.gandi.net ([217.70.183.198]:34159)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1qbklJ-0002u6-KU
 for 63648 <at> debbugs.gnu.org; Thu, 31 Aug 2023 12:43:18 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id 3D8EAC0003;
 Thu, 31 Aug 2023 16:43:00 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Dmitry Gutov <dmitry@HIDDEN>
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
In-Reply-To: <d2b7993b-73a8-6e66-94ae-da8f4fc42ffd@HIDDEN> (Dmitry Gutov's
 message of "Thu, 31 Aug 2023 14:13:46 +0300")
Organization: LINKOV.NET
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <482a1ebc-165c-a0a4-98c0-5c404d1b1d0d@HIDDEN>
 <86jzwyxnxb.fsf@HIDDEN>
 <feead847-869a-86a8-d62d-065871024a74@HIDDEN>
 <86o7m91z22.fsf@HIDDEN> <86pm6py6k4.fsf@HIDDEN>
 <86bki9y68h.fsf@HIDDEN> <86cz2f7bvo.fsf@HIDDEN>
 <e698de3a-dec8-424a-21ff-dcb5bd22c8d4@HIDDEN>
 <86353axu48.fsf@HIDDEN> <87o7jfi00b.fsf@HIDDEN>
 <ier7cplhnky.fsf@HIDDEN> <86msyhwrrg.fsf@HIDDEN>
 <ef5bd8eb-40f9-663d-9a13-f59f9745652e@HIDDEN>
 <86y1hs4kkg.fsf@HIDDEN>
 <c239b9eb-f12f-07e7-ded6-df93c6724c88@HIDDEN>
 <86h6of66o3.fsf@HIDDEN>
 <d2b7993b-73a8-6e66-94ae-da8f4fc42ffd@HIDDEN>
Date: Thu, 31 Aug 2023 19:36:29 +0300
Message-ID: <86wmxb2qvh.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: 63648
Cc: Spencer Baugh <sbaugh@HIDDEN>, 63648 <at> debbugs.gnu.org,
 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 (-)

>>> - Unfortunately, using default-directory instead of the specialized
>>>    variable which we added lately (project-current-directory-override)
>>>    brings back the bug it was added for: https://debbugs.gnu.org/58784. The
>>>    switch to a different design didn't fix the problem of the temporary
>>>    binding for d-d in the buffer which is current when the command is
>>>    executed. So adding the next-default-directory variable might not be the
>>>    best idea after all. But the advice thingy can set a binding for any
>>>    variable, including the *-override one.
>> I didn't test yet the cases from bug#58784.  So this might require more
>> changes.
>
> We tried to make the default-directory binding work with a couple of
> different changes - it didn't work out.

The problem is that let-binding overrides the buffer-local value:

```
(let ((default-directory "/tmp/"))
  (list default-directory
        (buffer-local-value 'default-directory (current-buffer))))
=> ("/tmp/" "/tmp/")
```

Here is the shortest test case: 'C-x p p C-b' shows buffers
from two projects when using let-binding for default-directory,
because 'project-buffers' relies on

  (buffer-local-value 'default-directory buf)

This could be fixed by adding special-handling of the default-directory
for the current buffer in 'project-buffers'.

>>> - I also managed to get into some transient state where some chars were
>>>    doing one thing (their usual bindings), and some - invoked project
>>>    commands instead, with no apparent method of quitting that state. Maybe
>>>    I'll document it next time I see it.
>> It would be nice to have a reproducible test case.
>> But indeed chars in the project map invoke the project commands,
>> and all other chars fall back to local/global keybindings.
>> 
>>> - Using (project--keymap-prompt) for just a message call is cute, but
>>>    I personally like the "guardrails": if I accidentally type a wrong char
>>>    when choosing the command, I won't have to choose the other project
>>>    again. This is debatable, but both modes of operation are probably worth
>>>    keeping available (opinions welcome).
>> This is easy to do with something like in 'y-or-n-p-map'.
>
> With setting that (or similar) keymap as a transient keymap?

Something like this.

>>> - Either way, with method with the advice should be useful for other
>>>    things, like project--other-place-command.
>> It's not recommended to use advice in the core packages,
>> maybe only for providing backward-compatibility with older versions.
>
> Sure, but it should also be permissible when there is no other way to do
> a thing.
>
> OTOH, if we're talking about new features in core, we could have
> a next-command-variables-alist, where we'd bind any variables that we would
> want.

Such generalization could be added later.

> A general question regarding this approach, for me, is: is a "prefix
> command" a real command?

It's a real command that prepares some transient values for the next command.
Most existing prefix commands have no problems because they modify global
values.  But 'default-directory' is the first buffer-local variable
used for the next command, therefore it requires special-handling.
Too bad that 'default-directory' is not a function.

> And would they "swallow" these prepared variable bindings too early?

The scope of the modified variable depends on concrete needs.
For example, set-transient-map restores its old value in pre-command-hook,
but display-buffer-override-next-command does this in post-command-hook.




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

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


Received: (at 63648) by debbugs.gnu.org; 31 Aug 2023 11:14:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Aug 31 07:14:07 2023
Received: from localhost ([127.0.0.1]:55054 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qbfcl-0008G0-2m
	for submit <at> debbugs.gnu.org; Thu, 31 Aug 2023 07:14:07 -0400
Received: from out2-smtp.messagingengine.com ([66.111.4.26]:60187)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dmitry@HIDDEN>) id 1qbfcj-0008FM-6r
 for 63648 <at> debbugs.gnu.org; Thu, 31 Aug 2023 07:14:05 -0400
Received: from compute2.internal (compute2.nyi.internal [10.202.2.46])
 by mailout.nyi.internal (Postfix) with ESMTP id C50EA5C00D6;
 Thu, 31 Aug 2023 07:13:49 -0400 (EDT)
Received: from mailfrontend1 ([10.202.2.162])
 by compute2.internal (MEProxy); Thu, 31 Aug 2023 07:13:49 -0400
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=
 1693480429; x=1693566829; bh=ayDn+6bx2P8JVZOz9/gjdQEsUlD/4y03n1t
 eVQbIoiU=; b=gv6jiSWFW998Po56Hkpo0AhvxEX0VElfTLxq839j2QIuAJdeV2S
 2O/0mVrGfZjkxLXZlrmp9ewA2M1sHsXrCELZN2VYvzFqUdy5TrlY0otomydv/R2k
 Au216/TMcyfdwwro90c47h3vAdpfUFovWgsXKh+Jfn8gAysOpNQpTCyiEdFwXpeU
 mzlw25mAQiusk2xX8dGf4eckQjHv5K5Duk71/1i25hHgaCeZ50vhaG9v2sh2e14q
 ZuOQOWqE8/EJUS3N+6jnEq2lYhDJlHAh1zh/uumE0ucMlMcki/YlQPWmOvmXwVzj
 iEpWVuMOqJDPIJpPtKNSt8miiXpG00WM1ag==
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=
 1693480429; x=1693566829; bh=ayDn+6bx2P8JVZOz9/gjdQEsUlD/4y03n1t
 eVQbIoiU=; b=f4YSKvgipQ4LHiyLNH5wEDuSohP9fXSRI+PKwfL3gUs/IP+IWks
 JCqB6NelRDUdv3YVsn5Rzf776Sa1wIWDlKUyjiKI+aA4zbYWuX7VLvJPZy/34INY
 K9QXsVViqMbgHBww7E3Fpmp/SpXeeLoPqe6OdmYUhZQJFtHLNs2fcXtYLqZ6hbF+
 3mBR0fCOYK/NCQ5dwlmK909fI6XwKUGkHtgNt5UploFDqLSN910YpI2eC4Le3mBn
 bwIsHwWU+AFFxULzk7Vy5gFqjlTFimtvKBojwdlfYKG9ISmhFNbx04QKWB0dM4M+
 lxaQmMutNiDgxx7ceucn278uXQQ+0P64QJg==
X-ME-Sender: <xms:7XXwZDfBWOgZ_3V9TWtYhRN-ogB3yBHHesdBJLVI-0GKsz8YeyUUzA>
 <xme:7XXwZJPKC8QrgsYqgYfmE1-1QIYGzCLKpqRlLPcvnfbnYKjuTw_n8_0n86BhxUegC
 a75f1BH4-sKpi59Nvc>
X-ME-Received: <xmr:7XXwZMiq6UG7T_s68adD8gR10ra2u-ONTiOms00vNYHHPDD2Xw71Nb9rfu5GdHY>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudegtddgfeejucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi
 thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth
 htvghrnhephfeutdekveeggeetteekfeejffegudduudfhueevleeftdffffeggeeivddv
 jeelnecuffhomhgrihhnpehgnhhurdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenuc
 frrghrrghmpehmrghilhhfrhhomhepughmihhtrhihsehguhhtohhvrdguvghv
X-ME-Proxy: <xmx:7XXwZE_TMCUpEzxAstwSILUcc4Ri3g8EzHEIoRx4T_zt543tXbYNvg>
 <xmx:7XXwZPu2uj7j4cl1EqK8z6v3McOQsHM6Q4LKiE9CJ-lqCGY-B9vbbA>
 <xmx:7XXwZDEHMFCvv3AEQPbV8jF4L4SCPieFNzOqpu4hRoIydLqJqXbSQw>
 <xmx:7XXwZI6IySGNnVky-ypbeYocZnK2fnbxck3TRZV7kKJvjf6-fCpmCg>
Feedback-ID: i0e71465a:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu,
 31 Aug 2023 07:13:48 -0400 (EDT)
Message-ID: <d2b7993b-73a8-6e66-94ae-da8f4fc42ffd@HIDDEN>
Date: Thu, 31 Aug 2023 14:13:46 +0300
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#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
Content-Language: en-US
To: Juri Linkov <juri@HIDDEN>
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <482a1ebc-165c-a0a4-98c0-5c404d1b1d0d@HIDDEN>
 <86jzwyxnxb.fsf@HIDDEN>
 <feead847-869a-86a8-d62d-065871024a74@HIDDEN>
 <86o7m91z22.fsf@HIDDEN> <86pm6py6k4.fsf@HIDDEN>
 <86bki9y68h.fsf@HIDDEN> <86cz2f7bvo.fsf@HIDDEN>
 <e698de3a-dec8-424a-21ff-dcb5bd22c8d4@HIDDEN>
 <86353axu48.fsf@HIDDEN> <87o7jfi00b.fsf@HIDDEN>
 <ier7cplhnky.fsf@HIDDEN> <86msyhwrrg.fsf@HIDDEN>
 <ef5bd8eb-40f9-663d-9a13-f59f9745652e@HIDDEN>
 <86y1hs4kkg.fsf@HIDDEN>
 <c239b9eb-f12f-07e7-ded6-df93c6724c88@HIDDEN>
 <86h6of66o3.fsf@HIDDEN>
From: Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <86h6of66o3.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -1.7 (-)
X-Debbugs-Envelope-To: 63648
Cc: Spencer Baugh <sbaugh@HIDDEN>, 63648 <at> debbugs.gnu.org,
 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: -2.7 (--)

On 31/08/2023 09:47, Juri Linkov wrote:
>> I've tried the patch a little bit, some more impressions:
>>
>> - Unfortunately, using default-directory instead of the specialized
>>    variable which we added lately (project-current-directory-override)
>>    brings back the bug it was added for: https://debbugs.gnu.org/58784. The
>>    switch to a different design didn't fix the problem of the temporary
>>    binding for d-d in the buffer which is current when the command is
>>    executed. So adding the next-default-directory variable might not be the
>>    best idea after all. But the advice thingy can set a binding for any
>>    variable, including the *-override one.
> 
> I didn't test yet the cases from bug#58784.  So this might require more changes.

We tried to make the default-directory binding work with a couple of 
different changes - it didn't work out.

>> - I also managed to get into some transient state where some chars were
>>    doing one thing (their usual bindings), and some - invoked project
>>    commands instead, with no apparent method of quitting that state. Maybe
>>    I'll document it next time I see it.
> 
> It would be nice to have a reproducible test case.
> But indeed chars in the project map invoke the project commands,
> and all other chars fall back to local/global keybindings.
> 
>> - Using (project--keymap-prompt) for just a message call is cute, but
>>    I personally like the "guardrails": if I accidentally type a wrong char
>>    when choosing the command, I won't have to choose the other project
>>    again. This is debatable, but both modes of operation are probably worth
>>    keeping available (opinions welcome).
> 
> This is easy to do with something like in 'y-or-n-p-map'.

With setting that (or similar) keymap as a transient keymap?

>> - Either way, with method with the advice should be useful for other
>>    things, like project--other-place-command.
> 
> It's not recommended to use advice in the core packages,
> maybe only for providing backward-compatibility with older versions.

Sure, but it should also be permissible when there is no other way to do 
a thing.

OTOH, if we're talking about new features in core, we could have a 
next-command-variables-alist, where we'd bind any variables that we 
would want.

A general question regarding this approach, for me, is: is a "prefix 
command" a real command? And would they "swallow" these prepared 
variable bindings too early?




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

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


Received: (at 63648) by debbugs.gnu.org; 31 Aug 2023 07:03:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Aug 31 03:03:31 2023
Received: from localhost ([127.0.0.1]:54742 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qbbiF-0004oq-0K
	for submit <at> debbugs.gnu.org; Thu, 31 Aug 2023 03:03:31 -0400
Received: from relay9-d.mail.gandi.net ([2001:4b98:dc4:8::229]:47277)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1qbbi7-0004o7-0a
 for 63648 <at> debbugs.gnu.org; Thu, 31 Aug 2023 03:03:25 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id 7FF56FF805;
 Thu, 31 Aug 2023 07:03:06 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Dmitry Gutov <dmitry@HIDDEN>
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
In-Reply-To: <c239b9eb-f12f-07e7-ded6-df93c6724c88@HIDDEN> (Dmitry Gutov's
 message of "Thu, 31 Aug 2023 05:01:41 +0300")
Organization: LINKOV.NET
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <482a1ebc-165c-a0a4-98c0-5c404d1b1d0d@HIDDEN>
 <86jzwyxnxb.fsf@HIDDEN>
 <feead847-869a-86a8-d62d-065871024a74@HIDDEN>
 <86o7m91z22.fsf@HIDDEN> <86pm6py6k4.fsf@HIDDEN>
 <86bki9y68h.fsf@HIDDEN> <86cz2f7bvo.fsf@HIDDEN>
 <e698de3a-dec8-424a-21ff-dcb5bd22c8d4@HIDDEN>
 <86353axu48.fsf@HIDDEN> <87o7jfi00b.fsf@HIDDEN>
 <ier7cplhnky.fsf@HIDDEN> <86msyhwrrg.fsf@HIDDEN>
 <ef5bd8eb-40f9-663d-9a13-f59f9745652e@HIDDEN>
 <86y1hs4kkg.fsf@HIDDEN>
 <c239b9eb-f12f-07e7-ded6-df93c6724c88@HIDDEN>
Date: Thu, 31 Aug 2023 09:47:00 +0300
Message-ID: <86h6of66o3.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: 63648
Cc: Spencer Baugh <sbaugh@HIDDEN>, 63648 <at> debbugs.gnu.org,
 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 (-)

> I've tried the patch a little bit, some more impressions:
>
> - Unfortunately, using default-directory instead of the specialized
>   variable which we added lately (project-current-directory-override)
>   brings back the bug it was added for: https://debbugs.gnu.org/58784. The
>   switch to a different design didn't fix the problem of the temporary
>   binding for d-d in the buffer which is current when the command is
>   executed. So adding the next-default-directory variable might not be the
>   best idea after all. But the advice thingy can set a binding for any
>   variable, including the *-override one.

I didn't test yet the cases from bug#58784.  So this might require more changes.

> - I also managed to get into some transient state where some chars were
>   doing one thing (their usual bindings), and some - invoked project
>   commands instead, with no apparent method of quitting that state. Maybe
>   I'll document it next time I see it.

It would be nice to have a reproducible test case.
But indeed chars in the project map invoke the project commands,
and all other chars fall back to local/global keybindings.

> - Using (project--keymap-prompt) for just a message call is cute, but
>   I personally like the "guardrails": if I accidentally type a wrong char
>   when choosing the command, I won't have to choose the other project
>   again. This is debatable, but both modes of operation are probably worth
>   keeping available (opinions welcome).

This is easy to do with something like in 'y-or-n-p-map'.

> - Either way, with method with the advice should be useful for other
>   things, like project--other-place-command.

It's not recommended to use advice in the core packages,
maybe only for providing backward-compatibility with older versions.




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

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


Received: (at 63648) by debbugs.gnu.org; 31 Aug 2023 02:02:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Aug 30 22:02:05 2023
Received: from localhost ([127.0.0.1]:54378 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qbX0X-00054X-5i
	for submit <at> debbugs.gnu.org; Wed, 30 Aug 2023 22:02:05 -0400
Received: from out3-smtp.messagingengine.com ([66.111.4.27]:58147)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dmitry@HIDDEN>) id 1qbX0R-00053w-S2
 for 63648 <at> debbugs.gnu.org; Wed, 30 Aug 2023 22:02:03 -0400
Received: from compute3.internal (compute3.nyi.internal [10.202.2.43])
 by mailout.nyi.internal (Postfix) with ESMTP id 9D2425C003B;
 Wed, 30 Aug 2023 22:01:46 -0400 (EDT)
Received: from mailfrontend1 ([10.202.2.162])
 by compute3.internal (MEProxy); Wed, 30 Aug 2023 22:01:46 -0400
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=
 1693447306; x=1693533706; bh=LMAy9m4bVQN++W5kpwPZP0oENMLV2Rab0HI
 pzOWh0/A=; b=m1TQ2hUCB+W3Ne8QiyA4n7canumJl0vm8QnqgGSQv7Gvf29iMfN
 yRdFM3HX2fr4RBdhf3Q8n2bEqqnHetWZtPv/cH1LTxP3J12U4ux2bsQlxocrQu4/
 BXZIibkrTuOEkO6XabdTUHrrpQg8jlb0OyeQ2xhdYriqWrkpq4G3Emo57EYhDwiZ
 H54AyhmkyzZRCl0ZLA9HohdtPgOlGwSPVfFGZ1tac5KS8g7QARfOxeWoBfjiHc9a
 yIHn3ZVQXfiVDeAfQfv1i55hY/3PZ9Su10NyeyvBezcOCivn2he8MVH5BEh1aVfg
 xdy/M1wfynUd/FN6y8t61QYbVwfZt2Y2IcQ==
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=
 1693447306; x=1693533706; bh=LMAy9m4bVQN++W5kpwPZP0oENMLV2Rab0HI
 pzOWh0/A=; b=wfdh3BZviV0hBZe2bq6aXU2JPa6GqsXnzqxXv4S5AAz//Ewgyhl
 uyl/JezQs/C3IKWumt5kifHmXQUQxlnUC2ANimWsTcZuy+C3uLLv5kfJrrmSCLUv
 /7sVebByX1jhfOVNIWCjHILDYepg6BXHkmNUdRRo/G5bBU2aB1zggEE3swJBpncs
 HaZGSWVmgSCCc80geTPhOiRDeSaLcJkFFMpOBE048Wvr+e/iGZs6SG0/Epa6ZFpU
 mlu+IOT3Qte4BKsel4xvZFiRDbDFP3b3oxjYQDDZfakzaq0LiAt0Tcz5wAHuuUgc
 KUEjMwscYpJXi3aUOQutt8lnnbXl5S7AV3Q==
X-ME-Sender: <xms:ivTvZIVdXrHWVqAqqG9olF7VFoWx3vbGF6jT_nMIby8hX9O7h64YkA>
 <xme:ivTvZMlrxSEmVuuXonHgfZNgZxzxwbqbv2gF_blyxIHW6PgOGymZ7c4Bf3wDZTDC_
 lK0rSptnyIlPmMERn4>
X-ME-Received: <xmr:ivTvZMbSkWIQa7tv0e4qj_vAq5gZmjx2Eg-Phl4EIrXIe6Ke93mUl6lGpjb09t4>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudefledghedvucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi
 thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth
 htvghrnhephfeutdekveeggeetteekfeejffegudduudfhueevleeftdffffeggeeivddv
 jeelnecuffhomhgrihhnpehgnhhurdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenuc
 frrghrrghmpehmrghilhhfrhhomhepughmihhtrhihsehguhhtohhvrdguvghv
X-ME-Proxy: <xmx:ivTvZHUO4EL_JLr8sQqrHdc1m7eiXsPfgTu4pcKHDDG8E0xW-A7Tkg>
 <xmx:ivTvZCkKg8wyGlCifMOnYWMYQB6wiaZSF3kaKoOek-Kp_bIQ2dukgA>
 <xmx:ivTvZMfFnjuojICwtXP9X1LVdRBLp1u3O-Cz7TMqsOiyDQX8Fileow>
 <xmx:ivTvZHzT62sU9_QdP5OgNnXHZvWFdMy8YhLtOirAc1rMDovA-TrL2A>
Feedback-ID: i0e71465a:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed,
 30 Aug 2023 22:01:45 -0400 (EDT)
Message-ID: <c239b9eb-f12f-07e7-ded6-df93c6724c88@HIDDEN>
Date: Thu, 31 Aug 2023 05:01:41 +0300
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#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
Content-Language: en-US
To: Juri Linkov <juri@HIDDEN>
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <482a1ebc-165c-a0a4-98c0-5c404d1b1d0d@HIDDEN>
 <86jzwyxnxb.fsf@HIDDEN>
 <feead847-869a-86a8-d62d-065871024a74@HIDDEN>
 <86o7m91z22.fsf@HIDDEN> <86pm6py6k4.fsf@HIDDEN>
 <86bki9y68h.fsf@HIDDEN> <86cz2f7bvo.fsf@HIDDEN>
 <e698de3a-dec8-424a-21ff-dcb5bd22c8d4@HIDDEN>
 <86353axu48.fsf@HIDDEN> <87o7jfi00b.fsf@HIDDEN>
 <ier7cplhnky.fsf@HIDDEN> <86msyhwrrg.fsf@HIDDEN>
 <ef5bd8eb-40f9-663d-9a13-f59f9745652e@HIDDEN>
 <86y1hs4kkg.fsf@HIDDEN>
From: Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <86y1hs4kkg.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -1.7 (-)
X-Debbugs-Envelope-To: 63648
Cc: Spencer Baugh <sbaugh@HIDDEN>, 63648 <at> debbugs.gnu.org,
 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: -2.7 (--)

On 30/08/2023 19:27, Juri Linkov wrote:
>>> There is no code where to bind a dynamic variable, because its value
>>> should be available for the next command in the command loop.
>>> If you agree there is no other way to implement this than next-default-directory,
>>> then I could bring up the discussion on emacs-devel.
>> Before we dive into all that, why not try advice on 'command-execute'? For
>> the PoC code at least. It's in Lisp since 2013.
> Thanks for bringing up 'command-execute'.  I forgot it was moved from C to Lisp,
> so the change is simpler and not needed to discuss on emacs-devel.  Then advice
> on 'command-execute' will be required to support older Emacs versions in project.el.
> But for Emacs 30 I modified my previous patch, and the next version is below:
> 
>> The comment in its body does say "Called directly from the C code", but I'm
>> not sure if that has any direct implications for us.
> Also interesting how 'command-execute' handles 'debug-on-next-call'
> similar to 'next-default-directory'.

I've tried the patch a little bit, some more impressions:

- Unfortunately, using default-directory instead of the specialized 
variable which we added lately (project-current-directory-override) 
brings back the bug it was added for: https://debbugs.gnu.org/58784. The 
switch to a different design didn't fix the problem of the temporary 
binding for d-d in the buffer which is current when the command is 
executed. So adding the next-default-directory variable might not be the 
best idea after all. But the advice thingy can set a binding for any 
variable, including the *-override one.

- I also managed to get into some transient state where some chars were 
doing one thing (their usual bindings), and some - invoked project 
commands instead, with no apparent method of quitting that state. Maybe 
I'll document it next time I see it.

- Using (project--keymap-prompt) for just a message call is cute, but I 
personally like the "guardrails": if I accidentally type a wrong char 
when choosing the command, I won't have to choose the other project 
again. This is debatable, but both modes of operation are probably worth 
keeping available (opinions welcome).

- Either way, with method with the advice should be useful for other 
things, like project--other-place-command.




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

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


Received: (at 63648) by debbugs.gnu.org; 30 Aug 2023 16:40:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Aug 30 12:40:50 2023
Received: from localhost ([127.0.0.1]:53854 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qbOFN-0007Uh-KP
	for submit <at> debbugs.gnu.org; Wed, 30 Aug 2023 12:40:50 -0400
Received: from relay6-d.mail.gandi.net ([2001:4b98:dc4:8::226]:36099)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1qbOFL-0007UQ-BC
 for 63648 <at> debbugs.gnu.org; Wed, 30 Aug 2023 12:40:48 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id CBBEDC000A;
 Wed, 30 Aug 2023 16:40:29 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Dmitry Gutov <dmitry@HIDDEN>
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
In-Reply-To: <ef5bd8eb-40f9-663d-9a13-f59f9745652e@HIDDEN> (Dmitry Gutov's
 message of "Tue, 29 Aug 2023 23:40:19 +0300")
Organization: LINKOV.NET
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <482a1ebc-165c-a0a4-98c0-5c404d1b1d0d@HIDDEN>
 <86jzwyxnxb.fsf@HIDDEN>
 <feead847-869a-86a8-d62d-065871024a74@HIDDEN>
 <86o7m91z22.fsf@HIDDEN> <86pm6py6k4.fsf@HIDDEN>
 <86bki9y68h.fsf@HIDDEN> <86cz2f7bvo.fsf@HIDDEN>
 <e698de3a-dec8-424a-21ff-dcb5bd22c8d4@HIDDEN>
 <86353axu48.fsf@HIDDEN> <87o7jfi00b.fsf@HIDDEN>
 <ier7cplhnky.fsf@HIDDEN> <86msyhwrrg.fsf@HIDDEN>
 <ef5bd8eb-40f9-663d-9a13-f59f9745652e@HIDDEN>
Date: Wed, 30 Aug 2023 19:27:27 +0300
Message-ID: <86y1hs4kkg.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: multipart/mixed; boundary="=-=-="
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 63648
Cc: Spencer Baugh <sbaugh@HIDDEN>, 63648 <at> debbugs.gnu.org,
 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 (-)

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

>> There is no code where to bind a dynamic variable, because its value
>> should be available for the next command in the command loop.
>> If you agree there is no other way to implement this than next-default-directory,
>> then I could bring up the discussion on emacs-devel.
>
> Before we dive into all that, why not try advice on 'command-execute'? For
> the PoC code at least. It's in Lisp since 2013.

Thanks for bringing up 'command-execute'.  I forgot it was moved from C to Lisp,
so the change is simpler and not needed to discuss on emacs-devel.  Then advice
on 'command-execute' will be required to support older Emacs versions in project.el.
But for Emacs 30 I modified my previous patch, and the next version is below:

> The comment in its body does say "Called directly from the C code", but I'm
> not sure if that has any direct implications for us.

Also interesting how 'command-execute' handles 'debug-on-next-call'
similar to 'next-default-directory'.


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline; filename=next-default-directory.patch

diff --git a/lisp/simple.el b/lisp/simple.el
index 05a3c4b93d6..ff665111a5d 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2752,6 +2752,9 @@ oclosure-interactive-form
   (let ((if (cconv--interactive-helper--if f)))
     `(interactive ,(if (functionp if) `(funcall ',if) if))))
 
+(defvar next-default-directory nil
+  "Default directory for the next command.")
+
 (defun command-execute (cmd &optional record-flag keys special)
   ;; BEWARE: Called directly from the C code.
   "Execute CMD as an editor command.
@@ -2803,7 +2806,11 @@ command-execute
           (execute-kbd-macro final prefixarg))
          (t
           ;; Pass `cmd' rather than `final', for the backtrace's sake.
-          (prog1 (call-interactively cmd record-flag keys)
+          (prog1 (if next-default-directory
+                     (let ((default-directory next-default-directory))
+                       (prog1 (call-interactively cmd record-flag keys)
+                         (setq next-default-directory nil)))
+                   (call-interactively cmd record-flag keys))
             (when-let ((info
                         (and (symbolp cmd)
                              (not (get cmd 'command-execute-obsolete-warned))
diff --git a/lisp/window.el b/lisp/window.el
index b9b032c33e9..006531ab017 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -9122,7 +9114,8 @@ display-buffer-override-next-command
 		     (> (minibuffer-depth) minibuffer-depth)
 		     ;; But don't remove immediately after
 		     ;; adding the hook by the same command below.
-		     (eq this-command command))
+		     (eq this-command command)
+		     (eq this-command 'project-switch-project))
               (funcall exitfun))))
     ;; Call post-function after the next command finishes (bug#49057).
     (add-hook 'post-command-hook postfun)
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 7aaf7a9f9fb..f87bb750e23 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -193,9 +193,10 @@ project-find-functions
   'project-current-directory-override
   "29.1")
 
-(defvar project-current-directory-override nil
-  "Value to use instead of `default-directory' when detecting the project.
-When it is non-nil, `project-current' will always skip prompting too.")
+(define-obsolete-variable-alias
+  'project-current-directory-override
+  'next-default-directory
+  "30.1")
 
 (defcustom project-prompter #'project-prompt-project-dir
   "Function to call to prompt for a project.
@@ -227,12 +228,11 @@ project-current
 
 See the doc string of `project-find-functions' for the general form
 of the project instance object."
-  (unless directory (setq directory (or project-current-directory-override
-                                        default-directory)))
+  (unless directory (setq directory default-directory))
   (let ((pr (project--find-in-directory directory)))
     (cond
      (pr)
-     ((unless project-current-directory-override
+     ((unless next-default-directory
         maybe-prompt)
       (setq directory (funcall project-prompter)
             pr (project--find-in-directory directory))))
@@ -846,8 +846,8 @@ project-prefix-map
 
 ;;;###autoload (define-key ctl-x-map "p" project-prefix-map)
 
-;; We can't have these place-specific maps inherit from
-;; project-prefix-map because project--other-place-command needs to
+;; Maybe we can have these place-specific maps inherit from
+;; project-prefix-map because set-transient-map maybe needs to
 ;; know which map the key binding came from, as if it came from one of
 ;; these maps, we don't want to set display-buffer-overriding-action
 
@@ -863,16 +863,6 @@ project-other-frame-map
     map)
   "Keymap for project commands that display buffers in other frames.")
 
-(defun project--other-place-command (action &optional map)
-  (let* ((key (read-key-sequence-vector nil t))
-         (place-cmd (lookup-key map key))
-         (generic-cmd (lookup-key project-prefix-map key))
-         (switch-to-buffer-obey-display-actions t)
-         (display-buffer-overriding-action (unless place-cmd action)))
-    (if-let ((cmd (or place-cmd generic-cmd)))
-        (call-interactively cmd)
-      (user-error "%s is undefined" (key-description key)))))
-
 ;;;###autoload
 (defun project-other-window-command ()
   "Run project command, displaying resultant buffer in another window.
@@ -882,9 +872,10 @@ project-other-window-command
 \\{project-prefix-map}
 \\{project-other-window-map}"
   (interactive)
-  (project--other-place-command '((display-buffer-pop-up-window)
-                                  (inhibit-same-window . t))
-                                project-other-window-map))
+  (let ((inhibit-message t)) (other-window-prefix))
+  (message "Display next project command buffer in a new window...")
+  (set-transient-map (make-composed-keymap project-prefix-map
+                                           project-other-window-map)))
 
 ;;;###autoload (define-key ctl-x-4-map "p" #'project-other-window-command)
 
@@ -897,8 +888,10 @@ project-other-frame-command
 \\{project-prefix-map}
 \\{project-other-frame-map}"
   (interactive)
-  (project--other-place-command '((display-buffer-pop-up-frame))
-                                project-other-frame-map))
+  (let ((inhibit-message t)) (other-frame-prefix))
+  (message "Display next project command buffer in a new frame...")
+  (set-transient-map (make-composed-keymap project-prefix-map
+                                           project-other-frame-map)))
 
 ;;;###autoload (define-key ctl-x-5-map "p" #'project-other-frame-command)
 
@@ -910,7 +903,9 @@ project-other-tab-command
 
 \\{project-prefix-map}"
   (interactive)
-  (project--other-place-command '((display-buffer-in-new-tab))))
+  (let ((inhibit-message t)) (other-tab-prefix))
+  (message "Display next project command buffer in a new tab...")
+  (set-transient-map project-prefix-map))
 
 ;;;###autoload
 (when (bound-and-true-p tab-prefix-map)
@@ -993,13 +988,13 @@ project--find-default-from
   "Ensure FILENAME is in PROJECT.
 
 Usually, just return FILENAME.  But if
-`project-current-directory-override' is set, adjust it to be
+`next-default-directory' is set, adjust it to be
 relative to PROJECT instead.
 
 This supports using a relative file name from the current buffer
 when switching projects with `project-switch-project' and then
 using a command like `project-find-file'."
-  (if-let (filename-proj (and project-current-directory-override
+  (if-let (filename-proj (and next-default-directory
                             (project-current nil default-directory)))
       ;; file-name-concat requires Emacs 28+
       (concat (file-name-as-directory (project-root project))
@@ -1893,16 +1888,17 @@ project-switch-commands
                     (character :tag "Explicit key"))))
           (symbol :tag "Single command")))
 
-(defcustom project-switch-use-entire-map nil
-  "Whether `project-switch-project' will use the entire `project-prefix-map'.
-If nil, `project-switch-project' will only recognize commands
-listed in `project-switch-commands', and will signal an error
-when other commands are invoked.  If this is non-nil, all the
-keys in `project-prefix-map' are valid even if they aren't
-listed in the dispatch menu produced from `project-switch-commands'."
-  :type 'boolean
-  :group 'project
-  :version "28.1")
+;; OBSOLETE?
+;; (defcustom project-switch-use-entire-map nil
+;;   "Whether `project-switch-project' will use the entire `project-prefix-map'.
+;; If nil, `project-switch-project' will only recognize commands
+;; listed in `project-switch-commands', and will signal an error
+;; when other commands are invoked.  If this is non-nil, all the
+;; keys in `project-prefix-map' are valid even if they aren't
+;; listed in the dispatch menu produced from `project-switch-commands'."
+;;   :type 'boolean
+;;   :group 'project
+;;   :version "28.1")
 
 (defcustom project-key-prompt-style (if (facep 'help-key-binding)
                                         t
@@ -1938,39 +1934,6 @@ project--keymap-prompt
    project-switch-commands
    "  "))
 
-(defun project--switch-project-command ()
-  (let* ((commands-menu
-          (mapcar
-           (lambda (row)
-             (if (characterp (car row))
-                 ;; Deprecated format.
-                 ;; XXX: Add a warning about it?
-                 (reverse row)
-               row))
-           project-switch-commands))
-         (commands-map
-          (let ((temp-map (make-sparse-keymap)))
-            (set-keymap-parent temp-map project-prefix-map)
-            (dolist (row commands-menu temp-map)
-              (when-let ((cmd (nth 0 row))
-                         (keychar (nth 2 row)))
-                (define-key temp-map (vector keychar) cmd)))))
-         command)
-    (while (not command)
-      (let* ((overriding-local-map commands-map)
-             (choice (read-key-sequence (project--keymap-prompt))))
-        (when (setq command (lookup-key commands-map choice))
-          (unless (or project-switch-use-entire-map
-                      (assq command commands-menu))
-            ;; TODO: Add some hint to the prompt, like "key not
-            ;; recognized" or something.
-            (setq command nil)))
-        (let ((global-command (lookup-key (current-global-map) choice)))
-          (when (memq global-command
-                      '(keyboard-quit keyboard-escape-quit))
-            (call-interactively global-command)))))
-    command))
-
 ;;;###autoload
 (defun project-switch-project (dir)
   "\"Switch\" to another project by running an Emacs command.
@@ -1980,11 +1943,18 @@ project-switch-project
 When called in a program, it will use the project corresponding
 to directory DIR."
   (interactive (list (funcall project-prompter)))
-  (let ((command (if (symbolp project-switch-commands)
-                     project-switch-commands
-                   (project--switch-project-command))))
-    (let ((project-current-directory-override dir))
-      (call-interactively command))))
+  (if (symbolp project-switch-commands)
+      (let ((default-directory dir))
+        (call-interactively project-switch-commands))
+    (let* ((echofun (lambda () "[switch-project]"))
+           (postfun (lambda () (remove-hook
+                                'prefix-command-echo-keystrokes-functions
+                                echofun))))
+      (setq next-default-directory dir)
+      (message (project--keymap-prompt))
+      (add-hook 'prefix-command-echo-keystrokes-functions echofun)
+      (prefix-command-preserve-state)
+      (set-transient-map project-prefix-map nil postfun))))
 
 ;;;###autoload
 (defun project-uniquify-dirname-transform (dirname)
diff --git a/test/lisp/progmodes/project-tests.el b/test/lisp/progmodes/project-tests.el
index 5a206b67db1..bc8c0553f40 100644
--- a/test/lisp/progmodes/project-tests.el
+++ b/test/lisp/progmodes/project-tests.el
@@ -41,7 +41,7 @@ project/quoted-directory
   (skip-unless (executable-find "grep"))
   (ert-with-temp-directory directory
     (let ((default-directory directory)
-          (project-current-directory-override t)
+          (next-default-directory directory)
           (project-find-functions nil)
           (project-list-file
            (expand-file-name "projects" directory))

--=-=-=--




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

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


Received: (at 63648) by debbugs.gnu.org; 29 Aug 2023 22:33:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Aug 29 18:33:05 2023
Received: from localhost ([127.0.0.1]:51766 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qb7Gi-00022r-MH
	for submit <at> debbugs.gnu.org; Tue, 29 Aug 2023 18:33:04 -0400
Received: from wout3-smtp.messagingengine.com ([64.147.123.19]:33127)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dmitry@HIDDEN>) id 1qb7Gd-00022J-HB
 for 63648 <at> debbugs.gnu.org; Tue, 29 Aug 2023 18:33:03 -0400
Received: from compute2.internal (compute2.nyi.internal [10.202.2.46])
 by mailout.west.internal (Postfix) with ESMTP id ED7BB3200258;
 Tue, 29 Aug 2023 18:32:45 -0400 (EDT)
Received: from mailfrontend1 ([10.202.2.162])
 by compute2.internal (MEProxy); Tue, 29 Aug 2023 18:32:46 -0400
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=
 1693348365; x=1693434765; bh=RC9Q5gpk+3UGBt6i93hLr5jSgLJoEUdIS2j
 tNHePHh0=; b=Ez6nteh7gzuhlC4fQBil9Oagh/xcumWTQnTYb5bzRtlBXWNyRFq
 i8V82Nt4QUObKgczqDs9doGteIWxwEwzdjoa3g3JoYrLCzlN40Uwq1nNsKogsDR8
 x9iw0PihD9YdxRrGpZkPgmbcuixbiVJksrar+tooShaHPRel2+OdDlGxW0J0m82V
 MXMrH6QFUBFclvXACVsVdUY5ejRN9D9NRT+/ofOkeoeS/FuoGFGb0hk30+x6Nh2q
 AfcRFTT+vSFTz9PqHFepcxcaDhlbFfyZO9uUTi2jp7JvEXHXz265ExFocyLsd0g0
 wjuKQhhByaXI/316icN6zpZwL0BR4+jrxlQ==
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=
 1693348365; x=1693434765; bh=RC9Q5gpk+3UGBt6i93hLr5jSgLJoEUdIS2j
 tNHePHh0=; b=C1lXNPRQZs3o4KzH36hMkmlH9Ymah0cfq539PJvdbK498Gs7HB/
 C70cnm23sMj648fSiivw5zumfz6KHWyexurOgLWbhC4yxuCeX1NU0rTfC8hpE/8W
 Ge/LE0b2iSslhXshFlRs7NoQQlKYbt+BZ1BPfKXu95RBDfBZHabVDRcP3Ag04CLU
 iQBQOukRTv+rd4uBtrgE14tM1IOK7dcxJe+Oz233+vzD8Tzh73cJSY6v9Nq+7T5l
 4YfxSwweITXpKm2eaAq2G2Bjt3t1X9VKNR9Bp1hh1OBlceZA35AUx0sfRLjCH1Gf
 jtT0Iu/a6lBBz9K9FvKSWQuK9PD4jLi08WQ==
X-ME-Sender: <xms:DXLuZOzI_4POWC9ZNEK5Q39O4niv66zdd3e--rhwpupwHeUOI_4iDw>
 <xme:DXLuZKSw8ivdZi0avNyng7r5YEUxlGhAjiamxEuHHGL_8ravP3NqH1IRmMAPGzzk6
 -I3QkF0xOh3QK4KBwE>
X-ME-Received: <xmr:DXLuZAXmmMfW48YPG3nTZLHDxnoG3CkgD_U0Ps_L2os539xSrfPmMTtavHmDSYo>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudefjedgtdelucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi
 thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth
 htvghrnhepiefgteevheevveffheeltdeukeeiieekueefgedugfefgefhudelgfefveel
 vdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug
 hmihhtrhihsehguhhtohhvrdguvghv
X-ME-Proxy: <xmx:DXLuZEjaQQL-NoJbfono9mslyShFd5AHbNld1ZriCG17ygFrIGbArA>
 <xmx:DXLuZABlygaLkmm8hISH3PReaTfkm_jysieoZ9RvZGfGnr-UeVi1LA>
 <xmx:DXLuZFKd0VeSSXUDxYLIl5pc2izU3h6wgSRGymCRuEMXK9fwH0sDtA>
 <xmx:DXLuZDMSnerJVJlNGhxQAuc1E0zOFAZhYnM2CSHEFTWniedZEALznQ>
Feedback-ID: i0e71465a:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue,
 29 Aug 2023 18:32:44 -0400 (EDT)
Message-ID: <1e2d9a65-16bb-3f2f-dfbc-5e043f93b78e@HIDDEN>
Date: Wed, 30 Aug 2023 01:32:42 +0300
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#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
Content-Language: en-US
To: Spencer Baugh <sbaugh@HIDDEN>
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <482a1ebc-165c-a0a4-98c0-5c404d1b1d0d@HIDDEN>
 <86jzwyxnxb.fsf@HIDDEN>
 <feead847-869a-86a8-d62d-065871024a74@HIDDEN>
 <86o7m91z22.fsf@HIDDEN> <86pm6py6k4.fsf@HIDDEN>
 <86bki9y68h.fsf@HIDDEN> <86cz2f7bvo.fsf@HIDDEN>
 <e698de3a-dec8-424a-21ff-dcb5bd22c8d4@HIDDEN>
 <86353axu48.fsf@HIDDEN> <87o7jfi00b.fsf@HIDDEN>
 <ier7cplhnky.fsf@HIDDEN> <86msyhwrrg.fsf@HIDDEN>
 <ef5bd8eb-40f9-663d-9a13-f59f9745652e@HIDDEN>
 <ieril8xv7vd.fsf@HIDDEN>
From: Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <ieril8xv7vd.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -1.7 (-)
X-Debbugs-Envelope-To: 63648
Cc: sbaugh@HIDDEN, 63648 <at> debbugs.gnu.org, 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: -2.7 (--)

On 30/08/2023 00:47, Spencer Baugh wrote:
> Nice!
> 
> One thing at least to make it not quite so bare-bones is:
> 
> (defun project-switch-project (dir)
>    (interactive (list (funcall project-prompter)))
>    (setq project--next-dd dir)
>    (advice-add 'command-execute :around #'project--with-next-dd)
>    (message "Run next command in project %s..." (project-name (project-current nil dir))))
> 
> which matches other-window-prefix.

Definitely an improvement, but still -- any such message is likely soon 
overridden by the prefix echo (e.g. "C-x p-").

> Will try running with this for a while and see how it goes.  (I'm
> already missing the short form of project-find-files, but maybe I'll get
> used to it... or maybe we should remap C-x C-f to project-find-files
> while in this prefix, or something wacky like that)

It could also use set-transient-map to set up a given map (e.g. one with 
the fast keys), and for the rest fall back to global commands. Note that 
our current project-switch-project impl could also be augmented to do that.

Anyway, please test it out and see how you like it, and whatever 
improvements come to mind. In either case, we can add a new command 
(rather than replacing project-switch-project). E.g. call it 
project-switch-for-next-command.




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

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


Received: (at 63648) by debbugs.gnu.org; 29 Aug 2023 21:47:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Aug 29 17:47:40 2023
Received: from localhost ([127.0.0.1]:51742 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qb6Yi-0000tL-VV
	for submit <at> debbugs.gnu.org; Tue, 29 Aug 2023 17:47:40 -0400
Received: from mxout5.mail.janestreet.com ([64.215.233.18]:51841)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <sbaugh@HIDDEN>) id 1qb6Yd-0000t0-PQ
 for 63648 <at> debbugs.gnu.org; Tue, 29 Aug 2023 17:47:35 -0400
From: Spencer Baugh <sbaugh@HIDDEN>
To: Dmitry Gutov <dmitry@HIDDEN>
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
In-Reply-To: <ef5bd8eb-40f9-663d-9a13-f59f9745652e@HIDDEN> (Dmitry Gutov's
 message of "Tue, 29 Aug 2023 23:40:19 +0300")
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <482a1ebc-165c-a0a4-98c0-5c404d1b1d0d@HIDDEN>
 <86jzwyxnxb.fsf@HIDDEN>
 <feead847-869a-86a8-d62d-065871024a74@HIDDEN>
 <86o7m91z22.fsf@HIDDEN> <86pm6py6k4.fsf@HIDDEN>
 <86bki9y68h.fsf@HIDDEN> <86cz2f7bvo.fsf@HIDDEN>
 <e698de3a-dec8-424a-21ff-dcb5bd22c8d4@HIDDEN>
 <86353axu48.fsf@HIDDEN> <87o7jfi00b.fsf@HIDDEN>
 <ier7cplhnky.fsf@HIDDEN> <86msyhwrrg.fsf@HIDDEN>
 <ef5bd8eb-40f9-663d-9a13-f59f9745652e@HIDDEN>
Date: Tue, 29 Aug 2023 17:47:18 -0400
Message-ID: <ieril8xv7vd.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: 63648
Cc: sbaugh@HIDDEN, 63648 <at> debbugs.gnu.org, 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: -1.0 (-)

Dmitry Gutov <dmitry@HIDDEN> writes:

> Sorry for the possible duplicate, but it seems this message didn't
> reach the bug tracker, or other recipients. Resending contents below.
>
> On 23/08/2023 20:54, Juri Linkov wrote:
>> There is no code where to bind a dynamic variable, because its value
>> should be available for the next command in the command loop.
>> If you agree there is no other way to implement this than next-default-directory,
>> then I could bring up the discussion on emacs-devel.
>
> Before we dive into all that, why not try advice on 'command-execute'?
> For the PoC code at least. It's in Lisp since 2013.
>
> The comment in its body does say "Called directly from the C code",
> but I'm not sure if that has any direct implications for us.
>
> This attached piece of code implements the project-switch-project as
> you outlined. Does it work well for you/others? Careful when testing
> or modifying: a typo can break the command loop (and thus the
> session).
>
> To me it seems a little too bare-bones, lacking the instructive hints
> project-switch-project currently has.

Nice!

One thing at least to make it not quite so bare-bones is:

(defun project-switch-project (dir)
  (interactive (list (funcall project-prompter)))
  (setq project--next-dd dir)
  (advice-add 'command-execute :around #'project--with-next-dd)
  (message "Run next command in project %s..." (project-name (project-current nil dir))))

which matches other-window-prefix.

Will try running with this for a while and see how it goes.  (I'm
already missing the short form of project-find-files, but maybe I'll get
used to it... or maybe we should remap C-x C-f to project-find-files
while in this prefix, or something wacky like that)

> (defvar project--next-dd nil)
>
> (defun project--with-next-dd (fun &rest args)
>   (advice-remove 'command-execute #'project--with-next-dd)
>   (let ((default-directory project--next-dd))
>     (apply fun args)))
>
> (defun project-switch-project (dir)
>   (interactive (list (funcall project-prompter)))
>   (setq project--next-dd dir)
>   (advice-add 'command-execute :around #'project--with-next-dd))




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

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


Received: (at 63648) by debbugs.gnu.org; 29 Aug 2023 20:40:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Aug 29 16:40:40 2023
Received: from localhost ([127.0.0.1]:51686 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qb5Vw-0007Rv-9C
	for submit <at> debbugs.gnu.org; Tue, 29 Aug 2023 16:40:40 -0400
Received: from wout3-smtp.messagingengine.com ([64.147.123.19]:58489)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dmitry@HIDDEN>) id 1qb5Vr-0007Rd-Hm
 for 63648 <at> debbugs.gnu.org; Tue, 29 Aug 2023 16:40:38 -0400
Received: from compute2.internal (compute2.nyi.internal [10.202.2.46])
 by mailout.west.internal (Postfix) with ESMTP id 2F1A83200938;
 Tue, 29 Aug 2023 16:40:22 -0400 (EDT)
Received: from mailfrontend1 ([10.202.2.162])
 by compute2.internal (MEProxy); Tue, 29 Aug 2023 16:40:22 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc
 :cc: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=1693341621; x=1693428021; bh=UR
 ZvWw4loq48ktZl7O81mQO+WfDi8KJJLjVtOb053eA=; b=eB70/u+DltduLMyPEX
 5E75k6uGDJtmdQECqEitn2TkaFHdYjp+3sEQMYifCpPuGn/WSIIlQYRaEKqsIHZu
 CSC8ZfIHXSGPvP2kvhTqIqaqNZQ5jPqC6RaKdvCwcvgsOKKgyIW7azYd/Q7M+0LJ
 SEpGi00tou2YIfWLGyTAmeDKJhAQxmWvc/h9ZOZmFMM2zjQ79t3lkJMnSy4b3T4N
 wr7K/YaGu3zLiFRwfPhMKqzxtVv6ZqtrtYXefRQtRt/4jHBr6zCEDz0zCeq3VqUV
 gDZigBZPLty33LS3QoVQ270A78Emz7FE2IGWmVdG5tCoV5G1t6UUtFRm7w8qGzc3
 xXRA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc: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=1693341621; x=1693428021; bh=URZvWw4loq48k
 tZl7O81mQO+WfDi8KJJLjVtOb053eA=; b=lLZ5m+o6ewdyKnnmpfGQWsmFzS/6B
 /L77OtGi2NZ9O1JV3X7RZLEP0t1SQGZgtVD2P6Xzqvg4XVjymBWSX2Q5YNjMUBkv
 Ot8yK+H3EnESPM77YXrh4gTpeFzXVzk81yrdwmWWUi+UfKbiiAmSr8aveNupeFuJ
 g7AuBf5IG474Pg8bXLomgciIA+tDOVaeaWydX2nMhdRPaZ4fFzcODzab8jDuPJdl
 74TdTc2n1puyQHq0ja3c/m/zakmHaIIVO2b0dFtM+b83sBg/edv91/rXUQiL06Ge
 EoKruSAXbq+WzU7m7AJLWSOHmsDztI2mJZOOuQiXFyPTafnMKxUZbAAxw==
X-ME-Sender: <xms:tVfuZE8L08Wydv0LhT1dNcOQ1RmvUX61F4IEdkHYB7wu9NMi3R-H5w>
 <xme:tVfuZMvmzg3C-JdwxibN9hJkjW9kyVMnihMqW-I4r87OhUs3nFi4Mdp6nGz4QL0lj
 sRHBP_ssRDBTo3sOWw>
X-ME-Received: <xmr:tVfuZKD-9ognIVL-UlBBZxBABpSz3QBSlPgzPQiHLpNSLvjbpyrxAaD27xtfgcE>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudefiedgudehvdcutefuodetggdotefrod
 ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh
 necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd
 enucfjughrpegtkfffgggfhffuvfevfhgjsehmtderredtfeejnecuhfhrohhmpeffmhhi
 thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth
 htvghrnhephfeuieefvdehuddthfejueegfeethffhueetjedtiedvvefgjeefgedtleej
 feefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug
 hmihhtrhihsehguhhtohhvrdguvghv
X-ME-Proxy: <xmx:tVfuZEeWUfrgWonIMfPhzNM48H1zltCJdAG9mepBMQaRzfwFtLg6hA>
 <xmx:tVfuZJOKeDnzESfmpQpUOSkFD4RwMpUfmNEParExx1vkBF43D4lgNw>
 <xmx:tVfuZOmuPX8mEelYgx7yfBQ1N7HEF2xwAeYfPqHTvoj05UNbjIuf6Q>
 <xmx:tVfuZCY3pVcZof4ftd6mNNhnTlB9zFLwCjc2YdBcsPTpDRBfQI1cAw>
Feedback-ID: i0e71465a:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue,
 29 Aug 2023 16:40:20 -0400 (EDT)
Content-Type: multipart/mixed; boundary="------------0UHUOdqSmTCyD0GQ89kCHUbR"
Message-ID: <ef5bd8eb-40f9-663d-9a13-f59f9745652e@HIDDEN>
Date: Tue, 29 Aug 2023 23:40:19 +0300
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.13.0
From: Dmitry Gutov <dmitry@HIDDEN>
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
To: Juri Linkov <juri@HIDDEN>, Spencer Baugh <sbaugh@HIDDEN>
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <482a1ebc-165c-a0a4-98c0-5c404d1b1d0d@HIDDEN>
 <86jzwyxnxb.fsf@HIDDEN>
 <feead847-869a-86a8-d62d-065871024a74@HIDDEN>
 <86o7m91z22.fsf@HIDDEN> <86pm6py6k4.fsf@HIDDEN>
 <86bki9y68h.fsf@HIDDEN> <86cz2f7bvo.fsf@HIDDEN>
 <e698de3a-dec8-424a-21ff-dcb5bd22c8d4@HIDDEN>
 <86353axu48.fsf@HIDDEN> <87o7jfi00b.fsf@HIDDEN>
 <ier7cplhnky.fsf@HIDDEN> <86msyhwrrg.fsf@HIDDEN>
Content-Language: en-US
In-Reply-To: <86msyhwrrg.fsf@HIDDEN>
X-Spam-Score: -1.7 (-)
X-Debbugs-Envelope-To: 63648
Cc: sbaugh@HIDDEN, 63648 <at> debbugs.gnu.org
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: -2.7 (--)

This is a multi-part message in MIME format.
--------------0UHUOdqSmTCyD0GQ89kCHUbR
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Sorry for the possible duplicate, but it seems this message didn't reach 
the bug tracker, or other recipients. Resending contents below.

On 23/08/2023 20:54, Juri Linkov wrote:
> There is no code where to bind a dynamic variable, because its value
> should be available for the next command in the command loop.
> If you agree there is no other way to implement this than next-default-directory,
> then I could bring up the discussion on emacs-devel.

Before we dive into all that, why not try advice on 'command-execute'? 
For the PoC code at least. It's in Lisp since 2013.

The comment in its body does say "Called directly from the C code", but 
I'm not sure if that has any direct implications for us.

This attached piece of code implements the project-switch-project as you 
outlined. Does it work well for you/others? Careful when testing or 
modifying: a typo can break the command loop (and thus the session).

To me it seems a little too bare-bones, lacking the instructive hints 
project-switch-project currently has.
--------------0UHUOdqSmTCyD0GQ89kCHUbR
Content-Type: text/x-emacs-lisp; charset=UTF-8; name="next-dd.el"
Content-Disposition: attachment; filename="next-dd.el"
Content-Transfer-Encoding: base64

KGRlZnZhciBwcm9qZWN0LS1uZXh0LWRkIG5pbCkKCihkZWZ1biBwcm9qZWN0LS13aXRoLW5l
eHQtZGQgKGZ1biAmcmVzdCBhcmdzKQogIChhZHZpY2UtcmVtb3ZlICdjb21tYW5kLWV4ZWN1
dGUgIydwcm9qZWN0LS13aXRoLW5leHQtZGQpCiAgKGxldCAoKGRlZmF1bHQtZGlyZWN0b3J5
IHByb2plY3QtLW5leHQtZGQpKQogICAgKGFwcGx5IGZ1biBhcmdzKSkpCgooZGVmdW4gcHJv
amVjdC1zd2l0Y2gtcHJvamVjdCAoZGlyKQogIChpbnRlcmFjdGl2ZSAobGlzdCAoZnVuY2Fs
bCBwcm9qZWN0LXByb21wdGVyKSkpCiAgKHNldHEgcHJvamVjdC0tbmV4dC1kZCBkaXIpCiAg
KGFkdmljZS1hZGQgJ2NvbW1hbmQtZXhlY3V0ZSA6YXJvdW5kICMncHJvamVjdC0td2l0aC1u
ZXh0LWRkKSkK

--------------0UHUOdqSmTCyD0GQ89kCHUbR--




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

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


Received: (at 63648) by debbugs.gnu.org; 29 Aug 2023 20:36:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Aug 29 16:36:30 2023
Received: from localhost ([127.0.0.1]:51681 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qb5Ru-0007Ls-JW
	for submit <at> debbugs.gnu.org; Tue, 29 Aug 2023 16:36:30 -0400
Received: from mxout1.mail.janestreet.com ([38.105.200.78]:40763)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <sbaugh@HIDDEN>) id 1qb5Rs-0007Lf-KN
 for 63648 <at> debbugs.gnu.org; Tue, 29 Aug 2023 16:36:29 -0400
From: Spencer Baugh <sbaugh@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
In-Reply-To: <86msyhwrrg.fsf@HIDDEN> (Juri Linkov's message of "Wed, 
 23 Aug 2023 20:54:11 +0300")
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <482a1ebc-165c-a0a4-98c0-5c404d1b1d0d@HIDDEN>
 <86jzwyxnxb.fsf@HIDDEN>
 <feead847-869a-86a8-d62d-065871024a74@HIDDEN>
 <86o7m91z22.fsf@HIDDEN> <86pm6py6k4.fsf@HIDDEN>
 <86bki9y68h.fsf@HIDDEN> <86cz2f7bvo.fsf@HIDDEN>
 <e698de3a-dec8-424a-21ff-dcb5bd22c8d4@HIDDEN>
 <86353axu48.fsf@HIDDEN> <87o7jfi00b.fsf@HIDDEN>
 <ier7cplhnky.fsf@HIDDEN> <86msyhwrrg.fsf@HIDDEN>
Date: Tue, 29 Aug 2023 16:36:15 -0400
Message-ID: <ierpm357fi8.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: 63648
Cc: sbaugh@HIDDEN, 63648 <at> debbugs.gnu.org, Dmitry Gutov <dmitry@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 (-)

Juri Linkov <juri@HIDDEN> writes:

>>>>> I suggest you bring up this feature addition on emacs-devel, or otherwise
>>>>> wait for a review from Eli, at least.
>>>>>
>>>>> It's not a big addition, but it's a distinct new feature (the
>>>>> next-default-directory var).
>>>>
>>>> Indeed, such code addition better to be discussed on emacs-devel.
>>>
>>> Did this end up being discussed on emacs-devel?  I am still quite
>>> interested in this feature.
>>
>> Oh, another thought (which maybe should be discussed on emacs-devel):
>> maybe we don't need to make this specific next-default-directory var.
>>
>> Instead, maybe what we want is a way to bind a dynamic variable
>> *without* changing the buffer-local value.  It would shadow the existing
>> binding, but if we explicitly switched buffer we'd get back to the old
>> value.  So we'd have:
>>
>> (special-let ((default-directory newval))
>>   (assert default-directory newval))
>>
>> and
>>
>> (special-let ((default-directory newval))
>>   (set-buffer (current-buffer))
>>   (assert default-directory oldval))
>>
>> Ignore any complexities of implementing this and any complexities of the
>> semantics which I haven't covered.  If we had this, would it work as an
>> alternative to next-default-directory?
>
> There is no code where to bind a dynamic variable, because its value
> should be available for the next command in the command loop.

Oh, that's true.  (I guess maybe we could add a way to do that, and
other prefix commands could work that way too.  But that would be a big
effort - and worth talking about on emacs-devel)

> If you agree there is no other way to implement this than next-default-directory,
> then I could bring up the discussion on emacs-devel.

Yes, seems like that's the only way.




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

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


Received: (at 63648) by debbugs.gnu.org; 29 Aug 2023 20:34:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Aug 29 16:34:17 2023
Received: from localhost ([127.0.0.1]:51677 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qb5Pl-0007Ia-1C
	for submit <at> debbugs.gnu.org; Tue, 29 Aug 2023 16:34:17 -0400
Received: from mxout5.mail.janestreet.com ([64.215.233.18]:43351)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <sbaugh@HIDDEN>) id 1qb5Pj-0007IN-Dv
 for 63648 <at> debbugs.gnu.org; Tue, 29 Aug 2023 16:34:16 -0400
From: Spencer Baugh <sbaugh@HIDDEN>
To: Dmitry Gutov <dmitry@HIDDEN>
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
In-Reply-To: <6480ead5-b89b-82bd-9e1e-66016ba4520c@HIDDEN> (Dmitry Gutov's
 message of "Tue, 29 Aug 2023 01:44:19 +0300")
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <482a1ebc-165c-a0a4-98c0-5c404d1b1d0d@HIDDEN>
 <86jzwyxnxb.fsf@HIDDEN>
 <feead847-869a-86a8-d62d-065871024a74@HIDDEN>
 <86o7m91z22.fsf@HIDDEN> <86pm6py6k4.fsf@HIDDEN>
 <86bki9y68h.fsf@HIDDEN> <86cz2f7bvo.fsf@HIDDEN>
 <e698de3a-dec8-424a-21ff-dcb5bd22c8d4@HIDDEN>
 <86353axu48.fsf@HIDDEN> <87o7jfi00b.fsf@HIDDEN>
 <ier7cplhnky.fsf@HIDDEN>
 <6480ead5-b89b-82bd-9e1e-66016ba4520c@HIDDEN>
Date: Tue, 29 Aug 2023 16:34:02 -0400
Message-ID: <iersf817flx.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: 63648
Cc: sbaugh@HIDDEN, 63648 <at> debbugs.gnu.org, 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: -1.0 (-)

Dmitry Gutov <dmitry@HIDDEN> writes:

> On 23/08/2023 16:53, Spencer Baugh wrote:
>> Oh, another thought (which maybe should be discussed on emacs-devel):
>> maybe we don't need to make this specific next-default-directory var.
>> Instead, maybe what we want is a way to bind a dynamic variable
>> *without*  changing the buffer-local value.  It would shadow the existing
>> binding, but if we explicitly switched buffer we'd get back to the old
>> value.  So we'd have:
>> (special-let ((default-directory newval))
>>    (assert default-directory newval))
>> and
>> (special-let ((default-directory newval))
>>    (set-buffer (current-buffer))
>>    (assert default-directory oldval))
>
> Where does the main logic run in this case?
>
> If we call set-buffer before the main logic is ran, the old value of
> dd will be used.
>
> If we call set-buffer after the main logic is ran, we could as well
> use plain 'let' because that's what it does: restores the previous
> values at the end (and we know that it doesn't suit our purpose).

Sorry, I was unclear - our logic wouldn't use set-buffer at all, it's
just that things would work fine if user code used set-buffer.

So this would work:

(project-current) ;; -> (vc . oldval)
(special-let ((default-directory newval))
  (project-current) ;; -> (vc . newval)
  (with-current-buffer (current-buffer)
    (project-current))) ;; -> (vc . oldval)
  (project-current) ;; -> (vc . newval)

The actual logic of project-switch-project would be:

(defun project-switch-project (dir)
  (interactive (list (funcall project-prompter)))
  (let ((command (if (symbolp project-switch-commands)
                     project-switch-commands
                   (project--switch-project-command))))
    (special-let ((default-directory dir))
      (call-interactively command))))

(well, as long as (project--switch-project-command) could support
reading arbitrary commands)

> I was also considering rebinding the global value of dd instead, but
> that turned out to be even sillier, since any new buffer inherits the
> local value of this var from the previous buffer, the global one isn't
> used anywhere (or doesn't seem to be).
>
> (cl-letf (((default-value 'default-directory) "~/Documents/"))
>   (with-temp-buffer
>     (message "dv %s" (default-value 'default-directory))
>     (message "lv %s" default-directory)))
>
> So to make use of this, every relevant spot would have to look up the
> global value of this var manually. Might as well use the special var
> that we already have (...-override).

Sad!




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

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


Received: (at 63648) by debbugs.gnu.org; 28 Aug 2023 22:44:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Aug 28 18:44:39 2023
Received: from localhost ([127.0.0.1]:49139 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qakyM-0002BF-L3
	for submit <at> debbugs.gnu.org; Mon, 28 Aug 2023 18:44:38 -0400
Received: from out5-smtp.messagingengine.com ([66.111.4.29]:43913)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dmitry@HIDDEN>) id 1qakyJ-00029M-P6
 for 63648 <at> debbugs.gnu.org; Mon, 28 Aug 2023 18:44:36 -0400
Received: from compute6.internal (compute6.nyi.internal [10.202.2.47])
 by mailout.nyi.internal (Postfix) with ESMTP id 6E5E75C0206;
 Mon, 28 Aug 2023 18:44:23 -0400 (EDT)
Received: from mailfrontend2 ([10.202.2.163])
 by compute6.internal (MEProxy); Mon, 28 Aug 2023 18:44:23 -0400
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=
 1693262663; x=1693349063; bh=USutwyLdDT83zMcbUqK9vim8QLRzXxHzQ7A
 /X/hndX4=; b=RtKgvV/qzs6gEopJA4O8Vn1nWcJNEQAYjWLlS4ni5BcgiHp0gk3
 ADtBPryMT3W7I9bpiFOQXTD0Iim4Q5FIYliaER8ZZQVeZWCjx0q5Uz+0THoTw8Ac
 nRxCwoirfJ43p6PxvVDqqFRU1WdRuBmHmqQWBHFmqcEdlh8z3LfiD3m+OaOkUh3U
 UsQ5/HotuZXTbn2QcB6xtvCoGxfp9pzaQF90FtMs8CETgm82YT4gVGcgndDxwAdM
 HEkC/cj/QC9peaAWG1VWHPF4ycmfJssKmRIrK/sf8gc7qEGceKwrlKR5Je3GlCis
 NLJ6lf6sX4C6M/SM9lKtgOhsqRxhilqE3mA==
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=
 1693262663; x=1693349063; bh=USutwyLdDT83zMcbUqK9vim8QLRzXxHzQ7A
 /X/hndX4=; b=baU8VyaIJHCmZawz0JRb2SjePH/Fv1erQqk0aEFGs9WN6cNd13q
 vmctXHwUga1Qvx+n33diSYXAgSA84/hPVftRp0VLMyWTt6243KywOmSEbbiVfJYG
 U2eNZ1lPrpsX7WU4eXTeq+7zA5Fybk6v8lmJrJpU9LNOTa9a86fXkzAfTqJ0btRx
 ffGBRcx8qsY0KZ9gW+Z/NV43LsikE0jxM2sYPV5RqpagNn3nEMLDbUd3BiUGEMet
 HpdKzCBDXE9JVw3hnM+2A7L6FvtEsmtUwW91vhSswgFDaThYC3P/KFqj6S3WFkt4
 U997VCz9hNs9XdkVr73BfwaeSj3qP/lw9WQ==
X-ME-Sender: <xms:RyPtZE4zHt0Pz69Cu5Crz5YZj82CrZvqjwlO-b_6yQihwVHsL4AaMQ>
 <xme:RyPtZF4I0n9iRe5LHNvRzZMyEaVYwUA4ttZAupkrirGYFCzBHOgwQbhSX0MWjUlrt
 Q-xoUYu4VnUKpaftUc>
X-ME-Received: <xmr:RyPtZDdc-lGxzloNqZKvpQpu7Z4aBsZtlZmcIVIZZxp6equ6VeBhba-sRwzukKg>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudefhedguddvucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi
 thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth
 htvghrnhepiefgteevheevveffheeltdeukeeiieekueefgedugfefgefhudelgfefveel
 vdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug
 hmihhtrhihsehguhhtohhvrdguvghv
X-ME-Proxy: <xmx:RyPtZJIZCtApKWkSPTivJGTC0paeieXBU1nn-vLzFvW88S_cXcAVLA>
 <xmx:RyPtZILTIRJhoxL7z4KY9rd7nQv55x9qeUWQWZOn-2NMhnAsTMjThw>
 <xmx:RyPtZKx2LFXG3ffvU85nKRCERNfdEZXVQOELYw879PzhhN7llrZzUg>
 <xmx:RyPtZPUOT2WOIMsQwIAr7hYE7usDVUtaAroWmhd34ip7Ra3OeDW3gg>
Feedback-ID: i0e71465a:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon,
 28 Aug 2023 18:44:21 -0400 (EDT)
Message-ID: <6480ead5-b89b-82bd-9e1e-66016ba4520c@HIDDEN>
Date: Tue, 29 Aug 2023 01:44:19 +0300
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#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
Content-Language: en-US
To: Spencer Baugh <sbaugh@HIDDEN>, sbaugh@HIDDEN
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <482a1ebc-165c-a0a4-98c0-5c404d1b1d0d@HIDDEN>
 <86jzwyxnxb.fsf@HIDDEN>
 <feead847-869a-86a8-d62d-065871024a74@HIDDEN>
 <86o7m91z22.fsf@HIDDEN> <86pm6py6k4.fsf@HIDDEN>
 <86bki9y68h.fsf@HIDDEN> <86cz2f7bvo.fsf@HIDDEN>
 <e698de3a-dec8-424a-21ff-dcb5bd22c8d4@HIDDEN>
 <86353axu48.fsf@HIDDEN> <87o7jfi00b.fsf@HIDDEN>
 <ier7cplhnky.fsf@HIDDEN>
From: Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <ier7cplhnky.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -1.7 (-)
X-Debbugs-Envelope-To: 63648
Cc: 63648 <at> debbugs.gnu.org, 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: -2.7 (--)

On 23/08/2023 16:53, Spencer Baugh wrote:
> Oh, another thought (which maybe should be discussed on emacs-devel):
> maybe we don't need to make this specific next-default-directory var.
> 
> Instead, maybe what we want is a way to bind a dynamic variable
> *without*  changing the buffer-local value.  It would shadow the existing
> binding, but if we explicitly switched buffer we'd get back to the old
> value.  So we'd have:
> 
> (special-let ((default-directory newval))
>    (assert default-directory newval))
> 
> and
> 
> (special-let ((default-directory newval))
>    (set-buffer (current-buffer))
>    (assert default-directory oldval))

Where does the main logic run in this case?

If we call set-buffer before the main logic is ran, the old value of dd 
will be used.

If we call set-buffer after the main logic is ran, we could as well use 
plain 'let' because that's what it does: restores the previous values at 
the end (and we know that it doesn't suit our purpose).

I was also considering rebinding the global value of dd instead, but 
that turned out to be even sillier, since any new buffer inherits the 
local value of this var from the previous buffer, the global one isn't 
used anywhere (or doesn't seem to be).

(cl-letf (((default-value 'default-directory) "~/Documents/"))
   (with-temp-buffer
     (message "dv %s" (default-value 'default-directory))
     (message "lv %s" default-directory)))

So to make use of this, every relevant spot would have to look up the 
global value of this var manually. Might as well use the special var 
that we already have (...-override).




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

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


Received: (at 63648) by debbugs.gnu.org; 23 Aug 2023 18:17:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Aug 23 14:17:25 2023
Received: from localhost ([127.0.0.1]:35157 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qYsQ1-0006O8-52
	for submit <at> debbugs.gnu.org; Wed, 23 Aug 2023 14:17:25 -0400
Received: from relay4-d.mail.gandi.net ([217.70.183.196]:50649)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1qYsPw-0006Na-Vy
 for 63648 <at> debbugs.gnu.org; Wed, 23 Aug 2023 14:17:22 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id 8C07FE0009;
 Wed, 23 Aug 2023 18:17:09 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Spencer Baugh <sbaugh@HIDDEN>
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
In-Reply-To: <ier7cplhnky.fsf@HIDDEN> (Spencer Baugh's message of
 "Wed, 23 Aug 2023 09:53:33 -0400")
Organization: LINKOV.NET
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <482a1ebc-165c-a0a4-98c0-5c404d1b1d0d@HIDDEN>
 <86jzwyxnxb.fsf@HIDDEN>
 <feead847-869a-86a8-d62d-065871024a74@HIDDEN>
 <86o7m91z22.fsf@HIDDEN> <86pm6py6k4.fsf@HIDDEN>
 <86bki9y68h.fsf@HIDDEN> <86cz2f7bvo.fsf@HIDDEN>
 <e698de3a-dec8-424a-21ff-dcb5bd22c8d4@HIDDEN>
 <86353axu48.fsf@HIDDEN> <87o7jfi00b.fsf@HIDDEN>
 <ier7cplhnky.fsf@HIDDEN>
Date: Wed, 23 Aug 2023 20:54:11 +0300
Message-ID: <86msyhwrrg.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: 63648
Cc: sbaugh@HIDDEN, 63648 <at> debbugs.gnu.org, Dmitry Gutov <dmitry@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 (-)

>>>> I suggest you bring up this feature addition on emacs-devel, or otherwise
>>>> wait for a review from Eli, at least.
>>>>
>>>> It's not a big addition, but it's a distinct new feature (the
>>>> next-default-directory var).
>>>
>>> Indeed, such code addition better to be discussed on emacs-devel.
>>
>> Did this end up being discussed on emacs-devel?  I am still quite
>> interested in this feature.
>
> Oh, another thought (which maybe should be discussed on emacs-devel):
> maybe we don't need to make this specific next-default-directory var.
>
> Instead, maybe what we want is a way to bind a dynamic variable
> *without* changing the buffer-local value.  It would shadow the existing
> binding, but if we explicitly switched buffer we'd get back to the old
> value.  So we'd have:
>
> (special-let ((default-directory newval))
>   (assert default-directory newval))
>
> and
>
> (special-let ((default-directory newval))
>   (set-buffer (current-buffer))
>   (assert default-directory oldval))
>
> Ignore any complexities of implementing this and any complexities of the
> semantics which I haven't covered.  If we had this, would it work as an
> alternative to next-default-directory?

There is no code where to bind a dynamic variable, because its value
should be available for the next command in the command loop.
If you agree there is no other way to implement this than next-default-directory,
then I could bring up the discussion on emacs-devel.




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

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


Received: (at 63648) by debbugs.gnu.org; 23 Aug 2023 13:53:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Aug 23 09:53:47 2023
Received: from localhost ([127.0.0.1]:33179 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qYoIt-0004Ci-Dz
	for submit <at> debbugs.gnu.org; Wed, 23 Aug 2023 09:53:47 -0400
Received: from mxout5.mail.janestreet.com ([64.215.233.18]:54141)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <sbaugh@HIDDEN>) id 1qYoIo-0004CS-RK
 for 63648 <at> debbugs.gnu.org; Wed, 23 Aug 2023 09:53:46 -0400
From: Spencer Baugh <sbaugh@HIDDEN>
To: sbaugh@HIDDEN
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
In-Reply-To: <87o7jfi00b.fsf@HIDDEN> (sbaugh@HIDDEN's message of "Thu, 
 10 Aug 2023 11:56:36 +0000 (UTC)")
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <482a1ebc-165c-a0a4-98c0-5c404d1b1d0d@HIDDEN>
 <86jzwyxnxb.fsf@HIDDEN>
 <feead847-869a-86a8-d62d-065871024a74@HIDDEN>
 <86o7m91z22.fsf@HIDDEN> <86pm6py6k4.fsf@HIDDEN>
 <86bki9y68h.fsf@HIDDEN> <86cz2f7bvo.fsf@HIDDEN>
 <e698de3a-dec8-424a-21ff-dcb5bd22c8d4@HIDDEN>
 <86353axu48.fsf@HIDDEN> <87o7jfi00b.fsf@HIDDEN>
Date: Wed, 23 Aug 2023 09:53:33 -0400
Message-ID: <ier7cplhnky.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: 63648
Cc: Dmitry Gutov <dmitry@HIDDEN>, 63648 <at> debbugs.gnu.org,
 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: -1.0 (-)

sbaugh@HIDDEN writes:
> Juri Linkov <juri@HIDDEN> writes:
>
>>>>>> 1. the current buffer should remain the same for the next command;
>>>>>> 2. the buffer-local value of 'default-directory' should remain the same;
>>>>>> 3. the next command should have a new value of 'default-directory'.
>>>>>>
>>>>>> I see no way to satisfy all these requirements.
>>>>>
>>>>> Except adding a variable like 'project-current-directory-override'
>>>>> somewhere inside 'command_loop_1'.
>>>> And indeed with the following patch replacing the current definition of
>>>> 'project-switch-project' with just:
>>>>    (defun project-switch-project (dir)
>>>>      (interactive (list (funcall project-prompter)))
>>>>      (setq next-default-directory dir))
>>>
>>> Note that we'd need to keep the previous implementation for a number of
>>> years anyway, to retain compatibility with older emacsen.
>>
>> Then some version-depending condition could be added.
>>
>>>> 'C-x p p (select project ...) RET M-& pwd RET' confirms that
>>>> the command runs in the selected project directory.
>>>> Whereas the original buffer keeps its previous buffer-local value
>>>> of 'default-directory'.
>>>
>>> I suggest you bring up this feature addition on emacs-devel, or otherwise
>>> wait for a review from Eli, at least.
>>>
>>> It's not a big addition, but it's a distinct new feature (the
>>> next-default-directory var).
>>
>> Indeed, such code addition better to be discussed on emacs-devel.
>
> Did this end up being discussed on emacs-devel?  I am still quite
> interested in this feature.

Oh, another thought (which maybe should be discussed on emacs-devel):
maybe we don't need to make this specific next-default-directory var.

Instead, maybe what we want is a way to bind a dynamic variable
*without* changing the buffer-local value.  It would shadow the existing
binding, but if we explicitly switched buffer we'd get back to the old
value.  So we'd have:

(special-let ((default-directory newval))
  (assert default-directory newval))

and

(special-let ((default-directory newval))
  (set-buffer (current-buffer))
  (assert default-directory oldval))

Ignore any complexities of implementing this and any complexities of the
semantics which I haven't covered.  If we had this, would it work as an
alternative to next-default-directory?




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

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


Received: (at 63648) by debbugs.gnu.org; 10 Aug 2023 11:56:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Aug 10 07:56:44 2023
Received: from localhost ([127.0.0.1]:41584 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qU4HT-0007Qf-Rn
	for submit <at> debbugs.gnu.org; Thu, 10 Aug 2023 07:56:44 -0400
Received: from s.wrqvtbkv.outbound-mail.sendgrid.net ([149.72.123.24]:4844)
 by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from
 <bounces+21787432-16ef-63648=debbugs.gnu.org@HIDDEN>)
 id 1qU4HS-0007QS-Co
 for 63648 <at> debbugs.gnu.org; Thu, 10 Aug 2023 07:56:43 -0400
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=vEAnyvyUOzuFOi+sxd89jmdxR5d03H7xjt9B48kf7Sg=;
 b=o3ZSBFB6+uQnJm3ViAyYwkQQfPk44sa1sItkVdPVTcvdheJiEHoIVqF197teNNqdHXD6
 kfBxXtqe5VWo6baOJLVEZ4yYJNIQiOYWfxgzTBc1sOqi51cxmPOOw+n+b5V+76hvkJE/BI
 aflqfXpbEw39jBxGDj7nIJ02uFE21W51kBBFkNVmMYrpRLY7XPCaoWrVYQe1RmsJNRbZMc
 X0yfrZO1sml1KeZO1bNHvbH89uoA/63XWZ5kmv38Jx6fB030EH6tmUlE/tVmgqvVrea40j
 reXmQ+ZuwsWsPcLWKH/9pzsDAHpJv/M9uvPaHTCe7C1ZclgzwfeEhP6qoiaoQiyg==
Received: by filterdrecv-d7bbbc8bf-nxr9l with SMTP id
 filterdrecv-d7bbbc8bf-nxr9l-1-64D4D074-3A
 2023-08-10 11:56:36.834326247 +0000 UTC m=+7906618.920059610
Received: from earth.catern.com (unknown) by geopod-ismtpd-7 (SG) with ESMTP
 id DAOgYDLkRHeDX_BFj_FYPA Thu, 10 Aug 2023 11:56:36.754 +0000 (UTC)
X-Comment: SPF check N/A for local connections - client-ip=::1; helo=localhost;
 envelope-from=sbaugh@HIDDEN; receiver=linkov.net 
Received: from localhost (localhost [IPv6:::1])
 by earth.catern.com (Postfix) with ESMTPSA id 7489860094;
 Thu, 10 Aug 2023 07:56:36 -0400 (EDT)
From: sbaugh@HIDDEN
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
In-Reply-To: <86353axu48.fsf@HIDDEN> (Juri Linkov's message of "Fri, 
 02 Jun 2023 09:40:55 +0300")
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <482a1ebc-165c-a0a4-98c0-5c404d1b1d0d@HIDDEN>
 <86jzwyxnxb.fsf@HIDDEN>
 <feead847-869a-86a8-d62d-065871024a74@HIDDEN>
 <86o7m91z22.fsf@HIDDEN> <86pm6py6k4.fsf@HIDDEN>
 <86bki9y68h.fsf@HIDDEN> <86cz2f7bvo.fsf@HIDDEN>
 <e698de3a-dec8-424a-21ff-dcb5bd22c8d4@HIDDEN>
 <86353axu48.fsf@HIDDEN>
Date: Thu, 10 Aug 2023 11:56:36 +0000 (UTC)
Message-ID: <87o7jfi00b.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
X-SG-EID: =?us-ascii?Q?ZgbRq7gjGrt0q=2FPjvxk7wM0yQFRdOkTJAtEbkjCkHbJqotK6NVcN+vV1sHFPZk?=
 =?us-ascii?Q?coyPdSypNCFPlY2VFquoyx1J8ELMK8Qrxm4VMCL?=
 =?us-ascii?Q?c4sLSyxigfnrriZBH18ygq4ZjfIpMBeaIwb7KW3?=
 =?us-ascii?Q?Ujer9cWskDs+psI3rHKqxE6ZN117se9fmvFMjiy?=
 =?us-ascii?Q?X1ckcJv5hSO6ix1vstcF6aTZ1=2F9mwvhHX0g=3D=3D?=
To: Juri Linkov <juri@HIDDEN>
X-Entity-ID: d/0VcHixlS0t7iB1YKCv4Q==
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Spam-Score: 1.2 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  Juri Linkov <juri@HIDDEN> writes: >>>>> 1. the current
 buffer should remain the same for the next command; >>>>> 2. the buffer-local
 value of 'default-directory' should remain the same; >>>>> 3. the next command
 should have a new valu [...] 
 Content analysis details:   (1.2 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 1.2 RCVD_IN_BL_SPAMCOP_NET RBL: Received via a relay in
 bl.spamcop.net
 [Blocked - see <https://www.spamcop.net/bl.shtml?149.72.123.24>]
 -0.0 SPF_PASS               SPF: sender matches SPF record
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 -0.0 RCVD_IN_MSPIKE_H2      RBL: Average reputation (+2)
 [149.72.123.24 listed in wl.mailspike.net]
 0.0 UNPARSEABLE_RELAY      Informational: message has unparseable relay
 lines -0.0 T_SCC_BODY_TEXT_LINE   No description available.
X-Debbugs-Envelope-To: 63648
Cc: Dmitry Gutov <dmitry@HIDDEN>, 63648 <at> debbugs.gnu.org,
 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: 0.2 (/)

Juri Linkov <juri@HIDDEN> writes:

>>>>> 1. the current buffer should remain the same for the next command;
>>>>> 2. the buffer-local value of 'default-directory' should remain the same;
>>>>> 3. the next command should have a new value of 'default-directory'.
>>>>>
>>>>> I see no way to satisfy all these requirements.
>>>>
>>>> Except adding a variable like 'project-current-directory-override'
>>>> somewhere inside 'command_loop_1'.
>>> And indeed with the following patch replacing the current definition of
>>> 'project-switch-project' with just:
>>>    (defun project-switch-project (dir)
>>>      (interactive (list (funcall project-prompter)))
>>>      (setq next-default-directory dir))
>>
>> Note that we'd need to keep the previous implementation for a number of
>> years anyway, to retain compatibility with older emacsen.
>
> Then some version-depending condition could be added.
>
>>> 'C-x p p (select project ...) RET M-& pwd RET' confirms that
>>> the command runs in the selected project directory.
>>> Whereas the original buffer keeps its previous buffer-local value
>>> of 'default-directory'.
>>
>> I suggest you bring up this feature addition on emacs-devel, or otherwise
>> wait for a review from Eli, at least.
>>
>> It's not a big addition, but it's a distinct new feature (the
>> next-default-directory var).
>
> Indeed, such code addition better to be discussed on emacs-devel.

Did this end up being discussed on emacs-devel?  I am still quite
interested in this feature.

> But first need to ensure that it works with 'C-x p p'.
> Currently it works with keys from the global map such as
> 'C-x p p M-& pwd RET', but not with keys from 'project-prefix-map', e.g.
> 'C-x p p f'.  Maybe in addition to (setq next-default-directory dir)
> also need to use 'set-transient-map' with 'project-prefix-map'.




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

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


Received: (at 63648) by debbugs.gnu.org; 10 Aug 2023 11:52:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Aug 10 07:52:31 2023
Received: from localhost ([127.0.0.1]:41579 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qU4DP-0007Kl-4b
	for submit <at> debbugs.gnu.org; Thu, 10 Aug 2023 07:52:31 -0400
Received: from s.wrqvwxzv.outbound-mail.sendgrid.net ([149.72.154.232]:61012)
 by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from
 <bounces+21787432-16ef-63648=debbugs.gnu.org@HIDDEN>)
 id 1qU4DJ-0007KU-Iy
 for 63648 <at> debbugs.gnu.org; Thu, 10 Aug 2023 07:52:29 -0400
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=RFx5wEeydEM2a7c5s0plSNauDkFBr17l+Ot8cSCk91E=;
 b=zW1z1ge3pTPNpcAye3KIkOi0MA0x5a9sozOpu5l1UTzHulUHOdxgNv7sS54vFZhU52Ff
 XAfBYbdUPeGjlsWaSwtfJ4Q7+WULUvwl893hJEyyN2qE9AsABuOr7sAfLgLwUxLBVRyEGj
 +DO36yT4mvN41FSz7183jIfBYVSkO8BA+jaFL8918Jc+yxu9tzQJzjRWr85IA4QSsJuoiH
 yL77g/Ioj58XBD4WjbdIp5scsIQ3XQ+I7QVrI/iK+khx8iC0G+YxXb/2WZN30+kJyzgUdg
 iF2Ipd+2zlIRyMHc9Lqeu6yiItF6nebbck/f23Ws1kxdfgI6iWsSb2uEu1cHs1kA==
Received: by filterdrecv-65f68489c8-qxj4s with SMTP id
 filterdrecv-65f68489c8-qxj4s-1-64D4CF73-20
 2023-08-10 11:52:19.644887835 +0000 UTC m=+7906576.690780058
Received: from earth.catern.com (unknown) by geopod-ismtpd-8 (SG) with ESMTP
 id YrZr2ykwSh6LS68yOlVeOg Thu, 10 Aug 2023 11:52:19.559 +0000 (UTC)
X-Comment: SPF check N/A for local connections - client-ip=::1; helo=localhost;
 envelope-from=sbaugh@HIDDEN; receiver=linkov.net 
Received: from localhost (localhost [IPv6:::1])
 by earth.catern.com (Postfix) with ESMTPSA id 2C8B560155;
 Thu, 10 Aug 2023 07:52:19 -0400 (EDT)
From: sbaugh@HIDDEN
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
In-Reply-To: <86h6rqwena.fsf@HIDDEN> (Juri Linkov's message of "Fri, 
 02 Jun 2023 09:46:25 +0300")
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <iera5xt7p9u.fsf@HIDDEN> <864jo11yvp.fsf@HIDDEN>
 <ier5y8f6s2p.fsf@HIDDEN> <86v8g98zw6.fsf@HIDDEN>
 <iersfbazzz3.fsf@HIDDEN> <86h6rqwena.fsf@HIDDEN>
Date: Thu, 10 Aug 2023 11:52:19 +0000 (UTC)
Message-ID: <87sf8ri07g.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
X-SG-EID: =?us-ascii?Q?ZgbRq7gjGrt0q=2FPjvxk7wM0yQFRdOkTJAtEbkjCkHbKLhnaci7IB7o7J6RjQ+h?=
 =?us-ascii?Q?mxCzwXu2GhKNyQd6qG4cZWj7ZmFMnzYKpzripTD?=
 =?us-ascii?Q?CD3jpiyjrNGPHmAICm0uzrOpQYJdk3bcZQg73QR?=
 =?us-ascii?Q?f6RE6vbJVKOJBa5FOAG9uE2mHJO49faBrNfWrT+?=
 =?us-ascii?Q?5idBVi=2Fw=2FK8vjMQizBmZxLXMdbuWVCOZ3=2Fg=3D=3D?=
To: Juri Linkov <juri@HIDDEN>
X-Entity-ID: d/0VcHixlS0t7iB1YKCv4Q==
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Spam-Score: 1.2 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  Juri Linkov <juri@HIDDEN> writes: >>>>>>>> (Tangential
 further thought: I wonder if we could make C-x p work >>>>>>>> as a prefix
 for all commands automatically, so for example >>>>>>>> C-x p C-x [...] 
 Content analysis details:   (1.2 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 SPF_PASS               SPF: sender matches SPF record
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 1.2 RCVD_IN_BL_SPAMCOP_NET RBL: Received via a relay in
 bl.spamcop.net
 [Blocked - see <https://www.spamcop.net/bl.shtml?149.72.154.232>]
 -0.0 RCVD_IN_MSPIKE_H2      RBL: Average reputation (+2)
 [149.72.154.232 listed in wl.mailspike.net]
 0.0 UNPARSEABLE_RELAY      Informational: message has unparseable relay
 lines -0.0 T_SCC_BODY_TEXT_LINE   No description available.
X-Debbugs-Envelope-To: 63648
Cc: Spencer Baugh <sbaugh@HIDDEN>, 63648 <at> debbugs.gnu.org
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 (/)

Juri Linkov <juri@HIDDEN> writes:
>>>>>>>> (Tangential further thought: I wonder if we could make C-x p work
>>>>>>>> as a prefix for all commands automatically, so for example
>>>>>>>> C-x p C-x C-j would open the project root,
>>>
>>> I just noticed that 'C-x p C-x C-j' would open the parent directory
>>> of the project root, not the root itself, since 'C-x C-j' in the root
>>> jumps to its parent.
>>
>> Only in dired buffers.  If not in dired, and not in a file-visiting
>> buffer, it just goes to default-directory.
>
> You are right, I tried with the next-default-directory patch,
> and it works like you described.
>
>> That is kind of annoying for making C-x p p C-x C-j go to the root,
>> though, because its behavior will depend on the current buffer...  Maybe
>> C-x p p can switch buffers before running the command?
>
> Alas, can't switch buffers because such commands as 'C-x p g'
> read the default value from the current buffer.
>
>> Or maybe we can just change how C-x C-j behaves so it works
>> intuitively with C-x p p?
>
> The problem is in 'C-x C-j'.  In dired buffers it uses the value of
> 'dired-subdir-alist' instead of 'default-directory', so the patch with
> 'next-default-directory' doesn't help.

Ah, I just realized this doesn't matter.  C-x C-j isn't the right
command to use.  The right command to use is C-x d RET, that will have
consistent behavior.




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

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


Received: (at 63648) by debbugs.gnu.org; 5 Jun 2023 16:40:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 05 12:40:11 2023
Received: from localhost ([127.0.0.1]:50270 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q6DFa-0004qC-M4
	for submit <at> debbugs.gnu.org; Mon, 05 Jun 2023 12:40:11 -0400
Received: from relay1-d.mail.gandi.net ([217.70.183.193]:57813)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1q6DFY-0004pF-Ny
 for 63648 <at> debbugs.gnu.org; Mon, 05 Jun 2023 12:40:09 -0400
X-GND-Sasl: juri@HIDDEN
X-GND-Sasl: juri@HIDDEN
X-GND-Sasl: juri@HIDDEN
X-GND-Sasl: juri@HIDDEN
Received: by mail.gandi.net (Postfix) with ESMTPSA id DE2CA240006;
 Mon,  5 Jun 2023 16:40:00 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
In-Reply-To: <jwvmt1e9e1u.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
 of "Mon, 05 Jun 2023 10:44:11 -0400")
Organization: LINKOV.NET
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <482a1ebc-165c-a0a4-98c0-5c404d1b1d0d@HIDDEN>
 <86jzwyxnxb.fsf@HIDDEN>
 <feead847-869a-86a8-d62d-065871024a74@HIDDEN>
 <86o7m91z22.fsf@HIDDEN> <86pm6py6k4.fsf@HIDDEN>
 <86bki9y68h.fsf@HIDDEN> <86cz2f7bvo.fsf@HIDDEN>
 <jwvsfb9ajql.fsf-monnier+emacs@HIDDEN>
 <86jzwipf4z.fsf@HIDDEN>
 <jwvmt1e9e1u.fsf-monnier+emacs@HIDDEN>
Date: Mon, 05 Jun 2023 19:31:37 +0300
Message-ID: <86bkhtlvkm.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-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 63648
Cc: Dmitry Gutov <dmitry@HIDDEN>, 63648 <at> debbugs.gnu.org,
 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 (-)

>>       (prefix-command-update)
>
> I think you need to call `prefix-command-preserve-state` as well, so
> that the order of prefix commands doesn't matter (e.g. user can do `C-u
> C-x p` instead of `C-x p C-u`).

I confirm that after replacing `prefix-command-update` with
`prefix-command-preserve-state` (replacing since the latter calls the
former), now `C-u C-x p p f lisp/international/emoji-labels.el` works ok
(without C-u it can't find this non-registered file).

> [ Note: I'm still not really happy with the way prefix commands work.
>   I can't remember what problems are still lurking, but IIRC interaction
>   with minibuffer is a source of problems (e.g. prefix commands from
>   before we entered the minibuffer can affect operations within the
>   minibuffer and prefix commands from within the minibuffer can affect
>   the behavior after exiting the minibuffer).  I think last time
>   I looked at it, I concluded that maybe it should be reimplemented such
>   that the state is kept in a single object to which prefix commands can
>   add/remove properties, and the minibuffer code would automatically
>   suspend and then reinstall that state (and could emit a warning when
>   throwing away "unused state", such as when leaving a minibuffer).  ]

I tested this with such test command and there are no problems:

```
(defun test (arg1 arg2)
  (interactive
   (list (progn
           (message "%S" default-directory)
           (read-string "1: ")
           (message "%S" default-directory))
         (progn
           (message "%S" default-directory)
           (read-string "2: ")
           (message "%S" default-directory))))
  (message "%S" default-directory))
```

`C-x p p M-x test RET` prints only the new directory.

However, I found a problem with `C-x p 4 p`.  To fix it,
`project-other-window-command` should be completely rewritten to:

```
(defun project-other-window-command ()
  (interactive)
  (other-window-prefix)
  (set-transient-map (make-composed-keymap project-prefix-map
                                           project-other-window-map)))
```

plus a small fix that I don't know how to generalize:

```
diff --git a/lisp/window.el b/lisp/window.el
index ab7dd5ced12..52ba407d9c8 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -9099,7 +9091,8 @@ display-buffer-override-next-command
 		     (> (minibuffer-depth) minibuffer-depth)
 		     ;; But don't remove immediately after
 		     ;; adding the hook by the same command below.
-		     (eq this-command command))
+		     (eq this-command command)
+		     (memq this-command '(other-project-prefix)))
               (funcall exitfun))))
     ;; Call post-function after the next command finishes (bug#49057).
     (add-hook 'post-command-hook postfun)
```

Then everything works as before and even better.

>> If this is conceptually ok, then more customization could be ported
>> from project--switch-project-command such as project-switch-use-entire-map.
>
> Looks OK to me [ modulo the fact that I don't really understand what
> this is doing (I don't understand the `project-switch-commands` bit, nor
> do I understand why a prefix command which temporarily changes the
> `default-directory` would be called `project-switch-project`).  ]

It's possible to create another general command that will read arbitrary
directory, but this command is project-specific with `project-prompter`.

`project-switch-project` really should be renamed to `other-project-prefix`
like other similar prefix commands.  Here is the latest version without
much changes:

```
(defun other-project-prefix (dir)
  (interactive (list (funcall project-prompter)))
  (if (symbolp project-switch-commands)
      (let ((default-directory dir))
        (call-interactively project-switch-commands))
    (let* ((echofun (lambda () "[switch-project]"))
           (postfun (lambda () (remove-hook
                                'prefix-command-echo-keystrokes-functions
                                echofun))))
      (setq next-default-directory dir)
      (message (project--keymap-prompt))
      (add-hook 'prefix-command-echo-keystrokes-functions echofun)
      (prefix-command-preserve-state)
      (set-transient-map project-prefix-map nil postfun))))
```




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

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


Received: (at 63648) by debbugs.gnu.org; 5 Jun 2023 14:44:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 05 10:44:27 2023
Received: from localhost ([127.0.0.1]:50062 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q6BRb-0001k2-1C
	for submit <at> debbugs.gnu.org; Mon, 05 Jun 2023 10:44:27 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:15352)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1q6BRY-0001jp-VX
 for 63648 <at> debbugs.gnu.org; Mon, 05 Jun 2023 10:44:25 -0400
Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 3431B4426EB;
 Mon,  5 Jun 2023 10:44:19 -0400 (EDT)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id A8B354400B3;
 Mon,  5 Jun 2023 10:44:17 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1685976257;
 bh=oBh3mcHQWWDFx/JocR6hclcddhxpkxbKo7f5ATUfE4E=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=hhLagaZ9LV7sfhlrq0H7PIHiGmg8sK9uuI90IPdhdVM19CVEoy7hnJ/2bNCUQrDvp
 YeAnqSP3y3/8qawBF8OHw0RPTiGDqoaDaW/1eX2rtgWRh7G0Grn9AdqUCFO5PwrCwI
 XiSGGu3+2RY4xrDAV4wYGgmCbtpQD24h4cLjsHZ5n+DsoWHp08MpeOMn+9SX2sjh0J
 PUTkBk1BXQkSK7yA+wO/y4tJuURb4PpuSubuiD1A5C0LcSIAyaFKFuuP4tCEd5qsdl
 HdwH01v5DAQadtF+8D2M9geKBvK8gvI2DhL6KIGAhizNjnzBEqD55WpG/FIg+9cYiP
 wkDE4ttDPQaUA==
Received: from alfajor (unknown [45.44.229.252])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 88EC7120171;
 Mon,  5 Jun 2023 10:44:17 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
In-Reply-To: <86jzwipf4z.fsf@HIDDEN> (Juri Linkov's message of "Mon, 
 05 Jun 2023 09:50:44 +0300")
Message-ID: <jwvmt1e9e1u.fsf-monnier+emacs@HIDDEN>
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <482a1ebc-165c-a0a4-98c0-5c404d1b1d0d@HIDDEN>
 <86jzwyxnxb.fsf@HIDDEN>
 <feead847-869a-86a8-d62d-065871024a74@HIDDEN>
 <86o7m91z22.fsf@HIDDEN> <86pm6py6k4.fsf@HIDDEN>
 <86bki9y68h.fsf@HIDDEN> <86cz2f7bvo.fsf@HIDDEN>
 <jwvsfb9ajql.fsf-monnier+emacs@HIDDEN>
 <86jzwipf4z.fsf@HIDDEN>
Date: Mon, 05 Jun 2023 10:44:11 -0400
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL 0.032 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
 DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
 domain T_SCC_BODY_TEXT_LINE    -0.01 -
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 63648
Cc: Dmitry Gutov <dmitry@HIDDEN>, 63648 <at> debbugs.gnu.org,
 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: -3.3 (---)

Juri Linkov [2023-06-05 09:50:44] wrote:

>>> And indeed with the following patch replacing the current definition of
>>> 'project-switch-project' with just:
>>>
>>>   (defun project-switch-project (dir)
>>>     (interactive (list (funcall project-prompter)))
>>>     (setq next-default-directory dir))
>>
>> This would be a new "prefix command", like the `universal-argument`,
>> `C-x RET c`, the `ofw-other-window`, vc-edit-next-command,
>> `ofw-other-frame` from the `other-frame-window` package, and a few more.
>>
>> In order for this new prefix to interact correctly with those other
>> ones, it should probably use `prefix-command-preserve-state` and it
>> would be good to make it show some visual feedback via
>> `prefix-command-echo-keystrokes-functions`.
>
> Here is the same function turned into a prefix command,
> so it supports both cases:
>
> 1. 'C-x p p d'      -- keys from project-prefix-map
> 2. 'C-x p p C-x d'  -- global keybindings
>
> ```
> (defun project-switch-project (dir)
>   (interactive (list (funcall project-prompter)))
>   (if (symbolp project-switch-commands)
>       (let ((default-directory dir))
>         (call-interactively project-switch-commands))
>     (let* ((echofun (lambda () "[switch-project]"))
>            (postfun (lambda () (remove-hook
>                                 'prefix-command-echo-keystrokes-functions
>                                 echofun))))
>       (setq next-default-directory dir)
>       (add-hook 'prefix-command-echo-keystrokes-functions echofun)
>       (message (project--keymap-prompt))
>       (prefix-command-update)
>       (set-transient-map project-prefix-map nil postfun))))
> ```

I think you need to call `prefix-command-preserve-state` as well, so
that the order of prefix commands doesn't matter (e.g. user can do `C-u
C-x p` instead of `C-x p C-u`).

[ Note: I'm still not really happy with the way prefix commands work.
  I can't remember what problems are still lurking, but IIRC interaction
  with minibuffer is a source of problems (e.g. prefix commands from
  before we entered the minibuffer can affect operations within the
  minibuffer and prefix commands from within the minibuffer can affect
  the behavior after exiting the minibuffer).  I think last time
  I looked at it, I concluded that maybe it should be reimplemented such
  that the state is kept in a single object to which prefix commands can
  add/remove properties, and the minibuffer code would automatically
  suspend and then reinstall that state (and could emit a warning when
  throwing away "unused state", such as when leaving a minibuffer).  ]

> If this is conceptually ok, then more customization could be ported
> from project--switch-project-command such as project-switch-use-entire-map.

Looks OK to me [ modulo the fact that I don't really understand what
this is doing (I don't understand the `project-switch-commands` bit, nor
do I understand why a prefix command which temporarily changes the
`default-directory` would be called `project-switch-project`).  ]


        Stefan





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

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


Received: (at 63648) by debbugs.gnu.org; 5 Jun 2023 07:06:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 05 03:06:04 2023
Received: from localhost ([127.0.0.1]:47889 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q64Hz-0000Ex-RD
	for submit <at> debbugs.gnu.org; Mon, 05 Jun 2023 03:06:04 -0400
Received: from relay7-d.mail.gandi.net ([217.70.183.200]:35935)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1q64Hy-0000E7-A8
 for 63648 <at> debbugs.gnu.org; Mon, 05 Jun 2023 03:06:02 -0400
X-GND-Sasl: juri@HIDDEN
X-GND-Sasl: juri@HIDDEN
X-GND-Sasl: juri@HIDDEN
X-GND-Sasl: juri@HIDDEN
X-GND-Sasl: juri@HIDDEN
Received: by mail.gandi.net (Postfix) with ESMTPSA id C254F20005;
 Mon,  5 Jun 2023 07:05:54 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
In-Reply-To: <83leh2ayai.fsf@HIDDEN> (Eli Zaretskii's message of "Fri, 02 Jun
 2023 14:39:17 +0300")
Organization: LINKOV.NET
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <482a1ebc-165c-a0a4-98c0-5c404d1b1d0d@HIDDEN>
 <86jzwyxnxb.fsf@HIDDEN>
 <feead847-869a-86a8-d62d-065871024a74@HIDDEN>
 <86o7m91z22.fsf@HIDDEN> <86pm6py6k4.fsf@HIDDEN>
 <86bki9y68h.fsf@HIDDEN> <86cz2f7bvo.fsf@HIDDEN>
 <83ttvqbch1.fsf@HIDDEN> <86v8g6uzdj.fsf@HIDDEN>
 <83leh2ayai.fsf@HIDDEN>
Date: Mon, 05 Jun 2023 09:53:39 +0300
Message-ID: <86h6rmpf1s.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-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 63648
Cc: dmitry@HIDDEN, monnier@HIDDEN, 63648 <at> debbugs.gnu.org,
 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 (-)

>> >> @@ -1500,7 +1500,19 @@ command_loop_1 (void)
>> >>  	    update_redisplay_ticks (0, NULL);
>> >>  	    display_working_on_window_p = false;
>> >>
>> >> +            Lisp_Object next_dir = Vnext_default_directory;
>> >> +            specpdl_ref count = SPECPDL_INDEX ();
>> >> +            if (!NILP (next_dir))
>> >> +              specbind (Qdefault_directory, next_dir);
>> >> +
>> >>              call1 (Qcommand_execute, Vthis_command);
>> >> +
>> >> +            if (!NILP (next_dir))
>> >> +              {
>> >> +                unbind_to (count, Qnil);
>> >> +                Vnext_default_directory = Qnil;
>> >> +              }
>> >> +
>> >
>> > What will this do when a command is invoked via call-interactively?
>>
>> This is intended only for commands called interactively.
>
> Won't this violate some legitimate expectations?  Namely, that
> invoking a command interactively and via call-interactively produces
> the same results?

Using 'let' for 'call-interactively' works expectedly in the recent patch:

  (if (symbolp project-switch-commands)
      (let ((default-directory dir))
        (call-interactively project-switch-commands))




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

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


Received: (at 63648) by debbugs.gnu.org; 5 Jun 2023 07:06:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 05 03:06:01 2023
Received: from localhost ([127.0.0.1]:47885 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q64Hx-0000EK-Fc
	for submit <at> debbugs.gnu.org; Mon, 05 Jun 2023 03:06:01 -0400
Received: from relay9-d.mail.gandi.net ([217.70.183.199]:38139)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1q64Hu-0000E0-CW
 for 63648 <at> debbugs.gnu.org; Mon, 05 Jun 2023 03:05:59 -0400
X-GND-Sasl: juri@HIDDEN
X-GND-Sasl: juri@HIDDEN
X-GND-Sasl: juri@HIDDEN
X-GND-Sasl: juri@HIDDEN
Received: by mail.gandi.net (Postfix) with ESMTPSA id D4D0EFF80E;
 Mon,  5 Jun 2023 07:05:49 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
In-Reply-To: <jwvsfb9ajql.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
 of "Fri, 02 Jun 2023 13:07:28 -0400")
Organization: LINKOV.NET
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <482a1ebc-165c-a0a4-98c0-5c404d1b1d0d@HIDDEN>
 <86jzwyxnxb.fsf@HIDDEN>
 <feead847-869a-86a8-d62d-065871024a74@HIDDEN>
 <86o7m91z22.fsf@HIDDEN> <86pm6py6k4.fsf@HIDDEN>
 <86bki9y68h.fsf@HIDDEN> <86cz2f7bvo.fsf@HIDDEN>
 <jwvsfb9ajql.fsf-monnier+emacs@HIDDEN>
Date: Mon, 05 Jun 2023 09:50:44 +0300
Message-ID: <86jzwipf4z.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-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 63648
Cc: Dmitry Gutov <dmitry@HIDDEN>, 63648 <at> debbugs.gnu.org,
 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 (-)

>> And indeed with the following patch replacing the current definition of
>> 'project-switch-project' with just:
>>
>>   (defun project-switch-project (dir)
>>     (interactive (list (funcall project-prompter)))
>>     (setq next-default-directory dir))
>
> This would be a new "prefix command", like the `universal-argument`,
> `C-x RET c`, the `ofw-other-window`, vc-edit-next-command,
> `ofw-other-frame` from the `other-frame-window` package, and a few more.
>
> In order for this new prefix to interact correctly with those other
> ones, it should probably use `prefix-command-preserve-state` and it
> would be good to make it show some visual feedback via
> `prefix-command-echo-keystrokes-functions`.

Here is the same function turned into a prefix command,
so it supports both cases:

1. 'C-x p p d'      -- keys from project-prefix-map
2. 'C-x p p C-x d'  -- global keybindings

```
(defun project-switch-project (dir)
  (interactive (list (funcall project-prompter)))
  (if (symbolp project-switch-commands)
      (let ((default-directory dir))
        (call-interactively project-switch-commands))
    (let* ((echofun (lambda () "[switch-project]"))
           (postfun (lambda () (remove-hook
                                'prefix-command-echo-keystrokes-functions
                                echofun))))
      (setq next-default-directory dir)
      (add-hook 'prefix-command-echo-keystrokes-functions echofun)
      (message (project--keymap-prompt))
      (prefix-command-update)
      (set-transient-map project-prefix-map nil postfun))))
```

If this is conceptually ok, then more customization could be ported
from project--switch-project-command such as project-switch-use-entire-map.




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

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


Received: (at 63648) by debbugs.gnu.org; 3 Jun 2023 01:30:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jun 02 21:30:51 2023
Received: from localhost ([127.0.0.1]:41080 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q5G6U-0006Ml-PO
	for submit <at> debbugs.gnu.org; Fri, 02 Jun 2023 21:30:51 -0400
Received: from wout5-smtp.messagingengine.com ([64.147.123.21]:33611)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dmitry@HIDDEN>) id 1q5G6R-0006MT-MI
 for 63648 <at> debbugs.gnu.org; Fri, 02 Jun 2023 21:30:49 -0400
Received: from compute1.internal (compute1.nyi.internal [10.202.2.41])
 by mailout.west.internal (Postfix) with ESMTP id 384313200893;
 Fri,  2 Jun 2023 21:30:41 -0400 (EDT)
Received: from mailfrontend1 ([10.202.2.162])
 by compute1.internal (MEProxy); Fri, 02 Jun 2023 21:30:41 -0400
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=
 1685755840; x=1685842240; bh=wrIrQOFIvR1WOdHvbCO9VWjJCKIwVTbi8Zc
 LLVCv6Q0=; b=T9eEbKvbCE6vZFB61aRb4CE9I7AvLewGrrrpmYpADWFDRGQ2Z70
 TSyp1YB5bx2UT6Ru3ozbdW1pXyLHRgLj012JiDwCnnd0DkgEiwFQL4Jk5dvJtvaA
 RCA9+YpIOOrsXMbcPyIwQ2g+miPA4+O6ESz8s22sPAe3ttHYGHtF4bQjV3KVzFbP
 xWmHJxItY5G/dzziMHUBROp6Jb0JByy2G5dBhUkwZ77DUXnsKl1gwBizgJ+SY2M6
 knhuBQx/eXLjis3yGzVbwJsri7LooW9BJ5IrQFCvUD8+PTyB+G0elfeTvMw4q50Y
 VKR9DAwsjt3nuCoTlKnJgrjMJulgLFpCeBw==
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=
 1685755840; x=1685842240; bh=wrIrQOFIvR1WOdHvbCO9VWjJCKIwVTbi8Zc
 LLVCv6Q0=; b=jV2EbJ2GzEEWlAnZc/w5TOqNoFNSIinrhLnWWKsXrBUGb4ZlvsV
 HHnZ+cYdtg19WMJNPxsgP6/vP88mnNfSAwCS8xHi9cNaYXvcQxl+NPAS3EGV7GnL
 4tcFKBtKhvoLlFDB6hgIOuOBalzJJsKTxGp9Xx4WDnEOuKxeTsml6/IQ6k+0nX28
 sJq0R0kL2uuOcR7oGxGUsUgU5m9pXuFEiiVVsuQ2so1S/0P34ipvCUPGGKsm+RkF
 c51y5NyIqz1ouzytVrOWHAOLSn9zWvK/dAzjWakmnvZFYsSRLpNdS6iwmXTvBIsB
 kV9AcDAFrMtxnPDu8wRiXjDj5mpraUMP7YA==
X-ME-Sender: <xms:wJd6ZJMhQByCpttBjyIrPgV9kh7T7xEJHmPyZ2e4xaWBYw_lIFgWMg>
 <xme:wJd6ZL958lpLh0kzomeSQY2fM-lklPGvwLvzVFDgeJ1ocYri7xaBIOJAhABi8TUNP
 Klue36I1anwnz90_DM>
X-ME-Received: <xmr:wJd6ZITIE2hTGpYWHkxu9nmHXmLjgHUCs5Bsf4vAo1bO0jvEWnzC0C538ufDFCw>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeelgedggeelucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi
 thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth
 htvghrnhepiefgteevheevveffheeltdeukeeiieekueefgedugfefgefhudelgfefveel
 vdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug
 hmihhtrhihsehguhhtohhvrdguvghv
X-ME-Proxy: <xmx:wJd6ZFtkJq1_54BtA2tIupLHaYWvTvKEe_yK6neqfcFHtxtrYdCWGA>
 <xmx:wJd6ZBdBquHd04va7f-byWR6JPazna70R_UZid_PBqBysRDtW47KUg>
 <xmx:wJd6ZB39EoBCWvcQ6j0kXGyGUJWNjzWsj2cHDvFd1NHNJl3jaydw4w>
 <xmx:wJd6ZBGAxUtGashYfNjc_euaCHgUkc_rdYpAfmU6ep_0wReAKHyJzg>
Feedback-ID: i0e71465a:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri,
 2 Jun 2023 21:30:39 -0400 (EDT)
Message-ID: <0622239c-0b83-f982-9dfc-3045a14e6c06@HIDDEN>
Date: Sat, 3 Jun 2023 04:30:37 +0300
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.11.0
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
Content-Language: en-US
To: Juri Linkov <juri@HIDDEN>
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <482a1ebc-165c-a0a4-98c0-5c404d1b1d0d@HIDDEN>
 <86jzwyxnxb.fsf@HIDDEN>
 <feead847-869a-86a8-d62d-065871024a74@HIDDEN>
 <86o7m91z22.fsf@HIDDEN> <86pm6py6k4.fsf@HIDDEN>
 <86bki9y68h.fsf@HIDDEN> <86cz2f7bvo.fsf@HIDDEN>
 <e698de3a-dec8-424a-21ff-dcb5bd22c8d4@HIDDEN>
 <86353axu48.fsf@HIDDEN>
From: Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <86353axu48.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 63648
Cc: Spencer Baugh <sbaugh@HIDDEN>, 63648 <at> debbugs.gnu.org
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: -2.9 (--)

On 02/06/2023 09:40, Juri Linkov wrote:
> Indeed, such code addition better to be discussed on emacs-devel.
> But first need to ensure that it works with 'C-x p p'.
> Currently it works with keys from the global map such as
> 'C-x p p M-& pwd RET', but not with keys from 'project-prefix-map', e.g.
> 'C-x p p f'.  Maybe in addition to (setq next-default-directory dir)
> also need to use 'set-transient-map' with 'project-prefix-map'.

Here's another question: will we be able to reimplement the current 
behavior? Meaning, first of all, having a loop where the user is asked 
to use some existing binding from the menu, or from the keymap, but when 
a key is typed which does not correspond to some existing command, we 
ask again and again until the user chooses some existing one, or pressed 
C-g.

'set-transient-map' seems like a viable approach, but it will only let 
the user try once, right?




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

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


Received: (at 63648) by debbugs.gnu.org; 2 Jun 2023 17:07:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jun 02 13:07:39 2023
Received: from localhost ([127.0.0.1]:40791 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q58FX-00073E-14
	for submit <at> debbugs.gnu.org; Fri, 02 Jun 2023 13:07:39 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:13550)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1q58FV-00072y-Dc
 for 63648 <at> debbugs.gnu.org; Fri, 02 Jun 2023 13:07:38 -0400
Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 2A8A0100097;
 Fri,  2 Jun 2023 13:07:31 -0400 (EDT)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id EE76B10001C;
 Fri,  2 Jun 2023 13:07:29 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1685725650;
 bh=t4Z0rdhCuBXdlbYLfFXtkp4znfRPSjucypwCPxFWH8g=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=LRcQjD0B6LOU6OKDPDOTvUKyR7TGGc7UDr9gtLUfv4jXzCujOBGHmAIwUcfWZlFY5
 ZPXV2P40mvMJidyVI51P+u1g65EEzYqgDwDTZaXH4iXemay3jc5mXkoJ/3zRtMY7pB
 oWGecr67CQ3bqoAJLgXcyOVZ6iYKbzQgNjqSKZnpgs6Ee//ohmTzh2idVzrkh3DW+N
 duvhL9aMlw8lhgUO7GWMHprOsygQjE4RZgQNq8biFzh0U+McSNpg820+ZDKFqh4ysR
 WN2wEZakxPIfNWBHBD2aYTm2wpbQu/YSVVZAoIFOeWZ2uLWxHTF8I5vjCxChQyarWq
 /IwaQvmMCKtMw==
Received: from alfajor (unknown [184.148.243.248])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id C4415120476;
 Fri,  2 Jun 2023 13:07:29 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
In-Reply-To: <86cz2f7bvo.fsf@HIDDEN> (Juri Linkov's message of "Thu, 
 01 Jun 2023 19:05:07 +0300")
Message-ID: <jwvsfb9ajql.fsf-monnier+emacs@HIDDEN>
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <482a1ebc-165c-a0a4-98c0-5c404d1b1d0d@HIDDEN>
 <86jzwyxnxb.fsf@HIDDEN>
 <feead847-869a-86a8-d62d-065871024a74@HIDDEN>
 <86o7m91z22.fsf@HIDDEN> <86pm6py6k4.fsf@HIDDEN>
 <86bki9y68h.fsf@HIDDEN> <86cz2f7bvo.fsf@HIDDEN>
Date: Fri, 02 Jun 2023 13:07:28 -0400
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
 DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
 domain T_SCC_BODY_TEXT_LINE    -0.01 -
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 63648
Cc: Dmitry Gutov <dmitry@HIDDEN>, 63648 <at> debbugs.gnu.org,
 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: -3.3 (---)

> And indeed with the following patch replacing the current definition of
> 'project-switch-project' with just:
>
>   (defun project-switch-project (dir)
>     (interactive (list (funcall project-prompter)))
>     (setq next-default-directory dir))

This would be a new "prefix command", like the `universal-argument`,
`C-x RET c`, the `ofw-other-window`, vc-edit-next-command,
`ofw-other-frame` from the `other-frame-window` package, and a few more.

In order for this new prefix to interact correctly with those other
ones, it should probably use `prefix-command-preserve-state` and it
would be good to make it show some visual feedback via
`prefix-command-echo-keystrokes-functions`.

[ Side note: take my opinion with a grain of salt, because I can't
  understand why the above would Do The Right Thing wrt the command's
  docstring.  ]


        Stefan





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

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


Received: (at 63648) by debbugs.gnu.org; 2 Jun 2023 16:16:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jun 02 12:16:52 2023
Received: from localhost ([127.0.0.1]:40748 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q57SO-0005Wq-L1
	for submit <at> debbugs.gnu.org; Fri, 02 Jun 2023 12:16:52 -0400
Received: from relay5-d.mail.gandi.net ([217.70.183.197]:34217)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1q57SN-0005WS-A3
 for 63648 <at> debbugs.gnu.org; Fri, 02 Jun 2023 12:16:51 -0400
X-GND-Sasl: juri@HIDDEN
X-GND-Sasl: juri@HIDDEN
X-GND-Sasl: juri@HIDDEN
X-GND-Sasl: juri@HIDDEN
X-GND-Sasl: juri@HIDDEN
Received: by mail.gandi.net (Postfix) with ESMTPSA id 04B051C0002;
 Fri,  2 Jun 2023 16:16:43 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
In-Reply-To: <83leh2ayai.fsf@HIDDEN> (Eli Zaretskii's message of "Fri, 02 Jun
 2023 14:39:17 +0300")
Organization: LINKOV.NET
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <482a1ebc-165c-a0a4-98c0-5c404d1b1d0d@HIDDEN>
 <86jzwyxnxb.fsf@HIDDEN>
 <feead847-869a-86a8-d62d-065871024a74@HIDDEN>
 <86o7m91z22.fsf@HIDDEN> <86pm6py6k4.fsf@HIDDEN>
 <86bki9y68h.fsf@HIDDEN> <86cz2f7bvo.fsf@HIDDEN>
 <83ttvqbch1.fsf@HIDDEN> <86v8g6uzdj.fsf@HIDDEN>
 <83leh2ayai.fsf@HIDDEN>
Date: Fri, 02 Jun 2023 19:11:39 +0300
Message-ID: <86cz2dub0s.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-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 63648
Cc: dmitry@HIDDEN, monnier@HIDDEN, 63648 <at> debbugs.gnu.org,
 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 (-)

>> >> @@ -1500,7 +1500,19 @@ command_loop_1 (void)
>> >>  	    update_redisplay_ticks (0, NULL);
>> >>  	    display_working_on_window_p = false;
>> >>  
>> >> +            Lisp_Object next_dir = Vnext_default_directory;
>> >> +            specpdl_ref count = SPECPDL_INDEX ();
>> >> +            if (!NILP (next_dir))
>> >> +              specbind (Qdefault_directory, next_dir);
>> >> +
>> >>              call1 (Qcommand_execute, Vthis_command);
>> >> +
>> >> +            if (!NILP (next_dir))
>> >> +              {
>> >> +                unbind_to (count, Qnil);
>> >> +                Vnext_default_directory = Qnil;
>> >> +              }
>> >> +
>> >
>> > What will this do when a command is invoked via call-interactively?
>>
>> This is intended only for commands called interactively.
>
> Won't this violate some legitimate expectations?  Namely, that
> invoking a command interactively and via call-interactively produces
> the same results?

When needed this could be added to call-interactively as well
if there is no common code to share between these two.




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

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


Received: (at 63648) by debbugs.gnu.org; 2 Jun 2023 16:16:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jun 02 12:16:50 2023
Received: from localhost ([127.0.0.1]:40745 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q57SM-0005Wc-BD
	for submit <at> debbugs.gnu.org; Fri, 02 Jun 2023 12:16:50 -0400
Received: from relay9-d.mail.gandi.net ([217.70.183.199]:44431)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1q57SK-0005WN-6c
 for 63648 <at> debbugs.gnu.org; Fri, 02 Jun 2023 12:16:49 -0400
X-GND-Sasl: juri@HIDDEN
X-GND-Sasl: juri@HIDDEN
X-GND-Sasl: juri@HIDDEN
X-GND-Sasl: juri@HIDDEN
Received: by mail.gandi.net (Postfix) with ESMTPSA id 72902FF805;
 Fri,  2 Jun 2023 16:16:39 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
In-Reply-To: <838rd2av6e.fsf@HIDDEN> (Eli Zaretskii's message of "Fri, 02 Jun
 2023 15:46:33 +0300")
Organization: LINKOV.NET
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <482a1ebc-165c-a0a4-98c0-5c404d1b1d0d@HIDDEN>
 <86jzwyxnxb.fsf@HIDDEN>
 <feead847-869a-86a8-d62d-065871024a74@HIDDEN>
 <86o7m91z22.fsf@HIDDEN> <86pm6py6k4.fsf@HIDDEN>
 <86bki9y68h.fsf@HIDDEN> <86cz2f7bvo.fsf@HIDDEN>
 <e698de3a-dec8-424a-21ff-dcb5bd22c8d4@HIDDEN>
 <838rd2av6e.fsf@HIDDEN>
Date: Fri, 02 Jun 2023 19:09:08 +0300
Message-ID: <86o7lxub4z.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-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 63648
Cc: Dmitry Gutov <dmitry@HIDDEN>, 63648 <at> debbugs.gnu.org,
 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 (-)

>> > 'C-x p p (select project ...) RET M-& pwd RET' confirms that
>> > the command runs in the selected project directory.
>> > Whereas the original buffer keeps its previous buffer-local value
>> > of 'default-directory'.
>>
>> I suggest you bring up this feature addition on emacs-devel, or
>> otherwise wait for a review from Eli, at least.
>>
>> It's not a big addition, but it's a distinct new feature (the
>> next-default-directory var).
>
> I guess I wasn't following this discussion closely enough, because I
> don't understand why my review is being sought.  Is this something
> proposed for the emacs-29 branch?

Luckily this new feature is not for the emacs-29 branch.




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

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


Received: (at 63648) by debbugs.gnu.org; 2 Jun 2023 12:45:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jun 02 08:45:53 2023
Received: from localhost ([127.0.0.1]:39285 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q54AD-0008M8-Cb
	for submit <at> debbugs.gnu.org; Fri, 02 Jun 2023 08:45:53 -0400
Received: from eggs.gnu.org ([209.51.188.92]:34454)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1q54AA-0008Lq-QU
 for 63648 <at> debbugs.gnu.org; Fri, 02 Jun 2023 08:45:52 -0400
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 1q54A4-0003rk-Pv; Fri, 02 Jun 2023 08:45:44 -0400
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=tdlFtzLn+PD90TnQTSyW6tpHahtVJaCRJ1YbLuHfk1Q=; b=cv/ZGKEXMOpl
 h/SKgbS73yza+T3EBtyehKf5+wwYNVWIJU4XUu5xzYjM5KEIEYxgZhvWx1pGsN9Zi/CPQQX4OQfDf
 c852LH2iRfVsXxcunYWTWwCDATNMqwkQ93Q+RUYqnizxpbQidMymI8gPT/5KR+6VUJQ/Cs7YsEq/d
 xN13kV7ulGo1VIrNAZCHA1O8uOt70685TyKo2c6Ly+wAfoKZTz3XcpR46GrIOpa+HDs2iCtGU2Gkd
 uOQNHX1OfDjvekKfpvstuVsbIBNvsdaciu2nshR9OUG1OJzgK+hGuYjhgYvFeMGOVSSKvBElmCgDN
 haYD0NnIaExUcTd8AAlgiA==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1q54A4-0008En-5V; Fri, 02 Jun 2023 08:45:44 -0400
Date: Fri, 02 Jun 2023 15:46:33 +0300
Message-Id: <838rd2av6e.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <e698de3a-dec8-424a-21ff-dcb5bd22c8d4@HIDDEN> (message from
 Dmitry Gutov on Fri, 2 Jun 2023 04:40:28 +0300)
Subject: Re: bug#63648: 29.0.90;
 project.el: with switch-use-entire-map, switch-project errors on
 non-project commands
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <482a1ebc-165c-a0a4-98c0-5c404d1b1d0d@HIDDEN>
 <86jzwyxnxb.fsf@HIDDEN>
 <feead847-869a-86a8-d62d-065871024a74@HIDDEN>
 <86o7m91z22.fsf@HIDDEN> <86pm6py6k4.fsf@HIDDEN>
 <86bki9y68h.fsf@HIDDEN> <86cz2f7bvo.fsf@HIDDEN>
 <e698de3a-dec8-424a-21ff-dcb5bd22c8d4@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 63648
Cc: sbaugh@HIDDEN, 63648 <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.3 (---)

> Cc: Spencer Baugh <sbaugh@HIDDEN>, 63648 <at> debbugs.gnu.org
> Date: Fri, 2 Jun 2023 04:40:28 +0300
> From: Dmitry Gutov <dmitry@HIDDEN>
> 
> > 'C-x p p (select project ...) RET M-& pwd RET' confirms that
> > the command runs in the selected project directory.
> > Whereas the original buffer keeps its previous buffer-local value
> > of 'default-directory'.
> 
> I suggest you bring up this feature addition on emacs-devel, or 
> otherwise wait for a review from Eli, at least.
> 
> It's not a big addition, but it's a distinct new feature (the 
> next-default-directory var).

I guess I wasn't following this discussion closely enough, because I
don't understand why my review is being sought.  Is this something
proposed for the emacs-29 branch?




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

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


Received: (at 63648) by debbugs.gnu.org; 2 Jun 2023 11:38:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jun 02 07:38:39 2023
Received: from localhost ([127.0.0.1]:39185 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q5378-0001CV-SM
	for submit <at> debbugs.gnu.org; Fri, 02 Jun 2023 07:38:39 -0400
Received: from eggs.gnu.org ([209.51.188.92]:45514)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1q5376-0001CH-31
 for 63648 <at> debbugs.gnu.org; Fri, 02 Jun 2023 07:38:37 -0400
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 1q536z-0008Ga-WD; Fri, 02 Jun 2023 07:38:30 -0400
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=7AD7khTImirZJ6Oj+EUJL7Em7LpjJ3n7x7Q3YS4mTSQ=; b=ffxwuiVEVlAm
 Rl0IHl3l+UP+Jo/GUF61AiWrF5TjQ8CdIrjEfGb3zeNuVkU/famjyHHzKfNEQYuMyMzrFgaEr9WJo
 fCyNP7AOSVDjoE+hmDHFa6otT4i9eLlzw1wtTfjV2FRUZ3kfEN5DTlu3wgPxIBqARYbiK09wQXKz9
 msmU/Q3JWssr+13vrYCSnDayGpT4samdoGcQ30ZkDJJMXLqjPk/edxRZIBkz/vIP3CCN6274BU4aG
 8jvS4mR4Dd0sPJ6Pm9I9bRz129/O/TgXvCzmI9ulBt5VpW3PWjCzUaQYDFd/lUrLMnKb8ytlUY+zk
 P2IU0+RWQFXx64kD32QA6g==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1q536z-0006SO-7D; Fri, 02 Jun 2023 07:38:29 -0400
Date: Fri, 02 Jun 2023 14:39:17 +0300
Message-Id: <83leh2ayai.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
In-Reply-To: <86v8g6uzdj.fsf@HIDDEN> (message from Juri Linkov on
 Fri, 02 Jun 2023 09:55:36 +0300)
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <482a1ebc-165c-a0a4-98c0-5c404d1b1d0d@HIDDEN>
 <86jzwyxnxb.fsf@HIDDEN>
 <feead847-869a-86a8-d62d-065871024a74@HIDDEN>
 <86o7m91z22.fsf@HIDDEN> <86pm6py6k4.fsf@HIDDEN>
 <86bki9y68h.fsf@HIDDEN> <86cz2f7bvo.fsf@HIDDEN>
 <83ttvqbch1.fsf@HIDDEN> <86v8g6uzdj.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 63648
Cc: dmitry@HIDDEN, monnier@HIDDEN, 63648 <at> debbugs.gnu.org,
 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: -3.3 (---)

> From: Juri Linkov <juri@HIDDEN>
> Cc: Stefan Monnier <monnier@HIDDEN>,  dmitry@HIDDEN,
>   sbaugh@HIDDEN,  63648 <at> debbugs.gnu.org
> Date: Fri, 02 Jun 2023 09:55:36 +0300
> 
> >> @@ -1500,7 +1500,19 @@ command_loop_1 (void)
> >>  	    update_redisplay_ticks (0, NULL);
> >>  	    display_working_on_window_p = false;
> >>  
> >> +            Lisp_Object next_dir = Vnext_default_directory;
> >> +            specpdl_ref count = SPECPDL_INDEX ();
> >> +            if (!NILP (next_dir))
> >> +              specbind (Qdefault_directory, next_dir);
> >> +
> >>              call1 (Qcommand_execute, Vthis_command);
> >> +
> >> +            if (!NILP (next_dir))
> >> +              {
> >> +                unbind_to (count, Qnil);
> >> +                Vnext_default_directory = Qnil;
> >> +              }
> >> +
> >
> > What will this do when a command is invoked via call-interactively?
> 
> This is intended only for commands called interactively.

Won't this violate some legitimate expectations?  Namely, that
invoking a command interactively and via call-interactively produces
the same results?




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

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


Received: (at 63648) by debbugs.gnu.org; 2 Jun 2023 07:05:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jun 02 03:05:43 2023
Received: from localhost ([127.0.0.1]:39017 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q4yr0-00086j-Vs
	for submit <at> debbugs.gnu.org; Fri, 02 Jun 2023 03:05:43 -0400
Received: from relay2-d.mail.gandi.net ([217.70.183.194]:46711)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1q4yqz-00086H-2p
 for 63648 <at> debbugs.gnu.org; Fri, 02 Jun 2023 03:05:41 -0400
X-GND-Sasl: juri@HIDDEN
X-GND-Sasl: juri@HIDDEN
X-GND-Sasl: juri@HIDDEN
X-GND-Sasl: juri@HIDDEN
X-GND-Sasl: juri@HIDDEN
Received: by mail.gandi.net (Postfix) with ESMTPSA id D77B540008;
 Fri,  2 Jun 2023 07:05:33 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
In-Reply-To: <83ttvqbch1.fsf@HIDDEN> (Eli Zaretskii's message of "Fri, 02 Jun
 2023 09:32:58 +0300")
Organization: LINKOV.NET
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <482a1ebc-165c-a0a4-98c0-5c404d1b1d0d@HIDDEN>
 <86jzwyxnxb.fsf@HIDDEN>
 <feead847-869a-86a8-d62d-065871024a74@HIDDEN>
 <86o7m91z22.fsf@HIDDEN> <86pm6py6k4.fsf@HIDDEN>
 <86bki9y68h.fsf@HIDDEN> <86cz2f7bvo.fsf@HIDDEN>
 <83ttvqbch1.fsf@HIDDEN>
Date: Fri, 02 Jun 2023 09:55:36 +0300
Message-ID: <86v8g6uzdj.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-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 63648
Cc: dmitry@HIDDEN, Stefan Monnier <monnier@HIDDEN>,
 63648 <at> debbugs.gnu.org, 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 (-)

>> @@ -1500,7 +1500,19 @@ command_loop_1 (void)
>>  	    update_redisplay_ticks (0, NULL);
>>  	    display_working_on_window_p = false;
>>  
>> +            Lisp_Object next_dir = Vnext_default_directory;
>> +            specpdl_ref count = SPECPDL_INDEX ();
>> +            if (!NILP (next_dir))
>> +              specbind (Qdefault_directory, next_dir);
>> +
>>              call1 (Qcommand_execute, Vthis_command);
>> +
>> +            if (!NILP (next_dir))
>> +              {
>> +                unbind_to (count, Qnil);
>> +                Vnext_default_directory = Qnil;
>> +              }
>> +
>
> What will this do when a command is invoked via call-interactively?

This is intended only for commands called interactively.




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

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


Received: (at 63648) by debbugs.gnu.org; 2 Jun 2023 07:05:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jun 02 03:05:35 2023
Received: from localhost ([127.0.0.1]:39011 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q4yqt-00086A-CC
	for submit <at> debbugs.gnu.org; Fri, 02 Jun 2023 03:05:35 -0400
Received: from relay2-d.mail.gandi.net ([217.70.183.194]:56029)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1q4yqs-00085Z-1G
 for 63648 <at> debbugs.gnu.org; Fri, 02 Jun 2023 03:05:34 -0400
X-GND-Sasl: juri@HIDDEN
X-GND-Sasl: juri@HIDDEN
Received: by mail.gandi.net (Postfix) with ESMTPSA id E00F540002;
 Fri,  2 Jun 2023 07:05:27 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Spencer Baugh <sbaugh@HIDDEN>
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
In-Reply-To: <iersfbazzz3.fsf@HIDDEN> (Spencer Baugh's message of
 "Thu, 01 Jun 2023 16:31:28 -0400")
Organization: LINKOV.NET
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <iera5xt7p9u.fsf@HIDDEN> <864jo11yvp.fsf@HIDDEN>
 <ier5y8f6s2p.fsf@HIDDEN> <86v8g98zw6.fsf@HIDDEN>
 <iersfbazzz3.fsf@HIDDEN>
Date: Fri, 02 Jun 2023 09:46:25 +0300
Message-ID: <86h6rqwena.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-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 63648
Cc: 63648 <at> debbugs.gnu.org
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 (-)

>>>>>>> (Tangential further thought: I wonder if we could make C-x p work
>>>>>>> as a prefix for all commands automatically, so for example
>>>>>>> C-x p C-x C-j would open the project root,
>>
>> I just noticed that 'C-x p C-x C-j' would open the parent directory
>> of the project root, not the root itself, since 'C-x C-j' in the root
>> jumps to its parent.
>
> Only in dired buffers.  If not in dired, and not in a file-visiting
> buffer, it just goes to default-directory.

You are right, I tried with the next-default-directory patch,
and it works like you described.

> That is kind of annoying for making C-x p p C-x C-j go to the root,
> though, because its behavior will depend on the current buffer...  Maybe
> C-x p p can switch buffers before running the command?

Alas, can't switch buffers because such commands as 'C-x p g'
read the default value from the current buffer.

> Or maybe we can just change how C-x C-j behaves so it works
> intuitively with C-x p p?

The problem is in 'C-x C-j'.  In dired buffers it uses the value of
'dired-subdir-alist' instead of 'default-directory', so the patch with
'next-default-directory' doesn't help.




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

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


Received: (at 63648) by debbugs.gnu.org; 2 Jun 2023 07:05:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jun 02 03:05:34 2023
Received: from localhost ([127.0.0.1]:39008 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q4yqs-00085x-1w
	for submit <at> debbugs.gnu.org; Fri, 02 Jun 2023 03:05:34 -0400
Received: from relay7-d.mail.gandi.net ([217.70.183.200]:51905)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1q4yqp-00085W-Oo
 for 63648 <at> debbugs.gnu.org; Fri, 02 Jun 2023 03:05:32 -0400
X-GND-Sasl: juri@HIDDEN
X-GND-Sasl: juri@HIDDEN
X-GND-Sasl: juri@HIDDEN
Received: by mail.gandi.net (Postfix) with ESMTPSA id C31A02000F;
 Fri,  2 Jun 2023 07:05:24 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Dmitry Gutov <dmitry@HIDDEN>
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
In-Reply-To: <e698de3a-dec8-424a-21ff-dcb5bd22c8d4@HIDDEN> (Dmitry Gutov's
 message of "Fri, 2 Jun 2023 04:40:28 +0300")
Organization: LINKOV.NET
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <482a1ebc-165c-a0a4-98c0-5c404d1b1d0d@HIDDEN>
 <86jzwyxnxb.fsf@HIDDEN>
 <feead847-869a-86a8-d62d-065871024a74@HIDDEN>
 <86o7m91z22.fsf@HIDDEN> <86pm6py6k4.fsf@HIDDEN>
 <86bki9y68h.fsf@HIDDEN> <86cz2f7bvo.fsf@HIDDEN>
 <e698de3a-dec8-424a-21ff-dcb5bd22c8d4@HIDDEN>
Date: Fri, 02 Jun 2023 09:40:55 +0300
Message-ID: <86353axu48.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-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 63648
Cc: Spencer Baugh <sbaugh@HIDDEN>, 63648 <at> debbugs.gnu.org
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 (-)

>>>> 1. the current buffer should remain the same for the next command;
>>>> 2. the buffer-local value of 'default-directory' should remain the same;
>>>> 3. the next command should have a new value of 'default-directory'.
>>>>
>>>> I see no way to satisfy all these requirements.
>>>
>>> Except adding a variable like 'project-current-directory-override'
>>> somewhere inside 'command_loop_1'.
>> And indeed with the following patch replacing the current definition of
>> 'project-switch-project' with just:
>>    (defun project-switch-project (dir)
>>      (interactive (list (funcall project-prompter)))
>>      (setq next-default-directory dir))
>
> Note that we'd need to keep the previous implementation for a number of
> years anyway, to retain compatibility with older emacsen.

Then some version-depending condition could be added.

>> 'C-x p p (select project ...) RET M-& pwd RET' confirms that
>> the command runs in the selected project directory.
>> Whereas the original buffer keeps its previous buffer-local value
>> of 'default-directory'.
>
> I suggest you bring up this feature addition on emacs-devel, or otherwise
> wait for a review from Eli, at least.
>
> It's not a big addition, but it's a distinct new feature (the
> next-default-directory var).

Indeed, such code addition better to be discussed on emacs-devel.
But first need to ensure that it works with 'C-x p p'.
Currently it works with keys from the global map such as
'C-x p p M-& pwd RET', but not with keys from 'project-prefix-map', e.g.
'C-x p p f'.  Maybe in addition to (setq next-default-directory dir)
also need to use 'set-transient-map' with 'project-prefix-map'.




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

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


Received: (at 63648) by debbugs.gnu.org; 2 Jun 2023 06:33:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jun 02 02:33:08 2023
Received: from localhost ([127.0.0.1]:38985 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q4yLU-0007Dc-BT
	for submit <at> debbugs.gnu.org; Fri, 02 Jun 2023 02:33:08 -0400
Received: from eggs.gnu.org ([209.51.188.92]:35946)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1q4yLS-0007D7-Qb
 for 63648 <at> debbugs.gnu.org; Fri, 02 Jun 2023 02:33:07 -0400
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 1q4yLM-0002P5-UW; Fri, 02 Jun 2023 02:33:00 -0400
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=bg4DszXjNuER6heKutcM7b1hhLg3XK6VgyHDFVmjn1A=; b=DGmbs+5q84cj
 jhSeeIjxQmOhXzwq/BNvgpYipru5ChA4c+hMdZHYEOqh3JzTg1JQUEzYVGFcv7iz4cNgtyc8GLRNP
 JzA0VFR1hBOSs0FPrYHBNRD61QbyiS1NS1HDRHlKO8PdIoP4/o3Tb2JAORtOV4mLN0oSP2Z6cRDeV
 O6yhChhoK3WexL2Qwaf4UetzmGF1CE3c1QmyIa2qXDNui9Rrfb8tpOKFINrey9h8QeSghdTmcl5s6
 Mu8lEqFcPOdnL2rmak4SYfid5H+5ziNfROk1DmeUWXz8/tJjWB3RnNkWE5M4HwvKcVvuLpcTBHDEo
 8d0Ngr8MY++On/EWRKSaGA==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1q4yLK-00083p-83; Fri, 02 Jun 2023 02:32:58 -0400
Date: Fri, 02 Jun 2023 09:33:46 +0300
Message-Id: <83sfbabcfp.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Drew Adams <drew.adams@HIDDEN>
In-Reply-To: <SJ0PR10MB548868CAC95575854AE72473F349A@HIDDEN>
 (message from Drew Adams on Thu, 1 Jun 2023 21:09:28 +0000)
Subject: Re: bug#63648: 29.0.90;
 project.el: with switch-use-entire-map, switch-project errors on
 non-project commands
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <iera5xt7p9u.fsf@HIDDEN> <864jo11yvp.fsf@HIDDEN>
 <ier5y8f6s2p.fsf@HIDDEN> <86v8g98zw6.fsf@HIDDEN>
 <iersfbazzz3.fsf@HIDDEN>
 <SJ0PR10MB548868CAC95575854AE72473F349A@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 63648
Cc: sbaugh@HIDDEN, 63648 <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.3 (---)

> Cc: "63648 <at> debbugs.gnu.org" <63648 <at> debbugs.gnu.org>
> From: Drew Adams <drew.adams@HIDDEN>
> Date: Thu, 1 Jun 2023 21:09:28 +0000
> 
> > Or maybe we can just change how C-x C-j
> > behaves so it works intuitively with C-x p p?	
> 
> Please don't change C-x C-j.

Don't worry, it won't change.




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

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


Received: (at 63648) by debbugs.gnu.org; 2 Jun 2023 06:32:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jun 02 02:32:21 2023
Received: from localhost ([127.0.0.1]:38980 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q4yKi-0007CC-SL
	for submit <at> debbugs.gnu.org; Fri, 02 Jun 2023 02:32:21 -0400
Received: from eggs.gnu.org ([209.51.188.92]:36824)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1q4yKe-0007Bx-Qi
 for 63648 <at> debbugs.gnu.org; Fri, 02 Jun 2023 02:32:20 -0400
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 1q4yKX-0002Gn-V4; Fri, 02 Jun 2023 02:32:09 -0400
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=xYVZ2WKHpVM1vL0KJpH0Cw4JYdaAlONzz3wibMxKajY=; b=PobKP0oapVYv
 9LUAYnFrxw9dhGBVpji98ovGUw5e1bmNz4lfhL/n7WSdUhD3Qi5JBST9+lZ45D9KKov7pigdCGSQq
 JPMgPdk6/a9/+1LOQM82RuQHyruSmtfv6Xuob18nNhIOEwJOFVOratgsYMd9dj5agXb8XOiZAN5HG
 rYDryxMCnMJJKowUUMqo17huMapnwRbdq3535tSztG6SYF0O4YZnEmfaUtVXjbqhnZho3j6WFc0Nl
 D6qgrRirTJ9yE2g/YZIgxX4CmxniLObp1r2bCYYKOsbNUTSSTgiaVkbbNwWaEQ4ra5QYwQJPrsMMQ
 ssg4JpmtEYVRjSupfNUXLA==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1q4yKX-00067Y-II; Fri, 02 Jun 2023 02:32:09 -0400
Date: Fri, 02 Jun 2023 09:32:58 +0300
Message-Id: <83ttvqbch1.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Juri Linkov <juri@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>
In-Reply-To: <86cz2f7bvo.fsf@HIDDEN> (message from Juri Linkov on
 Thu, 01 Jun 2023 19:05:07 +0300)
Subject: Re: bug#63648: 29.0.90;
 project.el: with switch-use-entire-map, switch-project errors on
 non-project commands
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <482a1ebc-165c-a0a4-98c0-5c404d1b1d0d@HIDDEN>
 <86jzwyxnxb.fsf@HIDDEN>
 <feead847-869a-86a8-d62d-065871024a74@HIDDEN>
 <86o7m91z22.fsf@HIDDEN> <86pm6py6k4.fsf@HIDDEN>
 <86bki9y68h.fsf@HIDDEN> <86cz2f7bvo.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 63648
Cc: dmitry@HIDDEN, 63648 <at> debbugs.gnu.org, 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: -3.3 (---)

> Cc: Spencer Baugh <sbaugh@HIDDEN>, 63648 <at> debbugs.gnu.org
> From: Juri Linkov <juri@HIDDEN>
> Date: Thu, 01 Jun 2023 19:05:07 +0300
> 
> And indeed with the following patch replacing the current definition of
> 'project-switch-project' with just:
> 
>   (defun project-switch-project (dir)
>     (interactive (list (funcall project-prompter)))
>     (setq next-default-directory dir))
> 
> 'C-x p p (select project ...) RET M-& pwd RET' confirms that
> the command runs in the selected project directory.
> Whereas the original buffer keeps its previous buffer-local value
> of 'default-directory'.
> 
> diff --git a/src/buffer.c b/src/buffer.c
> index 0c46b201586..ca81db21894 100644
> --- a/src/buffer.c
> +++ b/src/buffer.c
> @@ -5360,6 +5360,10 @@ syms_of_buffer (void)
>  these names start with `/' or `~' and end with `/'.
>  To interactively change the default directory, use command `cd'. */);
>  
> +  DEFVAR_LISP ("next-default-directory", Vnext_default_directory,
> +	       doc: /* Default directory for the next command.  */);
> +  Vnext_default_directory = Qnil;
> +
>    DEFVAR_PER_BUFFER ("auto-fill-function", &BVAR (current_buffer, auto_fill_function),
>  		     Qnil,
>  		     doc: /* Function called (if non-nil) to perform auto-fill.
> diff --git a/src/keyboard.c b/src/keyboard.c
> index 14c55666768..dfe939750c9 100644
> --- a/src/keyboard.c
> +++ b/src/keyboard.c
> @@ -1500,7 +1500,19 @@ command_loop_1 (void)
>  	    update_redisplay_ticks (0, NULL);
>  	    display_working_on_window_p = false;
>  
> +            Lisp_Object next_dir = Vnext_default_directory;
> +            specpdl_ref count = SPECPDL_INDEX ();
> +            if (!NILP (next_dir))
> +              specbind (Qdefault_directory, next_dir);
> +
>              call1 (Qcommand_execute, Vthis_command);
> +
> +            if (!NILP (next_dir))
> +              {
> +                unbind_to (count, Qnil);
> +                Vnext_default_directory = Qnil;
> +              }
> +
>  	    display_working_on_window_p = false;
>  
>  #ifdef HAVE_WINDOW_SYSTEM

What will this do when a command is invoked via call-interactively?




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

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


Received: (at 63648) by debbugs.gnu.org; 2 Jun 2023 01:40:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jun 01 21:40:41 2023
Received: from localhost ([127.0.0.1]:38688 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q4tmT-000541-6h
	for submit <at> debbugs.gnu.org; Thu, 01 Jun 2023 21:40:41 -0400
Received: from wout4-smtp.messagingengine.com ([64.147.123.20]:58855)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dmitry@HIDDEN>) id 1q4tmQ-00053m-PK
 for 63648 <at> debbugs.gnu.org; Thu, 01 Jun 2023 21:40:40 -0400
Received: from compute4.internal (compute4.nyi.internal [10.202.2.44])
 by mailout.west.internal (Postfix) with ESMTP id 7E2FD3200916;
 Thu,  1 Jun 2023 21:40:32 -0400 (EDT)
Received: from mailfrontend1 ([10.202.2.162])
 by compute4.internal (MEProxy); Thu, 01 Jun 2023 21:40:32 -0400
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=
 1685670032; x=1685756432; bh=fyRIOteyQ7YzDb4ygoVDp+sZgwnvgMxFuCO
 PybvTNBw=; b=N5xU6m51BGKh0pLsBbBnxU7uZqprkH6lKWKcmo3aBwZifNszXjr
 ipbBmj9kAnFBdHMALlk7GeI3rdWNYj/0fv3uxy66hZhJbpCq2Vm7ylCclQNWFU/5
 OoalIYIt9npzPzN7gyhTUnYeYKRItVtE90YP2QJ8uocFh8XFgP7gkxtzrtn1VKnv
 pYFzQTV89BovVOd3J/xDQ2m7k3Fdqg86VKSkdrpBOGC32hQ/66twiSQRGqJ0o436
 XHhQ+QGHJk+e3p1a5DuTr0U9DWRSZN+WtD7SNPcwtazg70nBmLqRJWgbPdqDP9P4
 Fr3ZCpLvIWj+QvP46eS1+2gYwclJYBYgevQ==
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=
 1685670032; x=1685756432; bh=fyRIOteyQ7YzDb4ygoVDp+sZgwnvgMxFuCO
 PybvTNBw=; b=gFwI9qlxLUedKDTdjkYgDJB67JlpavznJPcznD6dISjpC6HM+Am
 snYpopeUx8HO2c8GeIdQpPUT7zNGavgOBtTio8dIub7dmOfQh73X0MV4rZfAZdTG
 QEe3/B1nTuJ4Zr9dbaqzSPbIwR/OBcz17WmDXZ8w+JCe3qH8khRLL3uIaAKs/74u
 jRXHHa3sUDQB+md20kvDhy5gWEwmm0ure4FKjp5wSpFQwSLB/Ds+u0XI95t6QlyF
 Lgq8IHI6OUqC0oczkEgkhbrUdbMKiAgo4XKeJnoIgANlRKjnJYDqtS7VXwv174FO
 E5bNXpZKOG+d9lPaGllHG9fxtbNZD0L3o3w==
X-ME-Sender: <xms:j0h5ZGCqvdiGZi6EMwAgWi6zgakKaUCiXHPh99W7fjIEXXg6SwS35g>
 <xme:j0h5ZAjnSUjSN9dYFQ-3tLxepBnLvWsc2GDSeaxhzXS1shVV0TWyKbPctuPtm4nnq
 ldrbQgcHLP79zPhmXE>
X-ME-Received: <xmr:j0h5ZJnmyA8fOz9Dfr59tAKS1G6ifeTOQeL-mISJhMj-XuIqFptsfhdQLOgqmcI>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeelvddghedtucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi
 thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth
 htvghrnhepiefgteevheevveffheeltdeukeeiieekueefgedugfefgefhudelgfefveel
 vdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug
 hmihhtrhihsehguhhtohhvrdguvghv
X-ME-Proxy: <xmx:j0h5ZEwRp78io9Eawq95eKd8ew4XsE1auKq084tNNY-CoeNVmI8wdQ>
 <xmx:j0h5ZLRpAMpzmb8ljA4I9O2eOjNdSfhCOJu3vR46WDkNen2ONy-fZw>
 <xmx:j0h5ZPZV-2uevY8yBa64Ag6ixRqQbf1T26TuVqJwLdDf4N3kSsJjfA>
 <xmx:kEh5ZCJ6mkenKgXSs0JdruF0_9lW0PfYcnAYjrXNeKav5rFQpF76AA>
Feedback-ID: i0e71465a:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu,
 1 Jun 2023 21:40:30 -0400 (EDT)
Message-ID: <e698de3a-dec8-424a-21ff-dcb5bd22c8d4@HIDDEN>
Date: Fri, 2 Jun 2023 04:40:28 +0300
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.11.0
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
Content-Language: en-US
To: Juri Linkov <juri@HIDDEN>
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <482a1ebc-165c-a0a4-98c0-5c404d1b1d0d@HIDDEN>
 <86jzwyxnxb.fsf@HIDDEN>
 <feead847-869a-86a8-d62d-065871024a74@HIDDEN>
 <86o7m91z22.fsf@HIDDEN> <86pm6py6k4.fsf@HIDDEN>
 <86bki9y68h.fsf@HIDDEN> <86cz2f7bvo.fsf@HIDDEN>
From: Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <86cz2f7bvo.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 63648
Cc: Spencer Baugh <sbaugh@HIDDEN>, 63648 <at> debbugs.gnu.org
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: -2.9 (--)

On 01/06/2023 19:05, Juri Linkov wrote:
>>> 1. the current buffer should remain the same for the next command;
>>> 2. the buffer-local value of 'default-directory' should remain the same;
>>> 3. the next command should have a new value of 'default-directory'.
>>>
>>> I see no way to satisfy all these requirements.
>>
>> Except adding a variable like 'project-current-directory-override'
>> somewhere inside 'command_loop_1'.
> 
> And indeed with the following patch replacing the current definition of
> 'project-switch-project' with just:
> 
>    (defun project-switch-project (dir)
>      (interactive (list (funcall project-prompter)))
>      (setq next-default-directory dir))

Note that we'd need to keep the previous implementation for a number of 
years anyway, to retain compatibility with older emacsen.

> 'C-x p p (select project ...) RET M-& pwd RET' confirms that
> the command runs in the selected project directory.
> Whereas the original buffer keeps its previous buffer-local value
> of 'default-directory'.

I suggest you bring up this feature addition on emacs-devel, or 
otherwise wait for a review from Eli, at least.

It's not a big addition, but it's a distinct new feature (the 
next-default-directory var).




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

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


Received: (at 63648) by debbugs.gnu.org; 1 Jun 2023 21:09:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jun 01 17:09:38 2023
Received: from localhost ([127.0.0.1]:38625 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q4pYA-0001OP-9x
	for submit <at> debbugs.gnu.org; Thu, 01 Jun 2023 17:09:38 -0400
Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]:45032)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <drew.adams@HIDDEN>) id 1q4pY7-0001OF-69
 for 63648 <at> debbugs.gnu.org; Thu, 01 Jun 2023 17:09:37 -0400
Received: from pps.filterd (m0333521.ppops.net [127.0.0.1])
 by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id
 351E4u5O008639; Thu, 1 Jun 2023 21:09:33 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com;
 h=from : to : cc :
 subject : date : message-id : references : in-reply-to : content-type :
 content-transfer-encoding : mime-version; s=corp-2023-03-30;
 bh=FmJIoYaBkALZp9NbtSlkqpA/wE87bp2yZtEoIEACEV8=;
 b=OKOZSAbnTJk2kfQaSsE2SMQBb+otok1OZbiiF+EYpjnizmntxlWEbWXlaXKdVrdB2vs9
 A7DmHey01EypUyPClwyI8/eIa5FjDsH3RPFcCU7Fqm8K9elY/CpvUTk0NxnKobgCFR81
 nHirXjTBYyJyhW/EDgwgouURRk8To8CGzqeK8GbA6jhnqXzztNSmedHYZsAn9aipS8X0
 60axauMtlXKZjMzoQYRQ4HTOG7/EaNVQ2uzsY3rzVynAdEHMioWerHJtawjOypPf6Kzm
 lL8VKTrTVbKJfFwAwLEaCLb/l92bjIcj5RAmomCj/e5FtL4YN1Y4uhi1cBfg2ivueC6g KQ== 
Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com
 (phxpaimrmta01.appoci.oracle.com [138.1.114.2])
 by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3qvhjh9qrs-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Thu, 01 Jun 2023 21:09:33 +0000
Received: from pps.filterd
 (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1])
 by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19)
 with ESMTP id 351KDn9h014662; Thu, 1 Jun 2023 21:09:33 GMT
Received: from nam11-co1-obe.outbound.protection.outlook.com
 (mail-co1nam11lp2171.outbound.protection.outlook.com [104.47.56.171])
 by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id
 3qu8a7r9cg-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Thu, 01 Jun 2023 21:09:33 +0000
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=PWkYYXod3QJLp884izkNpuGXJquU8NQ9LIEZ9yJkw2MymXLdvtlksBaJGYSG+fvFWKxHI/HH6WEKOFQ6dAxkgGUHW67OJlkeWgdF1dnzZwWiFi9SdrHCHqqrKM+D4W/CZLV7/MBUs5UsbXfBwa6IYIy1gYw7K30klXcqw6j9bI5KOnUsSZ4WsZSSBPLDC8h9aFdEEvq3k7GytRVjr5oX3nUg2lrB+1ocgKQ0buwtu7lW0nLrn3rbs5Yzv8NeaXAfmaT9PxVSh4zBDjtmoiE6AonDMN4rBVVZyrINTa9MLtYC5cEi3dyJ/0KMQ/JbYGB9lju4LlRS5pCkrRY8tDK4LQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=FmJIoYaBkALZp9NbtSlkqpA/wE87bp2yZtEoIEACEV8=;
 b=iRjHtSR3L/oErYTkhqkJbtn1i5T42F7kOy3ShR5u3EffpP/80NSeCLIBcdwNqlKLVJYUi1WMa9+9/ZHfQuk7PxzmFjZ1qyhyeEWSQoPJM2usugXGUc+XwO7FgcGNdE4OyY7xD+tV87Eg+cDgVtVPO6m6Ruds5Zgwm8doWGIe4V/4Lv2r38yd/EzOPsdgbv4CEBtvQVfVdEx+tH1inNWHxFKVWR/lXQA8k745StkSeszKTC4yTl7MlMKBxwr+X/VJpvQoks3rvfXeRY7Us8Zd5PKuHL0JX8sL1g3woV055/OmSq9wFfB7nVKvVymsDG+cpI5Ua2DEyKmpbYL7IkArYw==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com;
 dkim=pass header.d=oracle.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=FmJIoYaBkALZp9NbtSlkqpA/wE87bp2yZtEoIEACEV8=;
 b=qWyQK10QOHR15jI2sUqzfAejwNLwrjtB0FvutFjDmS+O1gawmUNkZPvn/u4YwP3QK/y94L/IPhIZNtcBjCgsfbw6TC3R2BMBIy6g82bp/QEKoRZxX3QLKr4KfhTwCslqdQdwp/js4PozHtP4l5Bin4KrARJM8hBQvgtR7GapiIg=
Received: from SJ0PR10MB5488.namprd10.prod.outlook.com (2603:10b6:a03:37e::19)
 by BLAPR10MB5059.namprd10.prod.outlook.com (2603:10b6:208:327::6)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.22; Thu, 1 Jun
 2023 21:09:29 +0000
Received: from SJ0PR10MB5488.namprd10.prod.outlook.com
 ([fe80::a995:2ae5:2745:24ff]) by SJ0PR10MB5488.namprd10.prod.outlook.com
 ([fe80::a995:2ae5:2745:24ff%6]) with mapi id 15.20.6433.022; Thu, 1 Jun 2023
 21:09:28 +0000
From: Drew Adams <drew.adams@HIDDEN>
To: Spencer Baugh <sbaugh@HIDDEN>, Juri Linkov <juri@HIDDEN>
Subject: RE: [External] : bug#63648: 29.0.90; project.el: with
 switch-use-entire-map, switch-project errors on non-project commands
Thread-Topic: [External] : bug#63648: 29.0.90; project.el: with
 switch-use-entire-map, switch-project errors on non-project commands
Thread-Index: AQHZlMg3Jqe8JePML0u+XpFabANSpa92cG/A
Date: Thu, 1 Jun 2023 21:09:28 +0000
Message-ID: <SJ0PR10MB548868CAC95575854AE72473F349A@HIDDEN>
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <iera5xt7p9u.fsf@HIDDEN> <864jo11yvp.fsf@HIDDEN>
 <ier5y8f6s2p.fsf@HIDDEN> <86v8g98zw6.fsf@HIDDEN>
 <iersfbazzz3.fsf@HIDDEN>
In-Reply-To: <iersfbazzz3.fsf@HIDDEN>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-ms-publictraffictype: Email
x-ms-traffictypediagnostic: SJ0PR10MB5488:EE_|BLAPR10MB5059:EE_
x-ms-office365-filtering-correlation-id: 3e2a237b-f21d-43df-d1d1-08db62e47ca9
x-ms-exchange-senderadcheck: 1
x-ms-exchange-antispam-relay: 0
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: 5YTzlkH6fBSHmayO1i1S4J2a5CCD7oU4bC8kmA3gL+blofHbbkDhFmgTPmswE4RX8jsoqnTkAUZwVXDCYv7A7vxXxu3oVhXdhcSgm1N0QCdw3rjPUWMj/xuWwBTBfAvaAnv19iTWafiY22fYkzf1bvRSuRxk3a6NvZxg72GPMxPLMvWTN6d4DLsAgqaUfegjf5mWJPWXWg3ngurFI1iUTpIJ6AANWvQTXlwa+IDd2b4kfrG0rCPJb1wkXyG0VkM/nHbUMWkgQ2LQaJpCqIPjSv09Ea6H5AFFZmtcoWpRZnFDNT0Ge855jLQ/SqIDUHuEygIThD453cvc3+bi5RwqkF80m2iUC87gfuRCNmvuATkgaLIsEh+Esk+0PR2Ms0SkxWRLjR8MHGBM7y/Z2e2hr7PxdeQh0T3Lu0uAXtDhEAXyFBZF5cuDyjxRfFGiKq1PKWh37Gy9q4orntd0yeU6pf6bJ+gXsDMZ4vdSBzJuvhNM91fZ4a3pif7jdhyyfhJK55F5+jUAUSUQIM17bIiJfFmBp6353ocYivEaOUJ0a1gD3jzn7YQUlBBEfk37cYJxEDEQoYzsfsV0Up8sE8Zjnwc3c0TJqVr/NqJVqtRvRUnFDcrH05Z/MKQONEi3mDR8
x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
 IPV:NLI; SFV:NSPM; H:SJ0PR10MB5488.namprd10.prod.outlook.com; PTR:; CAT:NONE;
 SFS:(13230028)(39860400002)(346002)(376002)(396003)(136003)(366004)(451199021)(186003)(7696005)(33656002)(52536014)(5660300002)(71200400001)(41300700001)(55016003)(38100700002)(8676002)(9686003)(8936002)(26005)(6506007)(122000001)(38070700005)(66446008)(110136005)(4744005)(2906002)(64756008)(66476007)(66556008)(66946007)(478600001)(4326008)(44832011)(86362001)(76116006)(316002);
 DIR:OUT; SFP:1101; 
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?rZRJJpuVVv9Ptq4eeoWc75qxSGUq5ePvsFy+eyoW/uWKmexnqPBwX2pI2FYi?=
 =?us-ascii?Q?P9vH3jXFLYnWxv62oIkjzy5vm+C7UYUHT/2RqxBZo/Z2bLbtGF8bfu5/ummx?=
 =?us-ascii?Q?BwzWOoyxPj2OesdEyuPvx2vdfAZIAKeEah/+qucSibB+stahwAF+xlT6fY3p?=
 =?us-ascii?Q?bfh9chqD5Na7ccJ7+eu16kVBuf9wR6AreueWJ+geTwO3HHAmnRFtpKaJd2A2?=
 =?us-ascii?Q?AnHETgB0b1hhEb3pvkkeRclA+0G233A5WlaQTq4P/2Ts18OpQnGnaBa7sSrs?=
 =?us-ascii?Q?QYYEMjdiPSgz8s65MH04CTyLAzgSTO4r2KQacjga4Ca7u8gFYCle4bHaVAJv?=
 =?us-ascii?Q?h8kdntf3yQPcwIell9R8kAAt0Zq70djEGtm2U3uG8347vTwq3AgSETLyi6V9?=
 =?us-ascii?Q?Xw5PC92gpjHNJhxMTBUAeD740vpS/Ck3r8pW0eTvA4cYAuAJmWErmy4IyMTJ?=
 =?us-ascii?Q?mYBNi256r3oMG9PYHzrgqBVblL1dG9Gx9wf4zXevOvFXnE/qOgG5mwZT2Dlt?=
 =?us-ascii?Q?XQUCPcb+WQPP20cVlG3kYZtdTGImh4VaX2UWc52iRBOEGHPLeWkI5xQ8PY4z?=
 =?us-ascii?Q?pQSv3imi2PyTBexf3bs7y4PYQBFVhhGpuXUm2HvA7Hc87Sibuhc8zOHaScVE?=
 =?us-ascii?Q?gXAD2C4IjyPQ6gQGiNeRTdieOii+ANYRqzz2ocjv1UHa0PH0luVKEJsfKPUr?=
 =?us-ascii?Q?L6AXqitJzObPm4LO/aBEj9Q6Xma0noNKmewsVBIrpvpvZJo1PwvcPwUxFrx5?=
 =?us-ascii?Q?8o3caTfCh+xbfKQv2aJCmxiFOVsolhpdzKkcEIVw/nNyNnToYQgF+Tx+72zZ?=
 =?us-ascii?Q?sElKzYKS9wRNHDCK8JPrsBJQIpBXiQ1RcnmRsGudt2surDbp2sbl9FYFjTgQ?=
 =?us-ascii?Q?0ZtpIWerm5yfMlBRPl2/FcM9oDRA5CJehGGOYNLS0CRQbEdMI2FdMsNMaEbX?=
 =?us-ascii?Q?Bav5uAbP2KZRWCLUNJ4vwc0fd3dkzj/6hRuzGFtZ+3ue1MRCJmLRXpkLA4P6?=
 =?us-ascii?Q?W5pPtP+5o9aZTWzctmcFc4nY4Lvw3U6iWDlQDSgC1JOfnifkUS1Db7OhdC4p?=
 =?us-ascii?Q?3Rp0oaFq5cJJUX0IZ8BMe6x1qH7dAnh4MfyUP+4tpXZB6CsanU+GN91BVE4n?=
 =?us-ascii?Q?Op0n4+ReaUZJ7EmWRsd655grLgBMyRbNnkQnBaw/AL8DTrTrOjc65bt/T+Y9?=
 =?us-ascii?Q?9IWkt6sdX7FiVDcnDaxJBmr7losalDPBLYjH9zwuZ7pqZgpoJT/NmKLJJZcp?=
 =?us-ascii?Q?Xz2c/NwWeSDCOMpIOhWb6bHkg/L2O4C4M8i+JbZGi/jHrh0BXGUpuMbjC0R0?=
 =?us-ascii?Q?Tun+iKmvHxcbK0NjzOUST0tTi5pBBs7Hoxsq/3S3x/dGtMvuFOkGNCA1DQa6?=
 =?us-ascii?Q?xCG0PE6aCAu9DC2Z07wmNfEGThUB0V69d9UeNy+pc8S17xuHKi6L4cwdEemh?=
 =?us-ascii?Q?tbuojZNk7+98x0PpRVCjTxxzGGvraUm77bChSvJU2stU2ik5hwTmclvO5mbZ?=
 =?us-ascii?Q?IRiH7YNODIgKFYhK0Yu0l1ps0ojsaFKSp+9UuVP6sU1OO8mpP2LL7P/AGcZH?=
 =?us-ascii?Q?ANQdZQn/2JLEAH4AG5JPzzQIW5AvcOm04GEPbp/R?=
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: tSU0S4lB06SMk9zFBiOa0oxKvFBfGDFQC7ldhQ54a7L0xCepXX8tyE0Nrrqw7zlDFOogZrO83wXZE1qk1jiVZTC4Laqk9/I1nAdWyGcSOcYmo1MTaGZ3hWqjIYuHvkfx/eniq389biqrpgR5q/iDV3XrumF7jZ3xKZbPor6cCKXkTEqyHX60DJf/2v7717mDve+yylg8stCooh9aDu8e9R+fTrpWekjjUYtrn+oGnXVIW1ChmN+RQmEYZfXuStVti/1llY8/iHsNsIC5MvuzvUQqJBUxStqDH927fLWlzyyv7i0YKQOStjTCsPrtoYWILajtNf7PGEs3EhgVVavKia37eHGGb6HrVPkFOt7oUOoAkx2YSK1D00K9Ex3hxayfmtLqQsxCUhxZsWmNrt9XPcLl4dSlJg+YxZ3tGbw7qpbrXIn7cKpPyc9ww6TST3B6D0oqW48FIDZuElXi6e4KH8sIuSynqG2C/5EkkaPgedZS4i7jsa0JndQJE3mk6MD5QF981PTdTQL+Xv9vRcGoVVA6QeDtIhaMYjCMCtr6ejmGZ/kzZY7hSt0PuehAY7nT85mZtxOf9Zjsog7dL3vYyEjFbUJGkxftoa26klNDc3XbsYWG7eQ53qRmzjYNfmaf0NpF32kj2kJeQl7/qqMR1OjQwEfh2g1Sds6n/kccKwtGrAmFhoEmsyGiQlt6RedTRzOu4RRTVJsM/isduSEcG2enTdneqHQh3Qnm/GXJICXagxobYZfkobw+xIoeIfrVotVjgwp31uBa2glNshWvEoh1MP7Pk9jT2WzZYHt++HVxnUxpMqIZqbImMRqnAI5xv+aVbiz19In5aiKOcIggCg==
X-OriginatorOrg: oracle.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB5488.namprd10.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 3e2a237b-f21d-43df-d1d1-08db62e47ca9
X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Jun 2023 21:09:28.6418 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: qtvGBk1+g8c1nTsZe+ytqM6ib7BHv4p1uLWSvtan51qFMgqBHGncg1GPzrIff7DutJ/TUEqdIaL+VU6oA4ec8w==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR10MB5059
X-Proofpoint-Virus-Version: vendor=baseguard
 engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26
 definitions=2023-06-01_08,2023-05-31_03,2023-05-22_02
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0
 adultscore=0 spamscore=0
 phishscore=0 malwarescore=0 mlxlogscore=711 mlxscore=0 bulkscore=0
 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000
 definitions=main-2306010182
X-Proofpoint-GUID: jjbxQJD5VIiJMJDx9MDddr-uANvMUtV2
X-Proofpoint-ORIG-GUID: jjbxQJD5VIiJMJDx9MDddr-uANvMUtV2
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 63648
Cc: "63648 <at> debbugs.gnu.org" <63648 <at> debbugs.gnu.org>
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 (-)

> Or maybe we can just change how C-x C-j
> behaves so it works intuitively with C-x p p?=09

Please don't change C-x C-j.

If you want to have another command that does
whatever you want then do that.  Bind that to
whatever keys you like in a particular mode.
But please don't change the behavior of `C-x C-j'.=20





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

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


Received: (at 63648) by debbugs.gnu.org; 1 Jun 2023 20:31:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jun 01 16:31:39 2023
Received: from localhost ([127.0.0.1]:38497 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q4oxO-0000Il-Us
	for submit <at> debbugs.gnu.org; Thu, 01 Jun 2023 16:31:39 -0400
Received: from mxout5.mail.janestreet.com ([64.215.233.18]:36533)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <sbaugh@HIDDEN>) id 1q4oxL-0000IN-Ta
 for 63648 <at> debbugs.gnu.org; Thu, 01 Jun 2023 16:31:37 -0400
From: Spencer Baugh <sbaugh@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
In-Reply-To: <86v8g98zw6.fsf@HIDDEN> (Juri Linkov's message of "Tue, 
 30 May 2023 20:48:33 +0300")
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <iera5xt7p9u.fsf@HIDDEN> <864jo11yvp.fsf@HIDDEN>
 <ier5y8f6s2p.fsf@HIDDEN> <86v8g98zw6.fsf@HIDDEN>
Date: Thu, 01 Jun 2023 16:31:28 -0400
Message-ID: <iersfbazzz3.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: 63648
Cc: 63648 <at> debbugs.gnu.org
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 (-)

Juri Linkov <juri@HIDDEN> writes:

>>>>>> (Tangential further thought: I wonder if we could make C-x p work
>>>>>> as a prefix for all commands automatically, so for example
>>>>>> C-x p C-x C-j would open the project root,
>
> I just noticed that 'C-x p C-x C-j' would open the parent directory
> of the project root, not the root itself, since 'C-x C-j' in the root
> jumps to its parent.

Only in dired buffers.  If not in dired, and not in a file-visiting
buffer, it just goes to default-directory.

That is kind of annoying for making C-x p p C-x C-j go to the root,
though, because its behavior will depend on the current buffer...  Maybe
C-x p p can switch buffers before running the command?  Or maybe we can
just change how C-x C-j behaves so it works intuitively with C-x p p?




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

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


Received: (at 63648) by debbugs.gnu.org; 1 Jun 2023 16:09:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jun 01 12:09:53 2023
Received: from localhost ([127.0.0.1]:38374 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q4ks5-00018b-8C
	for submit <at> debbugs.gnu.org; Thu, 01 Jun 2023 12:09:53 -0400
Received: from relay5-d.mail.gandi.net ([217.70.183.197]:49633)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1q4ks3-00018I-1U
 for 63648 <at> debbugs.gnu.org; Thu, 01 Jun 2023 12:09:52 -0400
X-GND-Sasl: juri@HIDDEN
X-GND-Sasl: juri@HIDDEN
X-GND-Sasl: juri@HIDDEN
Received: by mail.gandi.net (Postfix) with ESMTPSA id 4A5671C0005;
 Thu,  1 Jun 2023 16:09:42 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Dmitry Gutov <dmitry@HIDDEN>
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
In-Reply-To: <86bki9y68h.fsf@HIDDEN> (Juri Linkov's message of "Wed, 
 24 May 2023 20:44:14 +0300")
Organization: LINKOV.NET
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <482a1ebc-165c-a0a4-98c0-5c404d1b1d0d@HIDDEN>
 <86jzwyxnxb.fsf@HIDDEN>
 <feead847-869a-86a8-d62d-065871024a74@HIDDEN>
 <86o7m91z22.fsf@HIDDEN> <86pm6py6k4.fsf@HIDDEN>
 <86bki9y68h.fsf@HIDDEN>
Date: Thu, 01 Jun 2023 19:05:07 +0300
Message-ID: <86cz2f7bvo.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: multipart/mixed; boundary="=-=-="
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 63648
Cc: Spencer Baugh <sbaugh@HIDDEN>, 63648 <at> debbugs.gnu.org
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 (-)

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

>> 1. the current buffer should remain the same for the next command;
>> 2. the buffer-local value of 'default-directory' should remain the same;
>> 3. the next command should have a new value of 'default-directory'.
>>
>> I see no way to satisfy all these requirements.
>
> Except adding a variable like 'project-current-directory-override'
> somewhere inside 'command_loop_1'.

And indeed with the following patch replacing the current definition of
'project-switch-project' with just:

  (defun project-switch-project (dir)
    (interactive (list (funcall project-prompter)))
    (setq next-default-directory dir))

'C-x p p (select project ...) RET M-& pwd RET' confirms that
the command runs in the selected project directory.
Whereas the original buffer keeps its previous buffer-local value
of 'default-directory'.


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline; filename=next-default-directory.patch

diff --git a/src/buffer.c b/src/buffer.c
index 0c46b201586..ca81db21894 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -5360,6 +5360,10 @@ syms_of_buffer (void)
 these names start with `/' or `~' and end with `/'.
 To interactively change the default directory, use command `cd'. */);
 
+  DEFVAR_LISP ("next-default-directory", Vnext_default_directory,
+	       doc: /* Default directory for the next command.  */);
+  Vnext_default_directory = Qnil;
+
   DEFVAR_PER_BUFFER ("auto-fill-function", &BVAR (current_buffer, auto_fill_function),
 		     Qnil,
 		     doc: /* Function called (if non-nil) to perform auto-fill.
diff --git a/src/keyboard.c b/src/keyboard.c
index 14c55666768..dfe939750c9 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1500,7 +1500,19 @@ command_loop_1 (void)
 	    update_redisplay_ticks (0, NULL);
 	    display_working_on_window_p = false;
 
+            Lisp_Object next_dir = Vnext_default_directory;
+            specpdl_ref count = SPECPDL_INDEX ();
+            if (!NILP (next_dir))
+              specbind (Qdefault_directory, next_dir);
+
             call1 (Qcommand_execute, Vthis_command);
+
+            if (!NILP (next_dir))
+              {
+                unbind_to (count, Qnil);
+                Vnext_default_directory = Qnil;
+              }
+
 	    display_working_on_window_p = false;
 
 #ifdef HAVE_WINDOW_SYSTEM

--=-=-=--




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

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


Received: (at 63648) by debbugs.gnu.org; 30 May 2023 18:04:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 30 14:04:13 2023
Received: from localhost ([127.0.0.1]:34097 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q43hc-0006BF-UJ
	for submit <at> debbugs.gnu.org; Tue, 30 May 2023 14:04:13 -0400
Received: from relay3-d.mail.gandi.net ([217.70.183.195]:41719)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1q43hb-0006B1-6E
 for 63648 <at> debbugs.gnu.org; Tue, 30 May 2023 14:04:11 -0400
X-GND-Sasl: juri@HIDDEN
X-GND-Sasl: juri@HIDDEN
Received: by mail.gandi.net (Postfix) with ESMTPSA id 3166B60003;
 Tue, 30 May 2023 18:04:03 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Spencer Baugh <sbaugh@HIDDEN>
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
In-Reply-To: <ier5y8f6s2p.fsf@HIDDEN> (Spencer Baugh's message of
 "Fri, 26 May 2023 11:16:46 -0400")
Organization: LINKOV.NET
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <iera5xt7p9u.fsf@HIDDEN> <864jo11yvp.fsf@HIDDEN>
 <ier5y8f6s2p.fsf@HIDDEN>
Date: Tue, 30 May 2023 20:48:33 +0300
Message-ID: <86v8g98zw6.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-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 63648
Cc: 63648 <at> debbugs.gnu.org
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 (-)

>>>>> (Tangential further thought: I wonder if we could make C-x p work
>>>>> as a prefix for all commands automatically, so for example
>>>>> C-x p C-x C-j would open the project root,

I just noticed that 'C-x p C-x C-j' would open the parent directory
of the project root, not the root itself, since 'C-x C-j' in the root
jumps to its parent.

> I have an idea for how to make it work, which might be generally useful:
>
> Maybe commands/keybindings could support marking themselves as "prefix"
> commands, such that when you run describe-key and enter the prefix key
> sequence, describe-key accepts another key sequence after you finish the
> prefix key sequence, and interprets it with the altered keymaps that
> would be created by the prefix.  And then the help buffer would print
> the help for both commands.
>
> So then (describe-key (kbd "C-x p M-&")) would print help for both the
> new project-prefix command and async-shell-command.
>
> And also, (describe-key (kbd "C-x p c")) would print help for both
> project-prefix and project-compile, the latter being bound only by the
> transient created by C-x p.

Before doing this for 'C-x p' and 'C-x 4' it's possible already to test
this on the existing 'C-x p p' since currently

  (describe-key (kbd "C-x p p c"))

fails to describe 'project-prefix-map'.  And only prints help for
'project-switch-project' with

  (describe-key (kbd "C-x p p"))




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

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


Received: (at 63648) by debbugs.gnu.org; 26 May 2023 15:16:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 26 11:16:55 2023
Received: from localhost ([127.0.0.1]:50573 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q2ZBX-0004Yl-Dn
	for submit <at> debbugs.gnu.org; Fri, 26 May 2023 11:16:55 -0400
Received: from mxout5.mail.janestreet.com ([64.215.233.18]:60035)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <sbaugh@HIDDEN>) id 1q2ZBV-0004YP-Ri
 for 63648 <at> debbugs.gnu.org; Fri, 26 May 2023 11:16:54 -0400
From: Spencer Baugh <sbaugh@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
In-Reply-To: <864jo11yvp.fsf@HIDDEN> (Juri Linkov's message of "Wed, 
 24 May 2023 19:24:10 +0300")
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <iera5xt7p9u.fsf@HIDDEN> <864jo11yvp.fsf@HIDDEN>
Date: Fri, 26 May 2023 11:16:46 -0400
Message-ID: <ier5y8f6s2p.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: 63648
Cc: 63648 <at> debbugs.gnu.org
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 (-)

Juri Linkov <juri@HIDDEN> writes:
>>>> (Tangential further thought: I wonder if we could make C-x p work as a
>>>> prefix for all commands automatically, so for example C-x p C-x C-j
>>>> would open the project root, C-x p M-& would run a shell command in the
>>>> root, etc.  That would be neat.)
>>>
>>> IOW, like 'C-x p p' but without asking for another project.  Doable as well.
>>
>> I'm curious, how are you thinking this would be implemented?  My thought
>> was that C-x p would act as a prefix for any key sequence in this way,
>> *but* also C-x p c and the other things currently in project-prefix-map
>> would still be explicitly bound, so they can be looked up with
>> describe-key.  And also, C-x p C-h should still run
>> describe-prefix-bindings.  I don't know how one would achieve this...
>
> Probably this is not possible.  What I meant is to bind 'C-x p'
> to a special command that uses 'set-transient-map'.  But then such
> command could be bound to e.g. 'C-x p /' (with mnemonics "root")
> to set 'default-directory' to the project root for the next command.

Yes, that would make sense.  It would be nice if that kind of approach
didn't hurt the self-documentation capabilities of Emacs.

I have an idea for how to make it work, which might be generally useful:

Maybe commands/keybindings could support marking themselves as "prefix"
commands, such that when you run describe-key and enter the prefix key
sequence, describe-key accepts another key sequence after you finish the
prefix key sequence, and interprets it with the altered keymaps that
would be created by the prefix.  And then the help buffer would print
the help for both commands.

So then (describe-key (kbd "C-x p M-&")) would print help for both the
new project-prefix command and async-shell-command.

And also, (describe-key (kbd "C-x p c")) would print help for both
project-prefix and project-compile, the latter being bound only by the
transient created by C-x p.

And also, describe-prefix-bindings would be taught to describe any
additional bindings added by an explicitly marked prefix command.  So
C-x p C-h would print all the same bindings as it currently does.

This probably wouldn't be worth it just for project.el, but it could
allow another very cool change:

We could turn C-x 4, C-x 5, and C-x t into prefixes like this, which
behave like C-x 4 4, C-x 5 5, and C-x t t do today, and turn their
current bindings into a transient.  If we added this explicit support
for "prefix" commands, we could maybe do this without losing any
features or self-documenting abilities.  So then, e.g., C-x 4 M-& would
run async-shell-command in another window.  One less key to hit would
make that a lot more convenient IMO...

Probably we wouldn't want to do that by default, but it could be a nice
user customization.  I'd like to turn it on myself...




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

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


Received: (at 63648) by debbugs.gnu.org; 24 May 2023 17:45:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 24 13:45:27 2023
Received: from localhost ([127.0.0.1]:45057 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q1sYB-00029s-2z
	for submit <at> debbugs.gnu.org; Wed, 24 May 2023 13:45:27 -0400
Received: from relay2-d.mail.gandi.net ([217.70.183.194]:64331)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1q1sY7-0001gL-4m
 for 63648 <at> debbugs.gnu.org; Wed, 24 May 2023 13:45:25 -0400
Received: (Authenticated sender: juri@HIDDEN)
 by mail.gandi.net (Postfix) with ESMTPSA id CDFB940004;
 Wed, 24 May 2023 17:45:15 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Dmitry Gutov <dmitry@HIDDEN>
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
In-Reply-To: <86pm6py6k4.fsf@HIDDEN> (Juri Linkov's message of "Wed, 
 24 May 2023 20:37:15 +0300")
Organization: LINKOV.NET
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <482a1ebc-165c-a0a4-98c0-5c404d1b1d0d@HIDDEN>
 <86jzwyxnxb.fsf@HIDDEN>
 <feead847-869a-86a8-d62d-065871024a74@HIDDEN>
 <86o7m91z22.fsf@HIDDEN> <86pm6py6k4.fsf@HIDDEN>
Date: Wed, 24 May 2023 20:44:14 +0300
Message-ID: <86bki9y68h.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-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 63648
Cc: Spencer Baugh <sbaugh@HIDDEN>, 63648 <at> debbugs.gnu.org
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 (-)

>>>> So a similar function could remember 'project-current-directory-override'
>>>> for the next command.
>>>
>>> But we were talking about "regular" commands, right? Those don't know
>>> anything about project-current-directory-override.
>>
>> Any command indeed.  They should use the temporarily set default-directory.
>
> Actually, instead of 'project-current-directory-override' I meant
> 'default-directory'.  But probably this is impossible to do
> because of these restrictions:
>
> 1. the current buffer should remain the same for the next command;
> 2. the buffer-local value of 'default-directory' should remain the same;
> 3. the next command should have a new value of 'default-directory'.
>
> I see no way to satisfy all these requirements.

Except adding a variable like 'project-current-directory-override'
somewhere inside 'command_loop_1'.




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

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


Received: (at 63648) by debbugs.gnu.org; 24 May 2023 17:38:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 24 13:38:04 2023
Received: from localhost ([127.0.0.1]:45041 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q1sR1-0000fK-P8
	for submit <at> debbugs.gnu.org; Wed, 24 May 2023 13:38:03 -0400
Received: from relay3-d.mail.gandi.net ([217.70.183.195]:52123)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1q1sQz-0000eq-KJ
 for 63648 <at> debbugs.gnu.org; Wed, 24 May 2023 13:38:02 -0400
Received: (Authenticated sender: juri@HIDDEN)
 by mail.gandi.net (Postfix) with ESMTPSA id 37D8160003;
 Wed, 24 May 2023 17:37:53 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Dmitry Gutov <dmitry@HIDDEN>
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
In-Reply-To: <86o7m91z22.fsf@HIDDEN> (Juri Linkov's message of "Wed, 
 24 May 2023 19:20:21 +0300")
Organization: LINKOV.NET
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <482a1ebc-165c-a0a4-98c0-5c404d1b1d0d@HIDDEN>
 <86jzwyxnxb.fsf@HIDDEN>
 <feead847-869a-86a8-d62d-065871024a74@HIDDEN>
 <86o7m91z22.fsf@HIDDEN>
Date: Wed, 24 May 2023 20:37:15 +0300
Message-ID: <86pm6py6k4.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-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 63648
Cc: Spencer Baugh <sbaugh@HIDDEN>, 63648 <at> debbugs.gnu.org
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 (-)

>>> So a similar function could remember 'project-current-directory-override'
>>> for the next command.
>>
>> But we were talking about "regular" commands, right? Those don't know
>> anything about project-current-directory-override.
>
> Any command indeed.  They should use the temporarily set default-directory.

Actually, instead of 'project-current-directory-override' I meant
'default-directory'.  But probably this is impossible to do
because of these restrictions:

1. the current buffer should remain the same for the next command;
2. the buffer-local value of 'default-directory' should remain the same;
3. the next command should have a new value of 'default-directory'.

I see no way to satisfy all these requirements.




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

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


Received: (at 63648) by debbugs.gnu.org; 24 May 2023 16:32:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 24 12:32:05 2023
Received: from localhost ([127.0.0.1]:44655 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q1rPA-0007Fr-U8
	for submit <at> debbugs.gnu.org; Wed, 24 May 2023 12:32:05 -0400
Received: from relay9-d.mail.gandi.net ([217.70.183.199]:50865)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1q1rP8-0007EW-PO
 for 63648 <at> debbugs.gnu.org; Wed, 24 May 2023 12:32:03 -0400
Received: (Authenticated sender: juri@HIDDEN)
 by mail.gandi.net (Postfix) with ESMTPSA id D8ADDFF809;
 Wed, 24 May 2023 16:31:55 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Spencer Baugh <sbaugh@HIDDEN>
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
In-Reply-To: <iera5xt7p9u.fsf@HIDDEN> (Spencer Baugh's message of
 "Wed, 24 May 2023 10:55:09 -0400")
Organization: LINKOV.NET
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <iera5xt7p9u.fsf@HIDDEN>
Date: Wed, 24 May 2023 19:24:10 +0300
Message-ID: <864jo11yvp.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-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 63648
Cc: 63648 <at> debbugs.gnu.org
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 (-)

>>> (Tangential further thought: I wonder if we could make C-x p work as a
>>> prefix for all commands automatically, so for example C-x p C-x C-j
>>> would open the project root, C-x p M-& would run a shell command in the
>>> root, etc.  That would be neat.)
>>
>> IOW, like 'C-x p p' but without asking for another project.  Doable as well.
>
> I'm curious, how are you thinking this would be implemented?  My thought
> was that C-x p would act as a prefix for any key sequence in this way,
> *but* also C-x p c and the other things currently in project-prefix-map
> would still be explicitly bound, so they can be looked up with
> describe-key.  And also, C-x p C-h should still run
> describe-prefix-bindings.  I don't know how one would achieve this...

Probably this is not possible.  What I meant is to bind 'C-x p'
to a special command that uses 'set-transient-map'.  But then such
command could be bound to e.g. 'C-x p /' (with mnemonics "root")
to set 'default-directory' to the project root for the next command.




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

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


Received: (at 63648) by debbugs.gnu.org; 24 May 2023 16:32:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 24 12:32:04 2023
Received: from localhost ([127.0.0.1]:44653 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q1rPA-0007Fp-GS
	for submit <at> debbugs.gnu.org; Wed, 24 May 2023 12:32:04 -0400
Received: from relay7-d.mail.gandi.net ([217.70.183.200]:44207)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1q1rP5-0007EL-G6
 for 63648 <at> debbugs.gnu.org; Wed, 24 May 2023 12:32:03 -0400
Received: (Authenticated sender: juri@HIDDEN)
 by mail.gandi.net (Postfix) with ESMTPSA id 4A73F20004;
 Wed, 24 May 2023 16:31:51 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Dmitry Gutov <dmitry@HIDDEN>
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
In-Reply-To: <feead847-869a-86a8-d62d-065871024a74@HIDDEN> (Dmitry Gutov's
 message of "Wed, 24 May 2023 18:46:41 +0300")
Organization: LINKOV.NET
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <482a1ebc-165c-a0a4-98c0-5c404d1b1d0d@HIDDEN>
 <86jzwyxnxb.fsf@HIDDEN>
 <feead847-869a-86a8-d62d-065871024a74@HIDDEN>
Date: Wed, 24 May 2023 19:20:21 +0300
Message-ID: <86o7m91z22.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-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 63648
Cc: Spencer Baugh <sbaugh@HIDDEN>, 63648 <at> debbugs.gnu.org
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 (-)

>>>>> C-x p p some/project RET C-x v +
>>>>>
>>>>> because I wanted to immediately pull that project.  Intuitively it made
>>>>> sense to me that that should work, it would be nice if it did actually
>>>>> work.
>>>> This should be possible to implement by using 'set-transient-map'.
>>>>
>>>>> (Tangential further thought: I wonder if we could make C-x p work as a
>>>>> prefix for all commands automatically, so for example C-x p C-x C-j
>>>>> would open the project root, C-x p M-& would run a shell command in the
>>>>> root, etc.  That would be neat.)
>>>> IOW, like 'C-x p p' but without asking for another project.  Doable as well.
>>>
>>> That sounds like a cool potential addition, just we all need to keep in
>>> mind that not every command will be 100% compatible with the approach.
>> Why not every command?  For example, 100% commands are compatible with
>> 'C-x t t.'
>>
>>> One example is the bug#58784 where changing default-directory made
>>> project-switch-to-buffer behave incorrectly. Maybe there are some less
>>> subtle examples as well.
>> 'display-buffer-override-next-command' already solved these problems.
>> So a similar function could remember 'project-current-directory-override'
>> for the next command.
>
> But we were talking about "regular" commands, right? Those don't know
> anything about project-current-directory-override.

Any command indeed.  They should use the temporarily set default-directory.

> So we'd bind default-directory, and that's where the problem could come
> from. Hopefully, only in rare cases, though.

Naturally, this needs more testing.




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

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


Received: (at 63648) by debbugs.gnu.org; 24 May 2023 15:46:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 24 11:46:55 2023
Received: from localhost ([127.0.0.1]:44450 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q1qhS-0005r7-UE
	for submit <at> debbugs.gnu.org; Wed, 24 May 2023 11:46:55 -0400
Received: from wout4-smtp.messagingengine.com ([64.147.123.20]:42525)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dmitry@HIDDEN>) id 1q1qhP-0005qr-FA
 for 63648 <at> debbugs.gnu.org; Wed, 24 May 2023 11:46:53 -0400
Received: from compute2.internal (compute2.nyi.internal [10.202.2.46])
 by mailout.west.internal (Postfix) with ESMTP id 7E1303200B8C;
 Wed, 24 May 2023 11:46:45 -0400 (EDT)
Received: from mailfrontend1 ([10.202.2.162])
 by compute2.internal (MEProxy); Wed, 24 May 2023 11:46:45 -0400
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=
 1684943205; x=1685029605; bh=q0E4ZJYBXV2/zleHL8YciSwuld8A7US+0bA
 08JUfZ3Q=; b=wS0hIE54pjgFEfiHnkhCFY5nov4/l4kak++7UTx+KC0N5nOEv34
 +HZZgljfHotEMmUhhUMOHrAdPIzeyPbrV6zHXZ/AjlbYkDj625gIhHKoVDm/NVeS
 Nm6o6B8sQ11CRmNRk/ScZOnIUOMLk8ABFwxd+7k0aTlLucaNYOxHtppz/ZVuKcem
 7mYIFYYOf2P9SyioPobFI+PEqX8AmWvzqniJ2oKApGk8/m1hQf1zJA9hzFal8hr1
 +h3BjF+dqg33T+bnvym1tuesWtTYY+Jd0FRIqf2NpbMA85W+WRR5g21yt8gLcL5h
 znCP7gwsn+X0g0RYxsoF1QY7JCEWDG8/kvA==
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=
 1684943205; x=1685029605; bh=q0E4ZJYBXV2/zleHL8YciSwuld8A7US+0bA
 08JUfZ3Q=; b=sY01+f2LmflbYyIxGlfKui8i/uRTLk7s3sJUvTApssaebB+qrMe
 WPm6kv2t4HZnRIw0QX0Qj2CKUydA4Bsg7Y47rksYFfUF7dk8UO4HD2BPvOGwxL8L
 SMIpdhXgRuMYBTmAAM+BU1usVCQ+uH9c6+3MZuOJwdPH2Hf+E1DXVnx03m8ehFHb
 rwOtYJjjOdlGForSGiiMxfBGBbJV0FOlIf6j5Ncso13TLcJgHeBlj7zueBjaCbGW
 hacNizuvrhJTHhQbuU+VL6lY03ualazTOIQPjVfmEHmv9Pcs8ZXzfB3W53HzzIgD
 KycOGimd7cULOOUdkrbb/wjoZLN9A0JVh8g==
X-ME-Sender: <xms:ZDFuZPjZh_0dnL32U3Jz4oggsIlbsKOH82vNNLiTsD2ofR--6GRK2w>
 <xme:ZDFuZMC6QkmPJUuAWV6WLXNkGwz3qzjFBFtpHhZqlty_CbV4VT7iqL2NgOXxo4ama
 x7Ql8K7q4_i-s40tRo>
X-ME-Received: <xmr:ZDFuZPFbksWH2IebGEotEstWdYz_if5czahzBHBBwCt2Ic7cQoRyVRWJVZ3-9ME>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeejhedgleduucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi
 thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth
 htvghrnhepiefgteevheevveffheeltdeukeeiieekueefgedugfefgefhudelgfefveel
 vdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug
 hmihhtrhihsehguhhtohhvrdguvghv
X-ME-Proxy: <xmx:ZDFuZMQX-6KdiCeS9D0GVpvCIK4ZBZvxEEEXLNxWyX-gd8DvvHd80A>
 <xmx:ZDFuZMz6NhlS3Sc6IhaqC6cwRmdrTWvffOW_98Mmc4BvjLfMKbtlFg>
 <xmx:ZDFuZC6tsr7vrSBk1bqCEujKWq9owXCfVEy87zn-DWTSuqOsJdESOg>
 <xmx:ZTFuZJrXyzww7r9Tnn-6H__WrPvF12cr8JXg5oySM9jHGftigtxCzw>
Feedback-ID: i0e71465a:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed,
 24 May 2023 11:46:43 -0400 (EDT)
Message-ID: <feead847-869a-86a8-d62d-065871024a74@HIDDEN>
Date: Wed, 24 May 2023 18:46:41 +0300
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.11.0
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
Content-Language: en-US
To: Juri Linkov <juri@HIDDEN>
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <482a1ebc-165c-a0a4-98c0-5c404d1b1d0d@HIDDEN>
 <86jzwyxnxb.fsf@HIDDEN>
From: Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <86jzwyxnxb.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 63648
Cc: Spencer Baugh <sbaugh@HIDDEN>, 63648 <at> debbugs.gnu.org
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: -2.9 (--)

On 24/05/2023 09:20, Juri Linkov wrote:
>>>> C-x p p some/project RET C-x v +
>>>>
>>>> because I wanted to immediately pull that project.  Intuitively it made
>>>> sense to me that that should work, it would be nice if it did actually
>>>> work.
>>> This should be possible to implement by using 'set-transient-map'.
>>>
>>>> (Tangential further thought: I wonder if we could make C-x p work as a
>>>> prefix for all commands automatically, so for example C-x p C-x C-j
>>>> would open the project root, C-x p M-& would run a shell command in the
>>>> root, etc.  That would be neat.)
>>> IOW, like 'C-x p p' but without asking for another project.  Doable as well.
>>
>> That sounds like a cool potential addition, just we all need to keep in
>> mind that not every command will be 100% compatible with the approach.
> 
> Why not every command?  For example, 100% commands are compatible with
> 'C-x t t.'
> 
>> One example is the bug#58784 where changing default-directory made
>> project-switch-to-buffer behave incorrectly. Maybe there are some less
>> subtle examples as well.
> 
> 'display-buffer-override-next-command' already solved these problems.
> So a similar function could remember 'project-current-directory-override'
> for the next command.

But we were talking about "regular" commands, right? Those don't know 
anything about project-current-directory-override.

So we'd bind default-directory, and that's where the problem could come 
from. Hopefully, only in rare cases, though.




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

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


Received: (at 63648) by debbugs.gnu.org; 24 May 2023 14:55:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 24 10:55:17 2023
Received: from localhost ([127.0.0.1]:44367 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q1ptU-0004Lf-TL
	for submit <at> debbugs.gnu.org; Wed, 24 May 2023 10:55:17 -0400
Received: from mxout5.mail.janestreet.com ([64.215.233.18]:46305)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <sbaugh@HIDDEN>) id 1q1ptT-0004LP-5z
 for 63648 <at> debbugs.gnu.org; Wed, 24 May 2023 10:55:15 -0400
From: Spencer Baugh <sbaugh@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
In-Reply-To: <86wn10e1wl.fsf@HIDDEN> (Juri Linkov's message of "Mon, 
 22 May 2023 20:51:14 +0300")
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
Date: Wed, 24 May 2023 10:55:09 -0400
Message-ID: <iera5xt7p9u.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: 63648
Cc: 63648 <at> debbugs.gnu.org
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 (-)

Juri Linkov <juri@HIDDEN> writes:
>> (Tangential further thought: I wonder if we could make C-x p work as a
>> prefix for all commands automatically, so for example C-x p C-x C-j
>> would open the project root, C-x p M-& would run a shell command in the
>> root, etc.  That would be neat.)
>
> IOW, like 'C-x p p' but without asking for another project.  Doable as well.

I'm curious, how are you thinking this would be implemented?  My thought
was that C-x p would act as a prefix for any key sequence in this way,
*but* also C-x p c and the other things currently in project-prefix-map
would still be explicitly bound, so they can be looked up with
describe-key.  And also, C-x p C-h should still run
describe-prefix-bindings.  I don't know how one would achieve this...




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

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


Received: (at 63648) by debbugs.gnu.org; 24 May 2023 06:33:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 24 02:33:20 2023
Received: from localhost ([127.0.0.1]:40991 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q1i3h-0004Cc-2D
	for submit <at> debbugs.gnu.org; Wed, 24 May 2023 02:33:20 -0400
Received: from relay8-d.mail.gandi.net ([217.70.183.201]:33007)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1q1i3f-0004CO-5m
 for 63648 <at> debbugs.gnu.org; Wed, 24 May 2023 02:33:15 -0400
Received: (Authenticated sender: juri@HIDDEN)
 by mail.gandi.net (Postfix) with ESMTPSA id A95D11BF20A;
 Wed, 24 May 2023 06:33:07 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Dmitry Gutov <dmitry@HIDDEN>
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
In-Reply-To: <482a1ebc-165c-a0a4-98c0-5c404d1b1d0d@HIDDEN> (Dmitry Gutov's
 message of "Wed, 24 May 2023 04:14:05 +0300")
Organization: LINKOV.NET
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
 <482a1ebc-165c-a0a4-98c0-5c404d1b1d0d@HIDDEN>
Date: Wed, 24 May 2023 09:20:28 +0300
Message-ID: <86jzwyxnxb.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-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 63648
Cc: Spencer Baugh <sbaugh@HIDDEN>, 63648 <at> debbugs.gnu.org
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 (-)

>>> C-x p p some/project RET C-x v +
>>>
>>> because I wanted to immediately pull that project.  Intuitively it made
>>> sense to me that that should work, it would be nice if it did actually
>>> work.
>> This should be possible to implement by using 'set-transient-map'.
>>
>>> (Tangential further thought: I wonder if we could make C-x p work as a
>>> prefix for all commands automatically, so for example C-x p C-x C-j
>>> would open the project root, C-x p M-& would run a shell command in the
>>> root, etc.  That would be neat.)
>> IOW, like 'C-x p p' but without asking for another project.  Doable as well.
>
> That sounds like a cool potential addition, just we all need to keep in
> mind that not every command will be 100% compatible with the approach.

Why not every command?  For example, 100% commands are compatible with
'C-x t t.'

> One example is the bug#58784 where changing default-directory made
> project-switch-to-buffer behave incorrectly. Maybe there are some less
> subtle examples as well.

'display-buffer-override-next-command' already solved these problems.
So a similar function could remember 'project-current-directory-override'
for the next command.




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

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


Received: (at 63648) by debbugs.gnu.org; 24 May 2023 01:14:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 23 21:14:14 2023
Received: from localhost ([127.0.0.1]:40706 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q1d4w-00018T-A5
	for submit <at> debbugs.gnu.org; Tue, 23 May 2023 21:14:14 -0400
Received: from out1-smtp.messagingengine.com ([66.111.4.25]:41303)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dmitry@HIDDEN>) id 1q1d4v-00018G-8t
 for 63648 <at> debbugs.gnu.org; Tue, 23 May 2023 21:14:13 -0400
Received: from compute3.internal (compute3.nyi.internal [10.202.2.43])
 by mailout.nyi.internal (Postfix) with ESMTP id 2811F5C00F9;
 Tue, 23 May 2023 21:14:08 -0400 (EDT)
Received: from mailfrontend1 ([10.202.2.162])
 by compute3.internal (MEProxy); Tue, 23 May 2023 21:14:08 -0400
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=
 1684890848; x=1684977248; bh=5BUYO3tSDexgpcSf2riTBqgc71epbiHuRvA
 7vMuCrko=; b=efRS01dUwEZ9ZU8HoKBH3/zr2UVGKACr8Oh2WyomV9ri8NL6TVf
 IOOvi4ZDnTPYbeCs2GYilbTMXN4x4HoVBTTTHsUC5wgzyeslkV4lSswwfBbxyfGu
 dVX3jgVm/oFn9A69ozTxdG9yYO/pSHVHKWgaZ4PqdJhviY+JKtVmJndDx+2Q5J3Y
 mP5IRxLDvvmzxB4nHOlod7sxZuVyQBGlknBmQeZxueCq7PYXiKenV+Aw6trQ5pPr
 lEqB+g3WedSWLlLTtG5UvxNLBu2vlBf5fuDeDf7NnX1T8uqvx/U6rGbAOrYhMaM7
 4Go2ygKO5T3+tN0fPf8gzEy0lt4lWy7I9yg==
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=
 1684890848; x=1684977248; bh=5BUYO3tSDexgpcSf2riTBqgc71epbiHuRvA
 7vMuCrko=; b=U40nSq9e7nyJkmQh0qigHITlQum0V1C53qMNEqsInpPwSMUl5Yp
 yqDYhC4bjL1zHgeeR6IZ/2t/d3l3o17aZKBIlccwOqKgnO3B1Hg6Ib5BAGTGGaef
 wteM/TpDtsnIpB7jCYoTKauZNptTzTWFSlohgvdFJkheAoSs9CUSMHyQEmZIp3AT
 I/V58nwkEyFNPN4FGAyhonnpiPBK7APtzsdoLUAxczk0cwBJ1nNX6QW7h98cC3ex
 686LeeTwLK9Fsd2dRNTR7vij6af+wE3q6RgtwVD+gvCPwOv46ePrezUOEl1Yf7XO
 jq46UgY6bTXh6KbUDxuzrJiDZuRmV6vAlNg==
X-ME-Sender: <xms:4GRtZJkY9SB0NXQBITLyeuAPtbiwjuW1-ya-wMoXXGgMJEaCmVRwzA>
 <xme:4GRtZE0Ld9_ihnG3PBhRQeem5mdPHz9s1MTeIrf42MV54QV9JeUGTDisr6ivngltb
 eZUaLc4Q9EydiGfkS8>
X-ME-Received: <xmr:4GRtZPpVM0KLhNbzpVWdwTuAlG1G8WvcRaePbQrw0-xc24gFRBG1NIG3O0f6c7E>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeejgedggeefucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi
 thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth
 htvghrnhepiefgteevheevveffheeltdeukeeiieekueefgedugfefgefhudelgfefveel
 vdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug
 hmihhtrhihsehguhhtohhvrdguvghv
X-ME-Proxy: <xmx:4GRtZJmjdaJzPWDY5HF63i9M3mYUDjvEJf8DJFAal2o1f9R_U7vnYA>
 <xmx:4GRtZH3iYZgzJJtExBPc7gI-rj2lVMy_UuEsiBAriXP4W6pPQt0byA>
 <xmx:4GRtZItZTIXoNegGJGeg0E4agT0VTvfsIykFODdZgNZiF-jW5xMJlQ>
 <xmx:4GRtZA8pOsmvqvXWZV1YlBL5XhDJmGcGhVxMOlkpUxrj5oAnSeamPg>
Feedback-ID: i0e71465a:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue,
 23 May 2023 21:14:06 -0400 (EDT)
Message-ID: <482a1ebc-165c-a0a4-98c0-5c404d1b1d0d@HIDDEN>
Date: Wed, 24 May 2023 04:14:05 +0300
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.11.0
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
Content-Language: en-US
To: Juri Linkov <juri@HIDDEN>, Spencer Baugh <sbaugh@HIDDEN>
References: <ierttw472m1.fsf@HIDDEN> <86wn10e1wl.fsf@HIDDEN>
From: Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <86wn10e1wl.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -1.8 (-)
X-Debbugs-Envelope-To: 63648
Cc: 63648 <at> debbugs.gnu.org
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: -2.8 (--)

On 22/05/2023 20:51, Juri Linkov wrote:
>> 1. (setq project-switch-use-entire-map t)
>> 2. C-x p p some/project RET
>> 3. At the prompt, C-x C-j
>> 4. Errors with:
>> project-switch-project: Wrong type argument: commandp, 1
>>
>> Desired behavior: commands should run with default-directory of the
>> project-root.  So C-x C-j should open dired in the project root.
>>
>> I specifically ran into this when doing
>> C-x p p some/project RET C-x v +
>>
>> because I wanted to immediately pull that project.  Intuitively it made
>> sense to me that that should work, it would be nice if it did actually
>> work.
> This should be possible to implement by using 'set-transient-map'.
> 
>> (Tangential further thought: I wonder if we could make C-x p work as a
>> prefix for all commands automatically, so for example C-x p C-x C-j
>> would open the project root, C-x p M-& would run a shell command in the
>> root, etc.  That would be neat.)
> IOW, like 'C-x p p' but without asking for another project.  Doable as well.

That sounds like a cool potential addition, just we all need to keep in 
mind that not every command will be 100% compatible with the approach.

One example is the bug#58784 where changing default-directory made 
project-switch-to-buffer behave incorrectly. Maybe there are some less 
subtle examples as well.




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

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


Received: (at 63648) by debbugs.gnu.org; 22 May 2023 17:53:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 22 13:53:00 2023
Received: from localhost ([127.0.0.1]:36320 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q19iO-0003MF-2o
	for submit <at> debbugs.gnu.org; Mon, 22 May 2023 13:53:00 -0400
Received: from relay3-d.mail.gandi.net ([217.70.183.195]:33969)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1q19iK-0003Lk-4J
 for 63648 <at> debbugs.gnu.org; Mon, 22 May 2023 13:52:57 -0400
Received: (Authenticated sender: juri@HIDDEN)
 by mail.gandi.net (Postfix) with ESMTPSA id 1682E60005;
 Mon, 22 May 2023 17:52:48 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Spencer Baugh <sbaugh@HIDDEN>
Subject: Re: bug#63648: 29.0.90; project.el: with switch-use-entire-map,
 switch-project errors on non-project commands
In-Reply-To: <ierttw472m1.fsf@HIDDEN> (Spencer Baugh's message of
 "Mon, 22 May 2023 12:27:50 -0400")
Organization: LINKOV.NET
References: <ierttw472m1.fsf@HIDDEN>
Date: Mon, 22 May 2023 20:51:14 +0300
Message-ID: <86wn10e1wl.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-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 63648
Cc: 63648 <at> debbugs.gnu.org
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 (-)

> 1. (setq project-switch-use-entire-map t)
> 2. C-x p p some/project RET
> 3. At the prompt, C-x C-j
> 4. Errors with:
> project-switch-project: Wrong type argument: commandp, 1
>
> Desired behavior: commands should run with default-directory of the
> project-root.  So C-x C-j should open dired in the project root.
>
> I specifically ran into this when doing
> C-x p p some/project RET C-x v +
>
> because I wanted to immediately pull that project.  Intuitively it made
> sense to me that that should work, it would be nice if it did actually
> work.

This should be possible to implement by using 'set-transient-map'.

> (Tangential further thought: I wonder if we could make C-x p work as a
> prefix for all commands automatically, so for example C-x p C-x C-j
> would open the project root, C-x p M-& would run a shell command in the
> root, etc.  That would be neat.)

IOW, like 'C-x p p' but without asking for another project.  Doable as well.




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

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


Received: (at submit) by debbugs.gnu.org; 22 May 2023 16:28:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 22 12:28:02 2023
Received: from localhost ([127.0.0.1]:36092 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q18O8-0000cH-JY
	for submit <at> debbugs.gnu.org; Mon, 22 May 2023 12:28:02 -0400
Received: from lists.gnu.org ([209.51.188.17]:51594)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <sbaugh@HIDDEN>) id 1q18O5-0000c8-6o
 for submit <at> debbugs.gnu.org; Mon, 22 May 2023 12:27:58 -0400
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 1q18O4-0006O0-Pf
 for bug-gnu-emacs@HIDDEN; Mon, 22 May 2023 12:27:56 -0400
Received: from mxout6.mail.janestreet.com ([64.215.233.21])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <sbaugh@HIDDEN>)
 id 1q18O1-00061D-I5
 for bug-gnu-emacs@HIDDEN; Mon, 22 May 2023 12:27:56 -0400
From: Spencer Baugh <sbaugh@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 29.0.90; project.el: with switch-use-entire-map, switch-project
 errors on non-project commands
Date: Mon, 22 May 2023 12:27:50 -0400
Message-ID: <ierttw472m1.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=64.215.233.21; envelope-from=sbaugh@HIDDEN;
 helo=mxout6.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_H2=-0.001,
 SPF_HELO_PASS=-0.001, SPF_PASS=-0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.4 (-)
X-Debbugs-Envelope-To: submit
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: -2.4 (--)


1. (setq project-switch-use-entire-map t)
2. C-x p p some/project RET
3. At the prompt, C-x C-j
4. Errors with:
project-switch-project: Wrong type argument: commandp, 1

Desired behavior: commands should run with default-directory of the
project-root.  So C-x C-j should open dired in the project root.

I specifically ran into this when doing
C-x p p some/project RET C-x v +

because I wanted to immediately pull that project.  Intuitively it made
sense to me that that should work, it would be nice if it did actually
work.

(Tangential further thought: I wonder if we could make C-x p work as a
prefix for all commands automatically, so for example C-x p C-x C-j
would open the project root, C-x p M-& would run a shell command in the
root, etc.  That would be neat.)


In GNU Emacs 29.0.90 (build 3, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.15.12, Xaw scroll bars) of 2023-05-17 built on
 igm-qws-u22796a
Repository revision: 4d08492296c2a6d2910f2b740c2d2508275458fc
Repository branch: emacs-29
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: CentOS Linux 7 (Core)

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

Configured features:
CAIRO DBUS FREETYPE GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LIBSELINUX LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND
SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XINPUT2 XPM LUCID
ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Messages

Minor modes in effect:
  jane-fe-minor-mode: t
  editorconfig-mode: t
  which-function-mode: t
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  shell-dirtrack-mode: t
  windmove-mode: t
  savehist-mode: t
  save-place-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tab-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  context-menu-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/project hides /home/sbaugh/.emacs.d/elpa/project-0.9.8/project
/usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/xref hides /home/sbaugh/.emacs.d/elpa/xref-1.6.3/xref
/usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/csharp-mode hides /home/sbaugh/src/emacs/emacs-29/lisp/progmodes/csharp-mode
/usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/xref hides /home/sbaugh/src/emacs/emacs-29/lisp/progmodes/xref
/usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/project hides /home/sbaugh/src/emacs/emacs-29/lisp/progmodes/project
/usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/eldoc hides /home/sbaugh/src/emacs/emacs-29/lisp/emacs-lisp/eldoc
/usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/auctex/lpath hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/dictionary/lpath
/home/sbaugh/src/emacs/emacs-29/lisp/net/dictionary hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/dictionary/dictionary
/usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/caml-font hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/ocaml/caml-font
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-version hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-version
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-loaddefs hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-loaddefs
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-keys hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-keys
/home/sbaugh/src/emacs/emacs-29/lisp/org/ol hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ol
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-perl hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-perl
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-core hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-core
/home/sbaugh/src/emacs/emacs-29/lisp/org/ox hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ox
/home/sbaugh/src/emacs/emacs-29/lisp/org/ol-rmail hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ol-rmail
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-octave hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-octave
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-comint hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-comint
/home/sbaugh/src/emacs/emacs-29/lisp/org/ol-w3m hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ol-w3m
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-org hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-org
/home/sbaugh/src/emacs/emacs-29/lisp/org/ox-texinfo hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ox-texinfo
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-inlinetask hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-inlinetask
/home/sbaugh/src/emacs/emacs-29/lisp/org/ol-mhe hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ol-mhe
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-ocaml hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-ocaml
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-clojure hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-clojure
/home/sbaugh/src/emacs/emacs-29/lisp/org/ox-publish hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ox-publish
/home/sbaugh/src/emacs/emacs-29/lisp/org/ol-irc hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ol-irc
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-calc hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-calc
/home/sbaugh/src/emacs/emacs-29/lisp/org/ox-odt hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ox-odt
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-id hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-id
/home/sbaugh/src/emacs/emacs-29/lisp/org/ol-gnus hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ol-gnus
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-matlab hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-matlab
/home/sbaugh/src/emacs/emacs-29/lisp/org/ox-icalendar hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ox-icalendar
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-footnote hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-footnote
/home/sbaugh/src/emacs/emacs-29/lisp/org/ol-bibtex hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ol-bibtex
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-lisp hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-lisp
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-C hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-C
/home/sbaugh/src/emacs/emacs-29/lisp/org/ox-org hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ox-org
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-indent hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-indent
/home/sbaugh/src/emacs/emacs-29/lisp/org/ol-info hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ol-info
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-maxima hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-maxima
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-awk hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-awk
/home/sbaugh/src/emacs/emacs-29/lisp/org/ox-man hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ox-man
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-goto hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-goto
/home/sbaugh/src/emacs/emacs-29/lisp/org/ox-md hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ox-md
/home/sbaugh/src/emacs/emacs-29/lisp/org/ol-eshell hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ol-eshell
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-lua hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-lua
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-habit hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-habit
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-R hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-R
/home/sbaugh/src/emacs/emacs-29/lisp/org/ol-eww hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ol-eww
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-makefile hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-makefile
/home/sbaugh/src/emacs/emacs-29/lisp/org/ox-latex hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ox-latex
/home/sbaugh/src/emacs/emacs-29/lisp/org/ol-docview hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ol-docview
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-lob hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-lob
/home/sbaugh/src/emacs/emacs-29/lisp/org/ox-beamer hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ox-beamer
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-faces hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-faces
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob
/home/sbaugh/src/emacs/emacs-29/lisp/org/ox-html hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ox-html
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-feed hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-feed
/home/sbaugh/src/emacs/emacs-29/lisp/org/ol-bbdb hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ol-bbdb
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-lilypond hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-lilypond
/home/sbaugh/src/emacs/emacs-29/lisp/org/ox-ascii hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ox-ascii
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-latex hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-latex
/home/sbaugh/src/emacs/emacs-29/lisp/org/org hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-tangle hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-tangle
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-tempo hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-tempo
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-duration hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-duration
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-sqlite hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-sqlite
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-entities hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-entities
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-table hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-table
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-js hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-js
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-table hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-table
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-sql hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-sql
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-timer hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-timer
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-element hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-element
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-java hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-java
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-ctags hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-ctags
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-shell hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-shell
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-groovy hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-groovy
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-src hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-src
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-datetree hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-datetree
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-haskell hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-haskell
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-plot hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-plot
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-compat hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-compat
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-screen hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-screen
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-fortran hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-fortran
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-protocol hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-protocol
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-crypt hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-crypt
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-sed hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-sed
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-gnuplot hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-gnuplot
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-pcomplete hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-pcomplete
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-colview hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-colview
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-scheme hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-scheme
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-forth hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-forth
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-num hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-num
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-clock hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-clock
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-exp hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-exp
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-mouse hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-mouse
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-capture hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-capture
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-sass hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-sass
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-eval hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-eval
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-ref hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-ref
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-emacs-lisp hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-emacs-lisp
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-mobile hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-mobile
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-ruby hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-ruby
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-eshell hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-eshell
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-lint hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-lint
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-agenda hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-agenda
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-macro hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-macro
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-attach-git hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-attach-git
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-processing hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-processing
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-css hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-css
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-dot hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-dot
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-list hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-list
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-macs hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-macs
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-attach hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-attach
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-archive hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-archive
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-python hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-python
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-plantuml hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-plantuml
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-ditaa hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-ditaa
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-julia hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/contrib/lisp/ob-julia
/home/sbaugh/src/emacs/emacs-29/lisp/org/ol-man hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/contrib/lisp/ol-man
/home/sbaugh/src/emacs/emacs-29/lisp/org/ox-koma-letter hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/contrib/lisp/ox-koma-letter
/home/sbaugh/.emacs.d/elpa/dash-2.19.1/dash hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/dash/dash
/home/sbaugh/.emacs.d/elpa/dash-2.19.1/dash-functional hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/dash/dash-functional

Features:
(shadow sort mail-extr emacsbug cl-print cus-start cal-iso org-datetree
dired-aux vc-git vc-bzr vc-src vc-sccs vc-svn vc-cvs vc-rcs log-view
ediff ediff-merg ediff-mult ediff-wind ediff-diff ediff-help ediff-init
ediff-util pulse shortdoc help-fns radix-tree misearch multi-isearch
tabify org-capture sh-script treesit grep find-dired executable vc-fe
org-element org-persist org-id org-refile avl-tree generator oc-basic
ol-eww eww xdg url-queue mm-url ol-rmail ol-mhe ol-irc ol-info ol-gnus
nnselect gnus-art mm-uu mml2015 mm-view mml-smime smime gnutls dig
gnus-sum shr pixel-fill kinsoku url-file svg dom gnus-group gnus-undo
gnus-start gnus-dbus dbus xml gnus-cloud nnimap nnmail mail-source utf7
nnoo gnus-spec gnus-int gnus-range gnus-win gnus nnheader range
ol-docview doc-view jka-compr image-mode exif ol-bibtex bibtex ol-bbdb
ol-w3m ol-doi org-link-doi goto-addr cus-edit cus-load wid-edit vc-hg
vc-dir vc vc-dispatcher tramp tramp-loaddefs trampver tramp-integration
tramp-compat parse-time iso8601 ls-lisp jane-project ffap jane-merlin
merlin-imenu merlin-xref merlin-cap merlin jane-async-merlin
jane-completion jane-common jane-fe-project xref jane-fe-menu
ecaml_plugin linum view gopcaml magit-bookmark bookmark image+ advice
image-file image-converter editorconfig editorconfig-core
editorconfig-core-handle editorconfig-fnmatch whitespace jane-auto-modes
vba-mode markdown-mode color jane jane-micro-features jane-diff
unified-test-mode shell-file core core-buffer core-error core-util ert
pp ewoc debug backtrace jane-sexp jane-ocaml jane-tuareg-theme tuareg
tuareg-compat tuareg-opam skeleton flymake-proc flymake warnings
thingatpt smie caml-types caml-help caml-emacs find-file compile jane-cr
jane-align jane-deprecated jane-smerge gnu-elpa-keyring-update
jane-ocp-indent ocp-indent cl jane-util ob-shell page-ext dired-x
magit-extras project magit-submodule magit-obsolete magit-blame
magit-stash magit-reflog magit-bisect magit-push magit-pull magit-fetch
magit-clone magit-remote magit-commit magit-sequence magit-notes
magit-worktree magit-tag magit-merge magit-branch magit-reset
magit-files magit-refs magit-status magit magit-repos magit-apply
magit-wip magit-log which-func imenu magit-diff smerge-mode diff
diff-mode git-commit log-edit message sendmail yank-media puny dired
dired-loaddefs rfc822 mml mml-sec epa epg rfc6068 epg-config gnus-util
text-property-search mm-decode mm-bodies mm-encode mail-parse rfc2231
rfc2047 rfc2045 mm-util ietf-drums mail-prsvr mailabbrev mail-utils
gmm-utils mailheader pcvs-util add-log magit-core magit-autorevert
autorevert filenotify magit-margin magit-transient magit-process
with-editor shell server magit-mode transient edmacro kmacro magit-git
magit-section magit-utils crm dash cl-extra help-mode windmove org ob
ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-src ob-comint
org-pcomplete pcomplete org-list org-footnote org-faces org-entities
time-date noutline outline icons ob-emacs-lisp ob-core ob-eval org-cycle
org-table ol rx org-fold org-fold-core org-keys oc org-loaddefs
find-func cal-menu calendar cal-loaddefs org-version org-compat org-macs
format-spec gdb-mi bindat gud comint easy-mmode files-x derived ansi-osc
ansi-color ring vundo pcase cyberpunk-theme savehist saveplace
project-autoloads vundo-autoloads magit-autoloads xref-autoloads
csv-mode-autoloads magit-section-autoloads cyberpunk-theme-autoloads
url-http-ntlm-autoloads url-auth git-commit-autoloads
with-editor-autoloads finder-inf info dash-autoloads vc-hgcmd-autoloads
package browse-url url url-proxy url-privacy url-expand url-methods
url-history url-cookie generate-lisp-file url-domsuf url-util mailcap
url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs
password-cache json subr-x map byte-opt gv bytecomp byte-compile
url-vars cl-loaddefs cl-lib rmc iso-transl tooltip cconv eldoc paren
electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu
timer select scroll-bar mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify
dynamic-setting system-font-setting font-render-setting cairo x-toolkit
xinput2 x multi-tty make-network-process emacs)

Memory information:
((conses 16 650875 91874)
 (symbols 48 45890 12)
 (strings 32 164696 16344)
 (string-bytes 1 5817957)
 (vectors 16 83175)
 (vector-slots 8 1714092 170471)
 (floats 8 577 249)
 (intervals 56 9811 200)
 (buffers 976 43)
 (heap 1024 690393 127136))




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#63648; 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: Mon, 18 Sep 2023 11:15:02 UTC

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