From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#63648: 29.0.90; project.el: with switch-use-entire-map, switch-project errors on non-project commands Date: Wed, 13 Sep 2023 02:47:49 +0300 Message-ID: References: <86jzwyxnxb.fsf@mail.linkov.net> <86o7m91z22.fsf@mail.linkov.net> <86pm6py6k4.fsf@mail.linkov.net> <86bki9y68h.fsf@mail.linkov.net> <86cz2f7bvo.fsf@mail.linkov.net> <86353axu48.fsf@mail.linkov.net> <87o7jfi00b.fsf@catern.com> <86msyhwrrg.fsf@mail.linkov.net> <86y1hs4kkg.fsf@mail.linkov.net> <86h6of66o3.fsf@mail.linkov.net> <86wmxb2qvh.fsf@mail.linkov.net> <8634zyjt0k.fsf@mail.linkov.net> <8d1fb7ac-5c82-0ec2-8ae2-d09c131ec165@gutov.dev> <86edj6hyem.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36461"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Cc: Spencer Baugh , 63648@debbugs.gnu.org, sbaugh@catern.com To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Sep 13 01:49:28 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qgD8J-0009EM-IS for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 13 Sep 2023 01:49:28 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qgD7r-0008LP-Rl; Tue, 12 Sep 2023 19:48:59 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qgD7p-0008Kz-G0 for bug-gnu-emacs@gnu.org; Tue, 12 Sep 2023 19:48:57 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qgD7p-0001XU-8N for bug-gnu-emacs@gnu.org; Tue, 12 Sep 2023 19:48:57 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qgD7u-0001ck-3o for bug-gnu-emacs@gnu.org; Tue, 12 Sep 2023 19:49:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 12 Sep 2023 23:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63648 X-GNU-PR-Package: emacs Original-Received: via spool by 63648-submit@debbugs.gnu.org id=B63648.16945624876014 (code B ref 63648); Tue, 12 Sep 2023 23:49:02 +0000 Original-Received: (at 63648) by debbugs.gnu.org; 12 Sep 2023 23:48:07 +0000 Original-Received: from localhost ([127.0.0.1]:60308 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgD71-0001Ys-4s for submit@debbugs.gnu.org; Tue, 12 Sep 2023 19:48:07 -0400 Original-Received: from out3-smtp.messagingengine.com ([66.111.4.27]:46927) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgD6y-0001Xj-3K for 63648@debbugs.gnu.org; Tue, 12 Sep 2023 19:48:05 -0400 Original-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) Original-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: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudeijedgvdejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth htvghrnhepiefgteevheevveffheeltdeukeeiieekueefgedugfefgefhudelgfefveel vdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug hmihhtrhihsehguhhtohhvrdguvghv X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 12 Sep 2023 19:47:51 -0400 (EDT) Content-Language: en-US In-Reply-To: <86edj6hyem.fsf@mail.linkov.net> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:270231 Archived-At: 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.