From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#63829: 29.0.90; project-find-file's future history breaks with common-parent-directory Date: Sun, 04 Jun 2023 19:36:25 +0300 Organization: LINKOV.NET Message-ID: <86h6rnw7gm.fsf@mail.linkov.net> References: <16b64d95-35e9-ef94-2c54-17b670111f0f@gutov.dev> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20520"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) Cc: Dmitry Gutov , 63829@debbugs.gnu.org To: Spencer Baugh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jun 04 19:02:43 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 1q5r7r-00059E-27 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 04 Jun 2023 19:02:43 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q5r7J-00076H-Kz; Sun, 04 Jun 2023 13:02:09 -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 1q5r7D-00075X-V1 for bug-gnu-emacs@gnu.org; Sun, 04 Jun 2023 13:02:03 -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 1q5r7C-0007r0-NS for bug-gnu-emacs@gnu.org; Sun, 04 Jun 2023 13:02:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q5r7C-0007vw-EN for bug-gnu-emacs@gnu.org; Sun, 04 Jun 2023 13:02:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 04 Jun 2023 17:02: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.168589810330464 (code B ref 63829); Sun, 04 Jun 2023 17:02:02 +0000 Original-Received: (at 63829) by debbugs.gnu.org; 4 Jun 2023 17:01:43 +0000 Original-Received: from localhost ([127.0.0.1]:47047 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q5r6t-0007vH-DP for submit@debbugs.gnu.org; Sun, 04 Jun 2023 13:01:43 -0400 Original-Received: from relay5-d.mail.gandi.net ([217.70.183.197]:42815) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q5r6s-0007us-4j for 63829@debbugs.gnu.org; Sun, 04 Jun 2023 13:01:42 -0400 X-GND-Sasl: juri@linkov.net X-GND-Sasl: juri@linkov.net X-GND-Sasl: juri@linkov.net Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id F3E3F1C0003; Sun, 4 Jun 2023 17:01:34 +0000 (UTC) In-Reply-To: (Spencer Baugh's message of "Sat, 03 Jun 2023 07:00:56 -0400") 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:262979 Archived-At: > On top of your patch, I can implement the feature I mentioned with the > patch at the end. This causes the following nice behavior: > > 1. Open ~/src/emacs/emacs-29/lisp/progmodes/project.el > 2. C-x p p ~/src/emacs/trunk > 3. f > 4. M-n and the minibuffer contains "lisp/progmodes/project.el" > 5. RET and we have now easily switched to the same file in another > project > > Does the implementation seem OK? > > diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el > index ac7be8dcbb2..b1e01df5314 100644 > --- a/lisp/progmodes/project.el > +++ b/lisp/progmodes/project.el > @@ -1008,7 +1008,12 @@ project-find-file > (dirs (list root))) > (project-find-file-in > (or (thing-at-point 'filename) > - buffer-file-name) > + (and buffer-file-name > + (if-let (buffer-proj (and project-current-directory-override > + (project-current nil default-directory))) But we are going to remove project-current-directory-override in bug#63648 where default-directory will be changed to next-default-directory. BTW, I asked about this before in https://debbugs.gnu.org/58447#127 and then it was deemed to be not too general to handle, so I backed it out in https://debbugs.gnu.org/58447#160 with such conclusion: OTOH, `C-x p f M-p' in another project is not my primary workflow. But if someone wants to keep a plain history, this could be added later in master, e.g. by a new value of project-read-file-name-function and a function that is mostly a copy of project--read-file-cpd-relative. So maybe this could be implemented in master now?