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#63829: 29.0.90; project-find-file's future history breaks with common-parent-directory Date: Sat, 3 Jun 2023 15:19:55 +0300 Message-ID: <2790cb95-cfc8-40ee-2a89-d9effe2c2060@gutov.dev> References: <83r0qubbtk.fsf@gnu.org> 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="10700"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Cc: 63829@debbugs.gnu.org To: Eli Zaretskii , Spencer Baugh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jun 03 14:21:22 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 1q5QG1-0002Xu-Lh for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 03 Jun 2023 14:21:22 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q5QFk-0002QV-Mp; Sat, 03 Jun 2023 08:21:04 -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 1q5QFi-0002QN-P8 for bug-gnu-emacs@gnu.org; Sat, 03 Jun 2023 08:21:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q5QFi-000597-Fl for bug-gnu-emacs@gnu.org; Sat, 03 Jun 2023 08:21:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q5QFi-0000T4-6F for bug-gnu-emacs@gnu.org; Sat, 03 Jun 2023 08:21: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: Sat, 03 Jun 2023 12:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63829 X-GNU-PR-Package: emacs Original-Received: via spool by 63829-submit@debbugs.gnu.org id=B63829.16857948071706 (code B ref 63829); Sat, 03 Jun 2023 12:21:02 +0000 Original-Received: (at 63829) by debbugs.gnu.org; 3 Jun 2023 12:20:07 +0000 Original-Received: from localhost ([127.0.0.1]:41764 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q5QEp-0000RR-8O for submit@debbugs.gnu.org; Sat, 03 Jun 2023 08:20:07 -0400 Original-Received: from out4-smtp.messagingengine.com ([66.111.4.28]:40989) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q5QEl-0000Qe-JY for 63829@debbugs.gnu.org; Sat, 03 Jun 2023 08:20:05 -0400 Original-Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 811975C00A1; Sat, 3 Jun 2023 08:19:58 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Sat, 03 Jun 2023 08:19:58 -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= 1685794798; x=1685881198; bh=Or7iHHOhYe1m8bLhGW9NfB1J3Vk8VNL+RzV UR9/d154=; b=YD864CT7Eor8mSkYBEzIiOHv2rxzqJGOwxSGdoAYC923q+rdkeg GqPeNSkrAjSH462JE03WFoU1u2tXgGjsAszhZHrGSGtW6/2c3PRU/yfsvZH4hC5j 92vrVI9Sv0IUGI32AmNfGaolExKFhlJga/xJhbFUx/lA4QNbnm0d9h57q88pBv4C teNjvIiOcurnPkFbM5ex0D+y14MzoiEqvesPcwpf0bZPfw1F5ScEJAj2Hjs2LvlY AQHohhlIfws8mGeDVw7itq+WOGBmzY5hZwmO+aTHF9D3t0fhmX+STTozqfJ0d9ch 11GU5AOb5/2KaQx4ty2tUqJWuekPhnNoFcw== 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= 1685794798; x=1685881198; bh=Or7iHHOhYe1m8bLhGW9NfB1J3Vk8VNL+RzV UR9/d154=; b=FxIQrs1TLoM3vVwZejOpvscz8U2bN2e+30pEqXpiVbpqEGboi36 tll6nsvAENLuxyeFHB2liNsa5at82npoS+Qrz+xakXs+5h24WJT8/F8KbTJt53lM IvIfyLEo0PzA7NvJOrk/qDRiUaNjC4KSKcKDdiaUwXNnDjh4+1sW4Oj3A0n9VUVd rCvktN6jPy2h9g8/j8+HvlWmnGB7RMtPYvmOV4PCP5N2mhVz5V4+VSFvFl5UFKsy jq9CfxxZ3Dc2PkOYi1uoOZCqwW5ExLYzLTyl2DsP93pvb+xZpeGf3zpyhWrkXIYM XosoFzlJSXYUDO+70N3et5Z63PZcYUHTeEw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeelhedgheduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth htvghrnhepiefgteevheevveffheeltdeukeeiieekueefgedugfefgefhudelgfefveel vdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug hmihhtrhihsehguhhtohhvrdguvghv X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 3 Jun 2023 08:19:56 -0400 (EDT) Content-Language: en-US In-Reply-To: <83r0qubbtk.fsf@gnu.org> 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:262827 Archived-At: Hi Eli, On 02/06/2023 09:47, Eli Zaretskii wrote: >> From: Spencer Baugh >> Date: Thu, 01 Jun 2023 18:32:29 -0400 >> >> 1. emacs -Q >> 2. Open a project where project-files only returns files in a certain >> subdirectory. For example, a git repo /repo where the only file is >> "dir/file.txt". >> 3. Open dir/file.txt >> 4. C-x p f ;; project-find file >> 5. Observe that the prompt is "Find file in /repo/dir: " which correctly >> contains the common parent directory between all the paths returned by >> project-files. >> 6. M-n ;; next-history-element >> 7. The minibuffer now contains "dir/file.txt". RET will fail to >> open the file. >> >> Instead, the common parent directory should be stripped from the "future >> history" element. > > From my POV, this is a clear sign of too many kludges which override > the usual Emacs conventions of what is default-directory. Stripping > the parent directory is IMO not the right solution; instead, the > default-directory of the command should be set so that what you want > happens automatically. If you go the way of patching up the code > instead of fixing this fundamental problem, there will be no end to > patching up. TBH, I'm not sure which particular change you were proposing. Do you like the patch I posted? It could be considered somewhere in that direction. Should it go to emacs-29 or master? >> (As a separate point: I ran into this while adding a feature for >> switching between projects with similar directory structures. I want to >> include the relative path in the starting project in the "future >> history", so that when you have a file in projectA open, you can switch >> to the same file in projectB with C-x p p f M-n RET. For example, >> switching between the same file in multiple clones of Emacs. But sadly >> the future history doesn't work properly right now even in a single >> project) > > Once again, this should work by using the right value of > default-directory; having relative filenames in the history up front > is not TRT. Relative file names in Emacs are always interpreted > relatively to default-directory, so if you start using relative names > disregarding default-directory, you will eventually run into trouble, > as various file-related primitives will fail with ENOENT. The problem here is that is a different/new scenario where Spencer wants to have a file name from one project be applied to another project. It seems like using absolute names would rather go in the opposite direction. > If the default-directory can be different for some elements of > history, perhaps each element should have the default-directory > metadata with it, e.g., as a property. Or maybe the history should > hold absolute file names, and M-n etc. should convert it to relative > as appropriate. The latter is mostly what happens.