From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 15 16:48:13 2023 Received: (at submit) by debbugs.gnu.org; 15 Jun 2023 20:48:13 +0000 Received: from localhost ([127.0.0.1]:48029 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q9tt7-0002B7-27 for submit@debbugs.gnu.org; Thu, 15 Jun 2023 16:48:13 -0400 Received: from lists.gnu.org ([209.51.188.17]:37506) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q9tt4-0002Al-Gc for submit@debbugs.gnu.org; Thu, 15 Jun 2023 16:48:11 -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 ) id 1q9tt4-0007sI-9h for bug-gnu-emacs@gnu.org; Thu, 15 Jun 2023 16:48:10 -0400 Received: from mxout5.mail.janestreet.com ([64.215.233.18]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q9tt1-0000Bj-DF for bug-gnu-emacs@gnu.org; Thu, 15 Jun 2023 16:48:10 -0400 From: Spencer Baugh To: bug-gnu-emacs@gnu.org Subject: [PATCH] Make project-root for vc projects return an absolute path Date: Thu, 15 Jun 2023 16:48:05 -0400 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=64.215.233.18; envelope-from=sbaugh@janestreet.com; helo=mxout5.mail.janestreet.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_MSPIKE_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@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) --=-=-= Content-Type: text/plain Tags: patch Before this, if a vc project was in the user's home directory, project-root would be "~/some/path". This violates the spec of project-root, which requires an absolute path. One concrete bug caused by this is that (project-forget-project "~/some/path") would work but (project-forget-project "/home/user/some/path") would not. I ran into this while trying to use file-notify to automatically discover and forget projects. file-notify returns truly absolute paths, so I ran into the aforementioned concrete bug. In GNU Emacs 29.0.90 (build 8, x86_64-pc-linux-gnu, X toolkit, cairo version 1.15.12, Xaw scroll bars) of 2023-06-04 built on igm-qws-u22796a Repository revision: 11d76029db5f0d9e016f247aac24dd430b729c2a 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' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Make-project-root-for-vc-projects-return-an-absolute.patch >From 2c3ed85f857759458130a7b707d9b6f4d2c1ef20 Mon Sep 17 00:00:00 2001 From: Spencer Baugh Date: Thu, 15 Jun 2023 16:45:48 -0400 Subject: [PATCH] Make project-root for vc projects return an absolute path Before this, if a vc project was in the user's home directory, project-root would be "~/some/path". This violates the spec of project-root, which requires an absolute path. One concrete bug caused by this is that (project-forget-project "~/some/path") would work but (project-forget-project "/home/user/some/path") would not. * lisp/progmodes/project.el (project-try-vc): Expand root directory before returning project. --- lisp/progmodes/project.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 2cffc1c0669..72cdb94bce4 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -689,7 +689,7 @@ project-try-vc (let* ((parent (file-name-directory (directory-file-name root)))) (setq root (vc-call-backend 'Git 'root parent)))) (when root - (setq project (list 'vc backend root)) + (setq project (list 'vc backend (expand-file-name root))) ;; FIXME: Cache for a shorter time. (vc-file-setprop dir 'project-vc project) project)))) -- 2.39.3 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 16 01:52:23 2023 Received: (at 64088) by debbugs.gnu.org; 16 Jun 2023 05:52:23 +0000 Received: from localhost ([127.0.0.1]:48468 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qA2Ni-0006g9-VF for submit@debbugs.gnu.org; Fri, 16 Jun 2023 01:52:23 -0400 Received: from eggs.gnu.org ([209.51.188.92]:39602) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qA2Nh-0006ft-2W for 64088@debbugs.gnu.org; Fri, 16 Jun 2023 01:52:21 -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 ) id 1qA2Nb-0006b9-Qx; Fri, 16 Jun 2023 01:52:15 -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=BGGyP+ZPpxfrlECh2ZRtrF/RQIhGgjn98Ybx7eGKK5s=; b=pZ3JNVHjmxEE loGS+Fcf8s/7gLmFtX5mVZ1hT/MkYO45vlQRDfWislvdqadnJ8H2zdoiq6V+xV0HrG/Fr7rdJzJoy VGaPdXRbZfBwcgstH+5X6IFQ1Y5Nm9dCf1U5eg4YR+7om5fSU5htaYWBm4QBCiLBLV7ryoW3zsftF L7oj79bgrRZCfIkBmgi6mGUP2s5O2BGRY0B+7hIVE1Mw90JdzP7vdBNfp2KnsO4OFTdwwB4SAkMF3 2MbkGkQ7r1RgIwWBiJIpyU76C3rVpdzsKMAsAIL29t5iHTnNx+sLf25RFSSmfEZUCZWrRKxqTgvQ2 +occCj31QRyRAWWQttYRiA==; 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 ) id 1qA2Nb-0004Ve-AL; Fri, 16 Jun 2023 01:52:15 -0400 Date: Fri, 16 Jun 2023 08:52:40 +0300 Message-Id: <838rckt0lz.fsf@gnu.org> From: Eli Zaretskii To: Spencer Baugh In-Reply-To: (message from Spencer Baugh on Thu, 15 Jun 2023 16:48:05 -0400) Subject: Re: bug#64088: [PATCH] Make project-root for vc projects return an absolute path References: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 64088 Cc: 64088@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Spencer Baugh > Date: Thu, 15 Jun 2023 16:48:05 -0400 > > Before this, if a vc project was in the user's home directory, > project-root would be "~/some/path". This violates the spec of > project-root, which requires an absolute path. File names like "~/some/file" are considered absolute in Emacs: (file-name-absolute-p "~/foo") => t > One concrete bug > caused by this is that (project-forget-project "~/some/path") would > work but (project-forget-project "/home/user/some/path") would not. That problem is simple to solve where it happens, no? That is, project-forget-project should try looking not just for the literal root, but also for its expanded and abbreviated forms, and that's all. > I ran into this while trying to use file-notify to automatically > discover and forget projects. file-notify returns truly absolute paths, > so I ran into the aforementioned concrete bug. And please do not use "path" when you mean file names. > >From 2c3ed85f857759458130a7b707d9b6f4d2c1ef20 Mon Sep 17 00:00:00 2001 > From: Spencer Baugh > Date: Thu, 15 Jun 2023 16:45:48 -0400 > Subject: [PATCH] Make project-root for vc projects return an absolute path > > Before this, if a vc project was in the user's home directory, > project-root would be "~/some/path". This violates the spec of > project-root, which requires an absolute path. One concrete bug > caused by this is that (project-forget-project "~/some/path") would > work but (project-forget-project "/home/user/some/path") would not. > > * lisp/progmodes/project.el (project-try-vc): Expand root directory > before returning project. > --- > lisp/progmodes/project.el | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el > index 2cffc1c0669..72cdb94bce4 100644 > --- a/lisp/progmodes/project.el > +++ b/lisp/progmodes/project.el > @@ -689,7 +689,7 @@ project-try-vc > (let* ((parent (file-name-directory (directory-file-name root)))) > (setq root (vc-call-backend 'Git 'root parent)))) > (when root > - (setq project (list 'vc backend root)) > + (setq project (list 'vc backend (expand-file-name root))) > ;; FIXME: Cache for a shorter time. > (vc-file-setprop dir 'project-vc project) > project)))) I think this fixes a problem in the wrong place. It should be fixed where it happens, i.e. in project--remove-from-project-list. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 16 22:44:10 2023 Received: (at 64088) by debbugs.gnu.org; 17 Jun 2023 02:44:10 +0000 Received: from localhost ([127.0.0.1]:50651 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qALv7-0004hr-Uj for submit@debbugs.gnu.org; Fri, 16 Jun 2023 22:44:10 -0400 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]:52969) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qALv6-0004hb-2T for 64088@debbugs.gnu.org; Fri, 16 Jun 2023 22:44:08 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 60FB73200916; Fri, 16 Jun 2023 22:44:01 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Fri, 16 Jun 2023 22:44:01 -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= 1686969840; x=1687056240; bh=oHhsQLFDXtSZMRCwS0Et9hSChqfnIEHTobf dFaMqskQ=; b=bhXcUnTpPpL05F9kM2YRIlDgmHhC5Z1yXrhw+p7c6SG+lwIXUdm OAt0/LUEr1A0eTO0ysfwuU2WnriswMz5kTHyR1VMwql2TDWs0ZsPIVtQRgRn+8ot Q/x0GNNh8XYl2aNTBv+zop6r6JT/kCOGBF/pMCNaaY8Z66w50gUmNznOdtnHU5DD IFobyYh8gR5CNeiCHIR0bsi2wtke36rwIOaXZSIEbATaTttQwinO7mmSbNthey5h bqaC45dQHqP6xRZbZOMmwmWvxn+KBqjHNt65UshaEH1+kcOd5zxXWklFNXKeagz2 zIwE0+RtKl3sS98YhGvM3x8luvXToij5oRw== 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= 1686969840; x=1687056240; bh=oHhsQLFDXtSZMRCwS0Et9hSChqfnIEHTobf dFaMqskQ=; b=DcCjzq6D20Aiu6Xwef1CcYbZngeI+Dm9asPLWDgDENKe77OvMvw 7vOOSwRpBpePoq8a2tV/hdxWQf7v8UCH6S6Xpv3JmvCEXd7INmbIjqCJBTk7pE+t VN4hwVxJ0aPBQH8YEKmubTkBS67QIHN/qx1XZhKnXm1FCJK8+wXAXNShjLXRgsi6 8T33jnFExCx5WbbW1TbmSmr+meZSgfCjfXmYq9VqS0J9Z04oO/dJDTiFjrBwMudj MSmRgDTJoHyjsUZvXpihpJ0Pvc8a/d9XZTz15mGfkGkzrHeQ1hfTwcDR2pER65vF 5iT8e8PBxoWyeEp0XnSb4XdPfBwPVS01/6Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrgedviedgvdegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth htvghrnhepiefgteevheevveffheeltdeukeeiieekueefgedugfefgefhudelgfefveel vdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug hmihhtrhihsehguhhtohhvrdguvghv X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 16 Jun 2023 22:43:59 -0400 (EDT) Message-ID: <7dc390c9-5888-ee7b-386e-21054ec9f2d6@gutov.dev> Date: Sat, 17 Jun 2023 05:43:58 +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#64088: [PATCH] Make project-root for vc projects return an absolute path Content-Language: en-US To: Eli Zaretskii , Spencer Baugh References: <838rckt0lz.fsf@gnu.org> From: Dmitry Gutov In-Reply-To: <838rckt0lz.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 64088 Cc: 64088@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.9 (--) On 16/06/2023 08:52, Eli Zaretskii wrote: >> One concrete bug >> caused by this is that (project-forget-project "~/some/path") would >> work but (project-forget-project "/home/user/some/path") would not. > That problem is simple to solve where it happens, no? That is, > project-forget-project should try looking not just for the literal > root, but also for its expanded and abbreviated forms, and that's all. Alternatively, we could force-convert it to one or the other form when saving a new value to the list. Then we'd only need to convert a searches value to one of the forms. From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 16 22:47:11 2023 Received: (at 64088) by debbugs.gnu.org; 17 Jun 2023 02:47:12 +0000 Received: from localhost ([127.0.0.1]:50656 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qALy3-0004mc-Hy for submit@debbugs.gnu.org; Fri, 16 Jun 2023 22:47:11 -0400 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]:42785) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qALy0-0004mP-MO for 64088@debbugs.gnu.org; Fri, 16 Jun 2023 22:47:09 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 146833200928; Fri, 16 Jun 2023 22:47:03 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Fri, 16 Jun 2023 22:47:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=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= 1686970022; x=1687056422; bh=trHx7hYydFU9f8jNnMy7wewtc4B1HgyemOo 8Gje1QtE=; b=u5RgrP6XJeGCW0anJlL/zEE8nswHV3AuEqzbKMuT9wSfSafUBHP Enk6Wza/ANmX4jm4fH3oPQQRRDXVcYIR6Iqn6gbNjnZoBvsNIyvGVMIaxCJeAt7n p7Hz8zwA1NaZZHt7JnTYLMD6Y2BS+WDU+rSx4fVTjSy35Am3mbgjcNqpGq/5YEdz 0NuyACtczrRa6ZGcHvzQ05W0H1ghqO2me3xBrnR+UFxDII7+x4TPidd02+5ao84O WsVrOYSjfMAs5vOjgC/YXNDSqRjIFNTMmKRpU8EnvUtWZxQcq6uPS/TZG/o31u7q 4jt27SxXDqh0+9IU8uSfSlo5O7KiPkMF85Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=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=1686970022; x= 1687056422; bh=trHx7hYydFU9f8jNnMy7wewtc4B1HgyemOo8Gje1QtE=; b=r EUvxzjQC75HjBJlJpw4+N1XaHgEWE8bLPIlfN1dCoF5jfavDxbfTW6MRusYmZFpP GzLn3DrGfJst4Ubqf7ViCGj1xqrvf3tPCkqcqjHAWWR1j3iz0T3CQdLEwa/yr13V rVTQhdvh+9Sn/fFOzEDSMqpd/8TlWCj4CgcQM/ebqYQ/gC7AdR5Vvj3wC7WgFI73 0SIHD/VKkmqIJdw1N/xUPSjJorf+n9B26CBf5HUe0dP43Uuv3Plxr6PkcpqJ3K+n E69NxvDHoRZv5esmWgvtbzuxu+eyiUPoOpqotd22XRkE1B+SraZTfX2IkFcIExOF XZu6Vs6LwRyephrMlFTOQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrgedviedgvdegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvfhfhjggtgfesthejredttdefjeenucfhrhhomhepffhmihht rhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrdguvghvqeenucggtffrrghtth gvrhhnpeeghedthedujeeiteeutddtjeekheejteeukeehffdutdejuedvfeevueeviedu udenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegumh hithhrhiesghhuthhovhdruggvvh X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 16 Jun 2023 22:47:01 -0400 (EDT) Message-ID: <3c6078aa-4089-46fd-18bb-d92be101ca4f@gutov.dev> Date: Sat, 17 Jun 2023 05:47:00 +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#64088: [PATCH] Make project-root for vc projects return an absolute path Content-Language: en-US To: Spencer Baugh , 64088@debbugs.gnu.org References: From: Dmitry Gutov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 64088 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.9 (--) On 15/06/2023 23:48, Spencer Baugh wrote: > - (setq project (list 'vc backend root)) > + (setq project (list 'vc backend (expand-file-name root))) Spec violated or not (like Eli said, abbreviated names are still absolute), we should probably try to fix this in another place, so that other backends (whatever external ones exist) don't have to worry about the distinction. As you can see, in project-buffers, for example, we call expand-file-name. From debbugs-submit-bounces@debbugs.gnu.org Sat Jun 17 02:25:46 2023 Received: (at 64088) by debbugs.gnu.org; 17 Jun 2023 06:25:46 +0000 Received: from localhost ([127.0.0.1]:50749 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qAPNa-0005j8-3O for submit@debbugs.gnu.org; Sat, 17 Jun 2023 02:25:46 -0400 Received: from eggs.gnu.org ([209.51.188.92]:40560) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qAPNX-0005it-PL for 64088@debbugs.gnu.org; Sat, 17 Jun 2023 02:25:44 -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 ) id 1qAPNR-0006Ec-Us; Sat, 17 Jun 2023 02:25:37 -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=qbhl373jmUn+gI2fUlOjycz6lDzzIhNsUXu/i/Ljtxg=; b=RQzTXnJ4tOlS II4FNWyTFQAHLbUFL3m6+SG4P34Bpa4D/naRXkWMa0eiNR5ZFqzLtP+m+TpJjXweWG8SPNuNysBy2 0ytedARobJphg5oErsCXBm6g48OZVFzvAXrO/3masF2fDOklmh93R2ASf94OWHEjBUiKVgnd/7cKj RGWcZNk5vEwzGi17R+92zPI0OeKIRFaQfjVh2FcN2rKnxjuhNxhABbdpI8EShbrCc2OEcD+BTSSxh sCyG0zZFO9n9mCVdLoFOMY35BWZKzNurcFTQXrtG5BMRaeoZrdEIfRPYkZ6Ygff5pqyiTt/HE9lmS Azh5lokBzQ5eBuFVSp96uw==; 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 ) id 1qAPNR-0005Jx-EZ; Sat, 17 Jun 2023 02:25:37 -0400 Date: Sat, 17 Jun 2023 09:25:36 +0300 Message-Id: <835y7msizj.fsf@gnu.org> From: Eli Zaretskii To: Dmitry Gutov In-Reply-To: <7dc390c9-5888-ee7b-386e-21054ec9f2d6@gutov.dev> (message from Dmitry Gutov on Sat, 17 Jun 2023 05:43:58 +0300) Subject: Re: bug#64088: [PATCH] Make project-root for vc projects return an absolute path References: <838rckt0lz.fsf@gnu.org> <7dc390c9-5888-ee7b-386e-21054ec9f2d6@gutov.dev> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 64088 Cc: sbaugh@janestreet.com, 64088@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Sat, 17 Jun 2023 05:43:58 +0300 > Cc: 64088@debbugs.gnu.org > From: Dmitry Gutov > > On 16/06/2023 08:52, Eli Zaretskii wrote: > >> One concrete bug > >> caused by this is that (project-forget-project "~/some/path") would > >> work but (project-forget-project "/home/user/some/path") would not. > > That problem is simple to solve where it happens, no? That is, > > project-forget-project should try looking not just for the literal > > root, but also for its expanded and abbreviated forms, and that's all. > > Alternatively, we could force-convert it to one or the other form when > saving a new value to the list. Then we'd only need to convert a > searches value to one of the forms. How do we know such conversion will not cause other similar problems? IME, low-level functions should not make any assumptions about what higher-level code will need. On the contrary, it's higher-level code which knows what it needs that should do the conversions it needs. From debbugs-submit-bounces@debbugs.gnu.org Sat Jun 17 20:43:39 2023 Received: (at 64088) by debbugs.gnu.org; 18 Jun 2023 00:43:39 +0000 Received: from localhost ([127.0.0.1]:52831 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qAgW3-0000Lx-IH for submit@debbugs.gnu.org; Sat, 17 Jun 2023 20:43:39 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:37111) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qAgW0-0000Le-Az for 64088@debbugs.gnu.org; Sat, 17 Jun 2023 20:43:37 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 4027B5C00F5; Sat, 17 Jun 2023 20:43:31 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Sat, 17 Jun 2023 20:43:31 -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= 1687049011; x=1687135411; bh=WDtRLaUBCtg7d5n0ry06dQFf1pr5IyCUb+H D20m/e6U=; b=YrgBFM5XToObeIzBtH9M5/IWC5TI3g51MqmDqe71BzGzpbzcAjc 0RUhExUhObuQVYkda4MMJYPAOYxS2GFl6YofPs0z/A2GZTo4a3Lz4cmE13CPkKTG QzJiT1480Xg9GJlNHK928LQ4HVMQwVL7psI6W2mVAwkUXCwss+lY5S7s8gzte9nk QW2cyLDqQLHT5nEbHxdUZZlmJs8l3CBPx5lUEE9sVcTYZH47Lhmv/8dMjLPUSzY3 +5/3+1FtU3fFNt6igoPENbBcf8PeqPm9XDOYKwPUGsYrNDFynjtLI/nkVuaiOqem QYkAOeS7/f7mWKH+eaMTBZQ+Gfl7sGWmZ5w== 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= 1687049011; x=1687135411; bh=WDtRLaUBCtg7d5n0ry06dQFf1pr5IyCUb+H D20m/e6U=; b=fUcYmm8nt2RcuHqH/QoIg0YycFPXN6z9zvTiIoVy0LEC3/edot5 mzwMeA96Mj6Rf1IILajI8KvtVEYQgvHLC1t8izku+m90upchn5s1y3XwPLvQOWTz oAUYBA3FLO1/hpIuuKW8evXqeOeRZ50DwHtW+3oleCFifT2hmycQPyveobsZs17v Vh5ip8PzAGUa7HDeF6SHYiYIBrb2aDECHzXVym1BJY636CSd75XkZKEESA+4JwRS UtVc8o4ZYSXRzpdDci6mvxx19hBy7ze5PmpODLOdnWoeztkinYSXiDeRpOAy+hiD 5buCnJzjTLufjbhhwH+cAaE8iO9D1RdidPQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrgedvkedgfeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth htvghrnhepiefgteevheevveffheeltdeukeeiieekueefgedugfefgefhudelgfefveel vdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug hmihhtrhihsehguhhtohhvrdguvghv X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 17 Jun 2023 20:43:29 -0400 (EDT) Message-ID: <288fccb0-be65-eb90-6c45-2db2ecebc979@gutov.dev> Date: Sun, 18 Jun 2023 03:43:27 +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#64088: [PATCH] Make project-root for vc projects return an absolute path Content-Language: en-US To: Eli Zaretskii References: <838rckt0lz.fsf@gnu.org> <7dc390c9-5888-ee7b-386e-21054ec9f2d6@gutov.dev> <835y7msizj.fsf@gnu.org> From: Dmitry Gutov In-Reply-To: <835y7msizj.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 64088 Cc: sbaugh@janestreet.com, 64088@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.9 (--) On 17/06/2023 09:25, Eli Zaretskii wrote: > IME, low-level functions should not make any assumptions about what > higher-level code will need. On the contrary, it's higher-level code > which knows what it needs that should do the conversions it needs. That's the idea: project-root is always a callee, not a caller, so it's "low-level", in your terminology. The conversion (or normalization) would happen on the higher level: when the projects are added to the list, or searched. From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 27 16:01:40 2023 Received: (at 64088) by debbugs.gnu.org; 27 Jun 2023 20:01:40 +0000 Received: from localhost ([127.0.0.1]:49578 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qEEsd-00025P-Mv for submit@debbugs.gnu.org; Tue, 27 Jun 2023 16:01:40 -0400 Received: from mxout5.mail.janestreet.com ([64.215.233.18]:40641) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qEEsZ-000257-0i for 64088@debbugs.gnu.org; Tue, 27 Jun 2023 16:01:38 -0400 From: Spencer Baugh To: Dmitry Gutov Subject: Re: bug#64088: [PATCH] Make project-root for vc projects return an absolute path In-Reply-To: <3c6078aa-4089-46fd-18bb-d92be101ca4f@gutov.dev> (Dmitry Gutov's message of "Sat, 17 Jun 2023 05:47:00 +0300") References: <3c6078aa-4089-46fd-18bb-d92be101ca4f@gutov.dev> Date: Tue, 27 Jun 2023 16:01:29 -0400 Message-ID: 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: 64088 Cc: 64088@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Dmitry Gutov writes: > On 15/06/2023 23:48, Spencer Baugh wrote: >> - (setq project (list 'vc backend root)) >> + (setq project (list 'vc backend (expand-file-name root))) > > Spec violated or not (like Eli said, abbreviated names are still > absolute), we should probably try to fix this in another place, so > that other backends (whatever external ones exist) don't have to worry > about the distinction. > > As you can see, in project-buffers, for example, we call expand-file-name. OK, how about this? diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index ddb033d50f9..b365e195415 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -1575,7 +1575,10 @@ project-list-file (defvar project--list 'unset "List structure containing root directories of known projects. -With some possible metadata (to be decided).") +With some possible metadata (to be decided). + +Entries should be canonicalized with `expand-file-name' before +being added.") (defun project--read-project-list () "Initialize `project--list' using contents of `project-list-file'." @@ -1613,7 +1616,7 @@ project-remember-project Save the result in `project-list-file' if the list of projects has changed, and NO-WRITE is nil." (project--ensure-read-project-list) - (let ((dir (project-root pr))) + (let ((dir (expand-file-name (project-root pr)))) (unless (equal (caar project--list) dir) (dolist (ent project--list) (when (equal dir (car ent)) @@ -1629,7 +1632,7 @@ project--remove-from-project-list from the list using REPORT-MESSAGE, which is a format string passed to `message' as its first argument." (project--ensure-read-project-list) - (when-let ((ent (assoc project-root project--list))) + (when-let ((ent (assoc (expand-file-name project-root) project--list))) (setq project--list (delq ent project--list)) (message report-message project-root) (project--write-project-list))) From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 09 22:17:49 2023 Received: (at 64088) by debbugs.gnu.org; 10 Jul 2023 02:17:49 +0000 Received: from localhost ([127.0.0.1]:47334 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qIgTF-0003Mb-63 for submit@debbugs.gnu.org; Sun, 09 Jul 2023 22:17:49 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:54047) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qIgTD-0003MO-3X for 64088@debbugs.gnu.org; Sun, 09 Jul 2023 22:17:47 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 108155C00B5; Sun, 9 Jul 2023 22:17:42 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Sun, 09 Jul 2023 22:17:42 -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=fm1; t= 1688955462; x=1689041862; bh=dkH36xosLKsVi8+MQ9EQXwy9+U9ilk7k+Ol yHUH6hwI=; b=Wlty45ACKfeyiJliS+P6dYicVuBuT+XFWFkkDGYYx2hqUazJ0Nw k/zgZX/mTfNTVW+AqSFOjvrCzCjCnh26YmcppgqzxDQceblPUQCK9Oud9wkjbQDH fqnYlVD81k3hDsqA3kxay/eMEsoBNdrdQmZi0VV+9QO1lMKnPT6PzeDGps3TWXGa tyaJoOiNyqXCn8Zb8dDU8bwrXH9/YknWb9aOs2fEbnSXIF0hru5ZDLUh5jmLnWS5 NWO+tgGFOtnEOanFqha+eDqLOnqmbYxxgNyx0Qa89kO6NpBosVvJFVzqBIgZAHwA VOAH9yrwH9sFCERamuZHdpEZdSIF5LBnRGQ== 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= 1688955462; x=1689041862; bh=dkH36xosLKsVi8+MQ9EQXwy9+U9ilk7k+Ol yHUH6hwI=; b=MnUsbrdLTcS9WbWH3oY3pm7LUvt+hhGOMzAczW99sEEB0hNwciK jBhr5xcY2zG2xW4ykkQ8kIv7P/dukJFCTcFhtkV9PVoF+r9ccGx93lQmRrtvRZGc xuSujcOPr4Dk/K2he+tKY+jSb70daveE9FKzfkeC+vr+SrKylhACV8QXVEVHDt9J wqp7HFQboCGTld8todnKpgq2tSVBgWKxin9YCU39sKGCxSH9wrFjnjtk8Hd7pDT8 zAxX4nGllz3Q9iR3DqC/XKSjO+MKmVKhx7oQH80su6kp8JFF2fRvGV6EQ5EA1MTv DWqDfBGp46rxwljv5Un12NDwjFMokb32nnQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrvdeigdehkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefkffggfgfuvfevfhfhjggtgfesthejredttdefjeenucfhrhhomhepffhmihht rhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrdguvghvqeenucggtffrrghtth gvrhhnpeeigfetveehveevffehledtueekieeikeeufeegudfgfeeghfdulefgfeevledv veenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegumh hithhrhiesghhuthhovhdruggvvh X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 9 Jul 2023 22:17:40 -0400 (EDT) Message-ID: <2690528f-bfc8-d164-c522-cd2fcf2ba1ba@gutov.dev> Date: Mon, 10 Jul 2023 05:17:39 +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#64088: [PATCH] Make project-root for vc projects return an absolute path Content-Language: en-US To: Spencer Baugh References: <3c6078aa-4089-46fd-18bb-d92be101ca4f@gutov.dev> From: Dmitry Gutov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -1.8 (-) X-Debbugs-Envelope-To: 64088 Cc: 64088@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.8 (--) On 27/06/2023 23:01, Spencer Baugh wrote: > OK, how about this? Maybe we should go in the other direction? And call abbreviate-file-name on them? Because otherwise in project-prompt-project-dir we'll always show the expanded directory names, taking up extra space and usually repeating the full name of the user's home directory for no good reason. From debbugs-submit-bounces@debbugs.gnu.org Mon Jul 10 19:45:33 2023 Received: (at 64088) by debbugs.gnu.org; 10 Jul 2023 23:45:33 +0000 Received: from localhost ([127.0.0.1]:49404 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qJ0ZQ-0007Ei-UL for submit@debbugs.gnu.org; Mon, 10 Jul 2023 19:45:33 -0400 Received: from mxout5.mail.janestreet.com ([64.215.233.18]:58219) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qJ0ZP-0007ET-Cl for 64088@debbugs.gnu.org; Mon, 10 Jul 2023 19:45:31 -0400 From: Spencer Baugh To: Dmitry Gutov Subject: Re: bug#64088: [PATCH] Make project-root for vc projects return an absolute path In-Reply-To: <2690528f-bfc8-d164-c522-cd2fcf2ba1ba@gutov.dev> (Dmitry Gutov's message of "Mon, 10 Jul 2023 05:17:39 +0300") References: <3c6078aa-4089-46fd-18bb-d92be101ca4f@gutov.dev> <2690528f-bfc8-d164-c522-cd2fcf2ba1ba@gutov.dev> Date: Mon, 10 Jul 2023 19:45:25 -0400 Message-ID: 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: 64088 Cc: 64088@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Dmitry Gutov writes: > On 27/06/2023 23:01, Spencer Baugh wrote: >> OK, how about this? > > Maybe we should go in the other direction? And call > abbreviate-file-name on them? > > Because otherwise in project-prompt-project-dir we'll always show the > expanded directory names, taking up extra space and usually repeating > the full name of the user's home directory for no good reason. That seems reasonable if we let-bind directory-abbrev-alist to nil around it; otherwise we'll be dependent on the user's configuration and we might add a directory in one way, and then they add a new value to directory-abbrev-alist and we add it again a second way. Although maybe that's fine? And probably users of directory-abbrev-alist would like to have those abbreviations show up in project-prompt-project-dir. Also we could always call abbreviate-file-name at project-prompt-project-dir time. From debbugs-submit-bounces@debbugs.gnu.org Fri Aug 11 20:45:36 2023 Received: (at 64088) by debbugs.gnu.org; 12 Aug 2023 00:45:37 +0000 Received: from localhost ([127.0.0.1]:48293 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qUcl6-0006l9-Fv for submit@debbugs.gnu.org; Fri, 11 Aug 2023 20:45:36 -0400 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]:47087) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qUcl4-0006kw-TN for 64088@debbugs.gnu.org; Fri, 11 Aug 2023 20:45:35 -0400 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 412E13200906; Fri, 11 Aug 2023 20:45:29 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Fri, 11 Aug 2023 20:45:29 -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=fm2; t= 1691801128; x=1691887528; bh=9GMaiSPHn096ksyfd8LugSICoGKBmVI4HRh kTxqg6fg=; b=nyRHHDgIdVNFfIhdQodDTw1Ki2Sv+hlFmey8OFxfgjGPWx6vTGw zcfjlG6jKVOXLa1vCsdJD5AeRbhcRVqRTXPpykVwCoJSHyiSikZiNiL75x/7gk0o 0/SjThZxGZAzybMBV9eWhPDSRxO4ilAbXc+G+b9lwk7vlmgxwsRmy8GMvB9dGLg+ jkYw0feJauliZuAUWWcAn/7bIwSIWUt4xi7EmzE+X/l2Gn7kwOJ8yKZ/19PPU6/8 qWo8mfNzkIt9OzFA7a924Il6GXQwp/VJ7r0v4Akw2IVLsdOPyhteE62IAMumj1RY VV8KFGy7fcqu58J1adylp5lgJojh7A/Ssgg== 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=fm3; t= 1691801128; x=1691887528; bh=9GMaiSPHn096ksyfd8LugSICoGKBmVI4HRh kTxqg6fg=; b=Ik0su3JjtI1b0SeBttI91EdAwlMTc6aaJQb9VQM3MVyJHXZEA2g cQl0/GxUHHmq9HsmxnuLPtXCq+9mJ0jrl82+XGqjCO6eP+FcsXb67xRpvgLt9icT TuU2PG28dwiax3EiDTXPTSbHHFUj4x9FFsYbMHQ9B5AIMT5lYxGBl/fKn6nWt3+y 1orZoyaVuqkBR6tl3YdIHPYJIOIzQ3tph+BMeTdyjso29/fUMZle+f7j9CUpb64d qOq7ZpSVNNUAUL/1XaUIfTIgkrRdBy0KuzNgqtJ8e4/pZMn74SeECQf2WU+hC+Ir O4FIchnZAdmnQ5Rlj1LkPxghieknH9ifvZA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrleelgdefjecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefkffggfgfuvfevfhfhjggtgfesthejredttdefjeenucfhrhhomhepffhmihht rhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrdguvghvqeenucggtffrrghtth gvrhhnpeeigfetveehveevffehledtueekieeikeeufeegudfgfeeghfdulefgfeevledv veenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegumh hithhrhiesghhuthhovhdruggvvh X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 11 Aug 2023 20:45:27 -0400 (EDT) Message-ID: <16c053e0-cd4b-295d-2dae-e97bcf25f3b3@gutov.dev> Date: Sat, 12 Aug 2023 03:45:26 +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#64088: [PATCH] Make project-root for vc projects return an absolute path Content-Language: en-US To: Spencer Baugh References: <3c6078aa-4089-46fd-18bb-d92be101ca4f@gutov.dev> <2690528f-bfc8-d164-c522-cd2fcf2ba1ba@gutov.dev> From: Dmitry Gutov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.8 (/) X-Debbugs-Envelope-To: 64088 Cc: 64088@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.8 (-) On 11/07/2023 02:45, Spencer Baugh wrote: > Dmitry Gutov writes: >> On 27/06/2023 23:01, Spencer Baugh wrote: >>> OK, how about this? >> >> Maybe we should go in the other direction? And call >> abbreviate-file-name on them? >> >> Because otherwise in project-prompt-project-dir we'll always show the >> expanded directory names, taking up extra space and usually repeating >> the full name of the user's home directory for no good reason. > > That seems reasonable if we let-bind directory-abbrev-alist to nil > around it; otherwise we'll be dependent on the user's configuration and > we might add a directory in one way, and then they add a new value to > directory-abbrev-alist and we add it again a second way. That's also fair. > Although maybe that's fine? And probably users of > directory-abbrev-alist would like to have those abbreviations show up in > project-prompt-project-dir. They probably would. But indeed if the list was saved with one configuration, and read with another, it could lead to a mistake. > Also we could always call abbreviate-file-name at > project-prompt-project-dir time. Meaning it will be called N times (for the number of projects) every time the list is displayed, instead of just once, when the project is saved/visited. But maybe it's fine too? How slow could that be? It's probably not too significant problem either way, no matter which direction we choose. And we could revert later. What do you think? Feel free to submit a new patch (note that the one you submitted previously would need the abbreviate-file-name calls added to it, before the list is displayed). From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 19 08:31:20 2023 Received: (at 64088) by debbugs.gnu.org; 19 Aug 2023 12:31:20 +0000 Received: from localhost ([127.0.0.1]:49662 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXL6q-0005aI-Br for submit@debbugs.gnu.org; Sat, 19 Aug 2023 08:31:20 -0400 Received: from s.wrqvtbkv.outbound-mail.sendgrid.net ([149.72.123.24]:24546) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXL6k-0005Zv-8E for 64088@debbugs.gnu.org; Sat, 19 Aug 2023 08:31:14 -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: cc:content-type:from:subject:to; s=s1; bh=iDczrhMAxZbMOjAynzt2F1Uo1GWz6qMh9oelMxodlFk=; b=ovOIwuXXVqnghu9RFTLs4QIfjqvTlH5QqbLjCMZBYrdCQPqazVLCCu7KdnOr7WzLqeD0 DFFkvnIzsnP/jriKg8d89Xkdmlwvii6Ms4FaAG1iXHkxemajiFf+91akNeJyDKlmPFpZGr t6n+zQvRpX1h97L/RWJW9CyEKCzQU4wcWH/1Hb5gU6bRR2rPPtn7FdFTfhlZW9rTeReXuk 1T75jT4QJWTCuSxCO1v2nDPe/4mzWs4kStViV5olW47U1eubjTt/qaIfC6Zr1GyK4WmqY0 Me1Y6rNFEkywB8EpN+R+NxWO6Sq/5564cjXvVk5aVdr7I71QZ7w2Itu3F0m6zQQQ== Received: by filterdrecv-d7bbbc8bf-nzpnk with SMTP id filterdrecv-d7bbbc8bf-nzpnk-1-64E0B607-2B 2023-08-19 12:31:03.473763158 +0000 UTC m=+8686270.417954681 Received: from earth.catern.com (unknown) by geopod-ismtpd-canary-0 (SG) with ESMTP id NrmXQvPdQhW6JmU9qvcRYw Sat, 19 Aug 2023 12:31:03.384 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=::1; helo=localhost; envelope-from=sbaugh@catern.com; receiver=gutov.dev Received: from localhost (localhost [IPv6:::1]) by earth.catern.com (Postfix) with ESMTPSA id F3D526001E; Sat, 19 Aug 2023 08:31:02 -0400 (EDT) From: sbaugh@catern.com Subject: Re: bug#64088: [PATCH] Make project-root for vc projects return an absolute path In-Reply-To: <16c053e0-cd4b-295d-2dae-e97bcf25f3b3@gutov.dev> (Dmitry Gutov's message of "Sat, 12 Aug 2023 03:45:26 +0300") References: <3c6078aa-4089-46fd-18bb-d92be101ca4f@gutov.dev> <2690528f-bfc8-d164-c522-cd2fcf2ba1ba@gutov.dev> <16c053e0-cd4b-295d-2dae-e97bcf25f3b3@gutov.dev> Date: Sat, 19 Aug 2023 12:31:03 +0000 (UTC) Message-ID: <87ttsvgqnt.fsf@catern.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 X-SG-EID: =?us-ascii?Q?ZgbRq7gjGrt0q=2FPjvxk7wM0yQFRdOkTJAtEbkjCkHbLL5XPXsLI6mNQnuo3Ha4?= =?us-ascii?Q?hW+Iw=2F0RZxyhmiOX0k+1lf72g90WjWkmEnfcveY?= =?us-ascii?Q?6XYW0SH0usqaZy5zMOqHeJmO2P8PHPtHIKsv80C?= =?us-ascii?Q?9vRPAq4QCzbquhW7QQlxSOD=2F4SznPDMllDhgEpX?= =?us-ascii?Q?lTdWHaThibzKTgAtuwwSZLbpztu4u0vWKsg=3D=3D?= To: Dmitry Gutov X-Entity-ID: d/0VcHixlS0t7iB1YKCv4Q== Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 64088 Cc: Spencer Baugh , 64088@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Dmitry Gutov writes: > On 11/07/2023 02:45, Spencer Baugh wrote: >> Dmitry Gutov writes: >>> On 27/06/2023 23:01, Spencer Baugh wrote: >>>> OK, how about this? >>> >>> Maybe we should go in the other direction? And call >>> abbreviate-file-name on them? >>> >>> Because otherwise in project-prompt-project-dir we'll always show the >>> expanded directory names, taking up extra space and usually repeating >>> the full name of the user's home directory for no good reason. >> That seems reasonable if we let-bind directory-abbrev-alist to nil >> around it; otherwise we'll be dependent on the user's configuration and >> we might add a directory in one way, and then they add a new value to >> directory-abbrev-alist and we add it again a second way. > > That's also fair. > >> Although maybe that's fine? And probably users of >> directory-abbrev-alist would like to have those abbreviations show up in >> project-prompt-project-dir. > > They probably would. But indeed if the list was saved with one > configuration, and read with another, it could lead to a mistake. > >> Also we could always call abbreviate-file-name at >> project-prompt-project-dir time. > > Meaning it will be called N times (for the number of projects) every > time the list is displayed, instead of just once, when the project is > saved/visited. But maybe it's fine too? How slow could that be? I was sad about this but I think I've got the solution now: We just maintain project--list in abbreviated form and project-list-file in expanded form. I think that solves all the problems: the persistent file is independent of user configuration, so if the user changes their abbreviations they'll get new ones the next time the file is read (presumably the next time they run Emacs). But project--list is abbreviated, so project-prompt-project-dir gets abbreviated dirs. It does mean that if they change their directory-abbrev-alist while Emacs is running they could get duplicate entries, but that already could happen before this patch, and it's not a big problem IMO. See patch below. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Expand-project-file-names-before-storing-them.patch >From 193a105b40b3a002f51e1f59dd2a3d48443e11fe Mon Sep 17 00:00:00 2001 From: Spencer Baugh Date: Sat, 19 Aug 2023 08:24:45 -0400 Subject: [PATCH] Expand project file names before storing them Before, whatever project-root returned, we stored as the root directory of the project in project-list and project-list-file. This could lead to duplicate entries or bad behavior if projects were accessed by different file names, e.g. both /home/user/src/emacs and ~/src/emacs. Now project-list-file contains only expanded paths and project--list contains only abbreviated paths. We abbreviate filenames before setting project--list, and expand filenames before writing to project-list-file. * lisp/progmodes/project.el (project--write-project-list): Call expand-file-name. (project--read-project-list, project-remember-project) (project--remove-from-project-list): Call abbreviate-file-name. --- lisp/progmodes/project.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 11fa93fb70d..e99a9061275 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -1586,7 +1586,7 @@ project--read-project-list (when (file-exists-p filename) (with-temp-buffer (insert-file-contents filename) - (read (current-buffer))))) + (mapcar #'abbreviate-file-name (read (current-buffer)))))) (unless (seq-every-p (lambda (elt) (stringp (car-safe elt))) project--list) @@ -1606,7 +1606,7 @@ project--write-project-list (insert ";;; -*- lisp-data -*-\n") (let ((print-length nil) (print-level nil)) - (pp project--list (current-buffer))) + (pp (mapcar #'expand-file-name project--list) (current-buffer))) (write-region nil nil filename nil 'silent)))) ;;;###autoload @@ -1615,7 +1615,7 @@ project-remember-project Save the result in `project-list-file' if the list of projects has changed, and NO-WRITE is nil." (project--ensure-read-project-list) - (let ((dir (project-root pr))) + (let ((dir (abbreviate-file-name (project-root pr)))) (unless (equal (caar project--list) dir) (dolist (ent project--list) (when (equal dir (car ent)) @@ -1631,7 +1631,7 @@ project--remove-from-project-list from the list using REPORT-MESSAGE, which is a format string passed to `message' as its first argument." (project--ensure-read-project-list) - (when-let ((ent (assoc project-root project--list))) + (when-let ((ent (assoc (abbreviate-file-name project-root) project--list))) (setq project--list (delq ent project--list)) (message report-message project-root) (project--write-project-list))) -- 2.41.0 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 19 08:57:34 2023 Received: (at 64088) by debbugs.gnu.org; 19 Aug 2023 12:57:34 +0000 Received: from localhost ([127.0.0.1]:49686 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXLWH-0006HY-MH for submit@debbugs.gnu.org; Sat, 19 Aug 2023 08:57:34 -0400 Received: from s.wrqvwxzv.outbound-mail.sendgrid.net ([149.72.154.232]:2656) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXLWA-0006HC-Mp for 64088@debbugs.gnu.org; Sat, 19 Aug 2023 08:57:32 -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: cc:content-type:from:subject:to; s=s1; bh=xqkjo/qb2GECda5DxVnG0vnQH4VjPI1GEGbmakv2Qz4=; b=d1tRK87h1iztF8mqx0GEg1axcHyQf61DvvfFEyrpqtZKLH4Wgz7NYGjAAOejtU75qGmV mP3u4BQ0elMq6sgZWXdj7UPVaPIMwyQUDqb5Zbt0jrron05lZZDc6+KG2cyMh8xOjGc1hd FEZjy1CmSwKwJeqfKZJmvvN1lMbx5hRNlrZyxDfzeQdCzVV8StQlx6IX7ALbqL+REsC5VV EBlDKJnWpzrWyl8+cqthLIdDLxqkl3s2EsDdeV+y0Dh8I6lpnBoDmwQPrT6eW1n6F6hIsG 78bOjj6TdDYeUnK2GuCe7Z5oQ4GrPpFVuHEKJri4/EiGwOsE6V3mKgyvGDWrHgjw== Received: by filterdrecv-8684c58db7-zm958 with SMTP id filterdrecv-8684c58db7-zm958-1-64E0BC2E-1C 2023-08-19 12:57:18.950200136 +0000 UTC m=+8687913.317366625 Received: from earth.catern.com (unknown) by geopod-ismtpd-10 (SG) with ESMTP id bnJQXv3vTDCfpspgR34HWQ Sat, 19 Aug 2023 12:57:18.693 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=::1; helo=localhost; envelope-from=sbaugh@catern.com; receiver=gutov.dev Received: from localhost (localhost [IPv6:::1]) by earth.catern.com (Postfix) with ESMTPSA id 35A496001E; Sat, 19 Aug 2023 08:57:18 -0400 (EDT) From: sbaugh@catern.com Subject: Re: bug#64088: [PATCH] Make project-root for vc projects return an absolute path In-Reply-To: <87ttsvgqnt.fsf@catern.com> (sbaugh@catern.com's message of "Sat, 19 Aug 2023 12:31:03 +0000 (UTC)") References: <3c6078aa-4089-46fd-18bb-d92be101ca4f@gutov.dev> <2690528f-bfc8-d164-c522-cd2fcf2ba1ba@gutov.dev> <16c053e0-cd4b-295d-2dae-e97bcf25f3b3@gutov.dev> <87ttsvgqnt.fsf@catern.com> Date: Sat, 19 Aug 2023 12:57:19 +0000 (UTC) Message-ID: <87lee7gpg1.fsf@catern.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 X-SG-EID: =?us-ascii?Q?ZgbRq7gjGrt0q=2FPjvxk7wM0yQFRdOkTJAtEbkjCkHbIC9Pqd89V61obby29Cni?= =?us-ascii?Q?UrpxaUmZbv4JaWPOxTIIkcIC8jCGM9X5bpEUOgx?= =?us-ascii?Q?ceVzpktxVoD4lgtpie+rnF23khReJyfVXaAd8Ti?= =?us-ascii?Q?ruj2BCpJjQNnXgDTwfU9wriCt=2FbVPjnZvVcrqzZ?= =?us-ascii?Q?+P6HZ86jqnWGTuPF6aXU1urynbxJyIl9fYg=3D=3D?= To: Dmitry Gutov X-Entity-ID: d/0VcHixlS0t7iB1YKCv4Q== Content-Type: multipart/mixed; boundary="=-=-=" 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: sbaugh@catern.com writes: > Dmitry Gutov writes: >> On 11/07/2023 02:45, Spencer Baugh wrote: >>> Dmitry Gutov writes: >>>> On 27/06/2023 23:01, Spencer Baugh wro [...] 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 ] -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 X-Debbugs-Envelope-To: 64088 Cc: Spencer Baugh , 64088@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.2 (/) --=-=-= Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit sbaugh@catern.com writes: > Dmitry Gutov writes: >> On 11/07/2023 02:45, Spencer Baugh wrote: >>> Dmitry Gutov writes: >>>> On 27/06/2023 23:01, Spencer Baugh wrote: >>>>> OK, how about this? >>>> >>>> Maybe we should go in the other direction? And call >>>> abbreviate-file-name on them? >>>> >>>> Because otherwise in project-prompt-project-dir we'll always show the >>>> expanded directory names, taking up extra space and usually repeating >>>> the full name of the user's home directory for no good reason. >>> That seems reasonable if we let-bind directory-abbrev-alist to nil >>> around it; otherwise we'll be dependent on the user's configuration and >>> we might add a directory in one way, and then they add a new value to >>> directory-abbrev-alist and we add it again a second way. >> >> That's also fair. >> >>> Although maybe that's fine? And probably users of >>> directory-abbrev-alist would like to have those abbreviations show up in >>> project-prompt-project-dir. >> >> They probably would. But indeed if the list was saved with one >> configuration, and read with another, it could lead to a mistake. >> >>> Also we could always call abbreviate-file-name at >>> project-prompt-project-dir time. >> >> Meaning it will be called N times (for the number of projects) every >> time the list is displayed, instead of just once, when the project is >> saved/visited. But maybe it's fine too? How slow could that be? > > I was sad about this but I think I've got the solution now: We just > maintain project--list in abbreviated form and project-list-file in > expanded form. > > I think that solves all the problems: the persistent file is independent > of user configuration, so if the user changes their abbreviations > they'll get new ones the next time the file is read (presumably the next > time they run Emacs). But project--list is abbreviated, so > project-prompt-project-dir gets abbreviated dirs. > > It does mean that if they change their directory-abbrev-alist while > Emacs is running they could get duplicate entries, but that already > could happen before this patch, and it's not a big problem IMO. > > See patch below. Oops, this patch needed a few tweaks. Especially, skipping the expansion and abbreviation for remote files, to avoid making unnecesary remote connections. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Expand-project-file-names-before-storing-them.patch >From 9523b4dea1234083e65b141a281c1108f52b046b Mon Sep 17 00:00:00 2001 From: Spencer Baugh Date: Sat, 19 Aug 2023 08:24:45 -0400 Subject: [PATCH] Expand project file names before storing them Before, whatever project-root returned, we stored as the root directory of the project in project-list and project-list-file. This could lead to duplicate entries or bad behavior if projects were accessed by different file names, e.g. both /home/user/src/emacs and ~/src/emacs. Now project-list-file contains only expanded paths and project--list contains only abbreviated paths. We abbreviate filenames before setting project--list, and expand filenames before writing to project-list-file. We only do this for local files, though, to avoid making remote connections; the situation will still be bad for remote projects, but at least this is an improvement. * lisp/progmodes/project.el (project--write-project-list): Call expand-file-name. (project--read-project-list, project-remember-project) (project--remove-from-project-list): Call abbreviate-file-name. --- lisp/progmodes/project.el | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 11fa93fb70d..21d5df8f0cc 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -1586,7 +1586,12 @@ project--read-project-list (when (file-exists-p filename) (with-temp-buffer (insert-file-contents filename) - (read (current-buffer))))) + (mapcar + (lambda (elem) + (let ((name (car elem))) + (list (if (file-remote-p name) name + (abbreviate-file-name name))))) + (read (current-buffer)))))) (unless (seq-every-p (lambda (elt) (stringp (car-safe elt))) project--list) @@ -1606,7 +1611,12 @@ project--write-project-list (insert ";;; -*- lisp-data -*-\n") (let ((print-length nil) (print-level nil)) - (pp project--list (current-buffer))) + (pp (mapcar (lambda (elem) + (let ((name (car elem))) + (list (if (file-remote-p name) name + (expand-file-name name))))) + project--list) + (current-buffer))) (write-region nil nil filename nil 'silent)))) ;;;###autoload @@ -1615,7 +1625,7 @@ project-remember-project Save the result in `project-list-file' if the list of projects has changed, and NO-WRITE is nil." (project--ensure-read-project-list) - (let ((dir (project-root pr))) + (let ((dir (abbreviate-file-name (project-root pr)))) (unless (equal (caar project--list) dir) (dolist (ent project--list) (when (equal dir (car ent)) @@ -1631,7 +1641,7 @@ project--remove-from-project-list from the list using REPORT-MESSAGE, which is a format string passed to `message' as its first argument." (project--ensure-read-project-list) - (when-let ((ent (assoc project-root project--list))) + (when-let ((ent (assoc (abbreviate-file-name project-root) project--list))) (setq project--list (delq ent project--list)) (message report-message project-root) (project--write-project-list))) -- 2.41.0 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 22 20:24:18 2023 Received: (at 64088-done) by debbugs.gnu.org; 23 Aug 2023 00:24:18 +0000 Received: from localhost ([127.0.0.1]:60640 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qYbfW-000867-3W for submit@debbugs.gnu.org; Tue, 22 Aug 2023 20:24:18 -0400 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:33583) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qYbfT-00085t-Ev for 64088-done@debbugs.gnu.org; Tue, 22 Aug 2023 20:24:16 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id DAE125C023B; Tue, 22 Aug 2023 20:24:06 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Tue, 22 Aug 2023 20:24: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= 1692750246; x=1692836646; bh=jlsGtJJkA1vyOp+6ox/PKHYwVh/TMIHrLOW SiKpyut0=; b=D9e3WLTjdo6uaPFLjk3sRr7/NeOVUq1bhzK2AnDQsqtStDY2VYY sYD7SKwmte6uLDoaCkLjudHIjzp56I07d4PhV5Cp9ytfJggqid9jtGMSJeZZXxSp crWeBNC5Qp0c5Vrko3QVgkKJv3f+wRLt9q3hIu2c6/LDB97ElsgOGlIbCM4d4VFw 6uWkd2OV145blnJII58ywMG6liWcj7U/ntAYsS2xVS9INrpn6gKDIlEMZgXVAkQo 08Ls5u7WgbDaDJGFUwcCE/p7pOviaWNx4xv73UOq1IM6nvug+id73hfUn7rZ+USi 2icUDlSswZH7tNtjsE8knYUeAjQkod6/M6w== 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= 1692750246; x=1692836646; bh=jlsGtJJkA1vyOp+6ox/PKHYwVh/TMIHrLOW SiKpyut0=; b=r43RCfXzz3VxY+eSQIp+/Vz7KiLhe5vUNjW2Gfg/c8OD2ZH7bbw SAATctBiOP1mpu5GGYPPCPJRg2CE0Uu6jlE8sPOg3LOQsoj92vealdoE6mhPcMqg i01jbBI3M6dafpbxUGObp61L5YLkkktYgs8NOJxNPWAxUXs+qwQ4UTBIxzw6j/tN tlmhX4Bozj/BjBvQp0JE4XHiElpa6XOyO+qxNn7gR05lU+WTJ4EEHreyQqJXsTNN axfW6ECeWa5td6K5RPtfzpU3kIvU1LO2zHYM5CpCG4VlWwmd4xQxwnbm0dZ09Dib 5Ivw+MBPb8elL95PttmjHK4x5E9aVUSHP+Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedruddvvddgfeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth htvghrnhepiefgteevheevveffheeltdeukeeiieekueefgedugfefgefhudelgfefveel vdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug hmihhtrhihsehguhhtohhvrdguvghv X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 22 Aug 2023 20:24:05 -0400 (EDT) Message-ID: <3d4d2e2c-0ed1-6998-694d-dcc08b2ec837@gutov.dev> Date: Wed, 23 Aug 2023 03:24: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#64088: [PATCH] Make project-root for vc projects return an absolute path Content-Language: en-US To: sbaugh@catern.com References: <3c6078aa-4089-46fd-18bb-d92be101ca4f@gutov.dev> <2690528f-bfc8-d164-c522-cd2fcf2ba1ba@gutov.dev> <16c053e0-cd4b-295d-2dae-e97bcf25f3b3@gutov.dev> <87ttsvgqnt.fsf@catern.com> <87lee7gpg1.fsf@catern.com> From: Dmitry Gutov In-Reply-To: <87lee7gpg1.fsf@catern.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -1.7 (-) X-Debbugs-Envelope-To: 64088-done Cc: Spencer Baugh , 64088-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.7 (--) On 19/08/2023 15:57, sbaugh@catern.com wrote: >>> Meaning it will be called N times (for the number of projects) every >>> time the list is displayed, instead of just once, when the project is >>> saved/visited. But maybe it's fine too? How slow could that be? >> I was sad about this but I think I've got the solution now: We just >> maintain project--list in abbreviated form and project-list-file in >> expanded form. Here's something else I thought of: project--write-project-list is called every time a different project is returned by (project-current t) -- i.e. when MAYBE-PROMPT=t, and when the found dir is not at the top of the project history already. So under certain conditions (slow CPU/spinning media/long project history) it might slow down (project-current t) calls. In my testing it's totally fine, though, and there are possible mitigations (limit the history and/or move saving to kill-hook). Just something to keep in mind. >> I think that solves all the problems: the persistent file is independent >> of user configuration, so if the user changes their abbreviations >> they'll get new ones the next time the file is read (presumably the next >> time they run Emacs). But project--list is abbreviated, so >> project-prompt-project-dir gets abbreviated dirs. >> >> It does mean that if they change their directory-abbrev-alist while >> Emacs is running they could get duplicate entries, but that already >> could happen before this patch, and it's not a big problem IMO. >> >> See patch below. > Oops, this patch needed a few tweaks. Especially, skipping the > expansion and abbreviation for remote files, to avoid making unnecesary > remote connections. Thanks! Pushed to master, and finally closing ;-) From unknown Sat Aug 16 21:22:33 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 20 Sep 2023 11:24:12 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator