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: Mon, 18 Sep 2023 03:12:08 +0300 Message-ID: <50d46d30-a796-b855-0d4c-690d6cb3d15b@gutov.dev> References: <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> <8634zitwoy.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="18749"; 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 Mon Sep 18 02:13:19 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 1qi1t8-0004h6-OO for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 18 Sep 2023 02:13:19 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qi1sq-0004ln-LA; Sun, 17 Sep 2023 20:13:00 -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 1qi1sk-0004ig-7Y for bug-gnu-emacs@gnu.org; Sun, 17 Sep 2023 20:12:55 -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 1qi1sj-0004ly-WD for bug-gnu-emacs@gnu.org; Sun, 17 Sep 2023 20:12:54 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qi1sr-0000zs-MO for bug-gnu-emacs@gnu.org; Sun, 17 Sep 2023 20:13:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 18 Sep 2023 00:13:01 +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.16949959513797 (code B ref 63648); Mon, 18 Sep 2023 00:13:01 +0000 Original-Received: (at 63648) by debbugs.gnu.org; 18 Sep 2023 00:12:31 +0000 Original-Received: from localhost ([127.0.0.1]:51638 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qi1sN-0000zA-Df for submit@debbugs.gnu.org; Sun, 17 Sep 2023 20:12:31 -0400 Original-Received: from wout5-smtp.messagingengine.com ([64.147.123.21]:56911) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qi1sK-0000yu-JZ for 63648@debbugs.gnu.org; Sun, 17 Sep 2023 20:12:30 -0400 Original-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) Original-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: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudejjedgfedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth htvghrnhepiefgteevheevveffheeltdeukeeiieekueefgedugfefgefhudelgfefveel vdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug hmihhtrhihsehguhhtohhvrdguvghv X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 17 Sep 2023 20:12:11 -0400 (EDT) Content-Language: en-US In-Reply-To: <8634zitwoy.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:270729 Archived-At: 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.