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, 19 Aug 2023 05:08:38 +0300 Message-ID: <208300a3-25e1-d057-11ac-179e52b8f547@gutov.dev> References: <16b64d95-35e9-ef94-2c54-17b670111f0f@gutov.dev> <86h6rnw7gm.fsf@mail.linkov.net> <3e404df1-b3a9-f9e3-4270-f42df8b704c7@gutov.dev> <87a5uti6mo.fsf@catern.com> <73a695f3-7c6a-0e50-41dd-61f8269f6ecf@gutov.dev> <875y5fitiq.fsf@catern.com> 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="12319"; 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: sbaugh@catern.com, 63829@debbugs.gnu.org, Juri Linkov To: Spencer Baugh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Aug 19 04:09:18 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 1qXBOv-00030c-Fi for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 19 Aug 2023 04:09:18 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qXBOg-0000Nq-VK; Fri, 18 Aug 2023 22:09:02 -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 1qXBOf-0000Nd-JJ for bug-gnu-emacs@gnu.org; Fri, 18 Aug 2023 22:09:01 -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 1qXBOf-0004nG-B3 for bug-gnu-emacs@gnu.org; Fri, 18 Aug 2023 22:09:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qXBOf-00029E-Q8 for bug-gnu-emacs@gnu.org; Fri, 18 Aug 2023 22:09: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: Sat, 19 Aug 2023 02:09:01 +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.16924109338235 (code B ref 63829); Sat, 19 Aug 2023 02:09:01 +0000 Original-Received: (at 63829) by debbugs.gnu.org; 19 Aug 2023 02:08:53 +0000 Original-Received: from localhost ([127.0.0.1]:49106 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXBOW-00028k-Ji for submit@debbugs.gnu.org; Fri, 18 Aug 2023 22:08:52 -0400 Original-Received: from wout5-smtp.messagingengine.com ([64.147.123.21]:47521) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXBOU-00028Q-48 for 63829@debbugs.gnu.org; Fri, 18 Aug 2023 22:08:51 -0400 Original-Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id E6FF23200916; Fri, 18 Aug 2023 22:08:42 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Fri, 18 Aug 2023 22:08:43 -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= 1692410922; x=1692497322; bh=4jdVoRqY9788gBM82ykNVNG60FRxXdGu5QY wBnjbTMU=; b=DRzDIM5/hHE06Ip1fIQApTMuxnzD2sOjTQ0F5DS2GW6k7i12Dz5 QbCvReeB2HqU2j9FL2r2c2/eEUk18PPWFN9MEncCYdGxRXozTXLTkS1Q87HkxYoO zzZy8/9qrNoXIWHXvon/INM/N7+EawV2Ol64XBSST7wDGTX7nJJHnHPo/zEL2+v9 haWxGNmma6iDf9YNhVXdmVmae8DuBnnwiaEXjG5W7AdWlOWuk9emJ6VpFO7aBnY0 qJ2KyOZNhhZ82+x57259m3yRxDtfnVUJna7dL+JoInaQKvWyPHZhMDVQJ1LKN2Pu cg7Ehuq+0EL0Iq7TmnnIuMkAys7YN6dnZ6w== 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= 1692410922; x=1692497322; bh=4jdVoRqY9788gBM82ykNVNG60FRxXdGu5QY wBnjbTMU=; b=d7ngn2BOzQtGRueJgwdb/02mPGo8vbrMxxetiJzL/ILhXfSnivV 4DFeMSwHdnWqnGlA0k612n6m2lfXfiRPQsBTedU6JQ3HusqUMTFqE8MxjQfNdCxd bm2T8dUGqw+pGeufwHd3OtxaLq6xZf2Gi/pMt2UYoadjcR4O32wGtUo+cxfHTbdp JVqwYZMkpBfUuA8YuNWBYSPuuxG2c8x69OGWLNe+pB/EerdD/XeYJ5gr8WOsAIaB nhwRYGESAz4uCtpuM6+q02gxYnHWihUXLB6wnHV9rc/w5X1kqwVP4/iYGnxbmsmK g3WMdW9OELKPX0oZQMUccm6PcHixJE35b0A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedruddugedghedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth htvghrnhepiefgteevheevveffheeltdeukeeiieekueefgedugfefgefhudelgfefveel vdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug hmihhtrhihsehguhhtohhvrdguvghv X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 18 Aug 2023 22:08:40 -0400 (EDT) Content-Language: en-US In-Reply-To: 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:267804 Archived-At: On 17/08/2023 22:41, Spencer Baugh wrote: > Dmitry Gutov writes: >> - (file (funcall project-read-file-name-function >> - "Find file" all-files nil 'file-name-history >> - suggested-filename))) >> + (file >> + (let ((file-name-history (mapcar >> + (lambda (f) >> + (or (project--expand-file-name >> f project) f)) >> + file-name-history))) >> + (funcall project-read-file-name-function >> + "Find file" all-files nil 'file-name-history >> + suggested-filename)))) >> + (when history-add-new-input >> + ;; Have to re-add it here because of the let-binding above. >> + (add-to-history 'file-name-history >> + (propertize file 'project (project-root project)))) >> (if (string= file "") >> (user-error "You didn't specify the file") >> (find-file file)))) > > This seems good, sure. But doesn't this make the history entries appear > twice? It doesn't, since whatever modification to file-name-history is done inside project-read-file-name-function is erased when the surrounding 'let' form (pre-altering its value) returns. > Maybe we should just pull the history-adding functionality out of > project-read-file-name-function entirely. I've tried doing that below. Just for project-find-dir, right? That makes sense. > Also, I realized just now that this should probably affect > project-find-dir as well, as should my previous patch adding > project-relative future history. (I actually coincidentally just now > got a user request for "switch between projects and stay in the same > dir") ^^ > So here's a revised version of this history change which also affects > project-find-dir. In a subsequent mail I'll send a patch for the > "future history" behavior of project-find-dir too. (yet to be written) That ones looks good too (I'll go over the cosmetics a little later). Regarding project-file-name-history-relativize, I wanted to ask about a shorter name, but... it seems like there aren't many to be had. Also originally I wanted to just enable the feature and then see what actual modifications people will want. Perhaps some will ask for find-file and project-find-file histories to be totally separate instead? Or maybe not.