GNU bug report logs - #72611
[Patch] Store canonical paths to project roots

Previous Next

Package: emacs;

Reported by: Brad Howes <bradhowes <at> mac.com>

Date: Wed, 14 Aug 2024 02:21:02 UTC

Severity: normal

Tags: patch

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 72611 in the body.
You can then email your comments to 72611 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#72611; Package emacs. (Wed, 14 Aug 2024 02:21:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Brad Howes <bradhowes <at> mac.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 14 Aug 2024 02:21:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Brad Howes <bradhowes <at> mac.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [Patch] Store canonical paths to project roots
Date: Tue, 13 Aug 2024 21:56:38 +0200
[Message part 1 (text/plain, inline)]
Tags: patch

Adapt 'project-roots' to always return a canonical path
in order to eliminate aliased values in the saved project
paths file.

In GNU Emacs 29.4 (build 2, aarch64-apple-darwin24.0.0, NS
 appkit-2559.10 Version 15.0 (Build 24A5298h)) of 2024-07-27 built on
 brh-pro-1.home
Windowing system distributor 'Apple', version 10.3.2566
System Description:  macOS 15.0

Configured using:
 'configure --disable-dependency-tracking --disable-silent-rules
 --enable-locallisppath=/opt/homebrew/share/emacs/site-lisp
 --infodir=/opt/homebrew/Cellar/emacs-plus <at> 29/29.4/share/info/emacs
 --prefix=/opt/homebrew/Cellar/emacs-plus <at> 29/29.4 --with-xml2
 --with-gnutls --with-native-compilation --without-compress-install
 --without-dbus --without-imagemagick --with-modules --with-rsvg
 --with-ns --disable-ns-self-contained 'CFLAGS=-Os -w -pipe
 -mmacosx-version-min=15
 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk -O2
 -DFD_SETSIZE=10000 -DDARWIN_UNLIMITED_SELECT'
 'CPPFLAGS=-I/opt/homebrew/opt/zlib/include
 -I/opt/homebrew/opt/jpeg/include -I/opt/homebrew/opt/icu4c/include
 -I/opt/homebrew/opt/sqlite/include -I/opt/homebrew/opt/readline/include
 -isystem/opt/homebrew/include -F/opt/homebrew/Frameworks
 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk'
 'LDFLAGS=-L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/jpeg/lib
 -L/opt/homebrew/opt/icu4c/lib -L/opt/homebrew/opt/sqlite/lib
 -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/lib
 -F/opt/homebrew/Frameworks -Wl,-headerpad_max_install_names
 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk
 -L/opt/homebrew/opt/libgccjit/lib''

[0001-Always-return-canonical-paths.patch (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72611; Package emacs. (Sat, 24 Aug 2024 08:31:01 GMT) Full text and rfc822 format available.

Message #8 received at 72611 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Brad Howes <bradhowes <at> mac.com>, Dmitry Gutov <dmitry <at> gutov.dev>
Cc: 72611 <at> debbugs.gnu.org
Subject: Re: bug#72611: [Patch] Store canonical paths to project roots
Date: Sat, 24 Aug 2024 11:29:58 +0300
> Date: Tue, 13 Aug 2024 21:56:38 +0200
> From:  Brad Howes via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> Tags: patch
> 
> Adapt 'project-roots' to always return a canonical path
> in order to eliminate aliased values in the saved project
> paths file.

Dmitry, any comments?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72611; Package emacs. (Mon, 26 Aug 2024 01:22:01 GMT) Full text and rfc822 format available.

Message #11 received at 72611 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Brad Howes <bradhowes <at> mac.com>, 72611 <at> debbugs.gnu.org
Subject: Re: bug#72611: [Patch] Store canonical paths to project roots
Date: Mon, 26 Aug 2024 04:20:37 +0300
Hi!

On 13/08/2024 22:56, Brad Howes via Bug reports for GNU Emacs, the Swiss 
army knife of text editors wrote:
> diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
> index 3d0f742c51d..af6cf4640d1 100644
> --- a/lisp/progmodes/project.el
> +++ b/lisp/progmodes/project.el
> @@ -266,7 +266,7 @@ project-root
>   (cl-defmethod project-root (project
>                               &context (project--within-roots-fallback
>                                         (eql nil)))
> -  (car (project-roots project)))
> +  (expand-file-name (car (project-roots project))))

This is the default implementation of 'project-root' which is currently 
only used as a fallback when a backend implements the outdated 
convention (method 'project-roots').

So it might have effect in your case (which backend are you using? I'd 
like to ask), but not in the general one.

Speaking of "saved project paths file", if your goal is to have expanded 
file names written to ~/.emacs.d/projects, then we have code in 
project--remember-dir that explicitly abbreviates, since August 2023. 
That's commit 255b7e1a046c.

Perhaps if your Emacs and project.el are older, you don't see it yet.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72611; Package emacs. (Mon, 26 Aug 2024 17:36:02 GMT) Full text and rfc822 format available.

Message #14 received at 72611 <at> debbugs.gnu.org (full text, mbox):

From: Brad Howes <bradhowes <at> mac.com>
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: 72611 <at> debbugs.gnu.org
Subject: Re: bug#72611: [Patch] Store canonical paths to project roots
Date: Mon, 26 Aug 2024 19:33:57 +0200
On 26 Aug 2024, at 03:20, Dmitry Gutov <dmitry <at> gutov.dev> wrote:
> 
> This is the default implementation of 'project-root' which is currently only used as a fallback when a backend implements the outdated convention (method 'project-roots').
> 
> So it might have effect in your case (which backend are you using? I'd like to ask), but not in the general one.
> 
> Speaking of "saved project paths file", if your goal is to have expanded file names written to ~/.emacs.d/projects, then we have code in project--remember-dir that explicitly abbreviates, since August 2023. That's commit 255b7e1a046c.

Hi Dimitri,

Thanks for the info. I see now my patch is not the proper place in which to do such a change, so I will withdraw it and close it.

FYI, my goal was to keep from seeing duplicate entries in the list of projects due to one path starting with “~” and another having that expanded out to my home directory. Ideally the paths would all be shortened by removing their common prefix, but I took the shortest route and just expanded whatever was obtained from 

As for a backend, I assume that this is being delegated to ‘vc’ or ‘git’. Not really sure, but I don’t think I’ve set anything specific for this.

Regards,

Brad



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72611; Package emacs. (Mon, 26 Aug 2024 23:28:02 GMT) Full text and rfc822 format available.

Message #17 received at 72611 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Brad Howes <bradhowes <at> mac.com>
Cc: 72611 <at> debbugs.gnu.org
Subject: Re: bug#72611: [Patch] Store canonical paths to project roots
Date: Tue, 27 Aug 2024 02:26:10 +0300
On 26/08/2024 20:33, Brad Howes wrote:
> FYI, my goal was to keep from seeing duplicate entries in the list of
> projects due to one path starting with “~” and another having that
> expanded out to my home directory. Ideally the paths would all be
> shortened by removing their common prefix, but I took the shortest route
>   and just expanded whatever was obtained from

It would be useful to track down the scenario which creates those 
different paths.

You might want to upgrade to the last version of 'project' first and 
re-test (in 'M-x list-packages'), if you don't already have it installed.

IIRC project--read-project-list's current definition (with its 
`abbreviate-file-name' calls) is exactly an effort to avoid that.




Reply sent to Stefan Kangas <stefankangas <at> gmail.com>:
You have taken responsibility. (Tue, 11 Feb 2025 19:21:02 GMT) Full text and rfc822 format available.

Notification sent to Brad Howes <bradhowes <at> mac.com>:
bug acknowledged by developer. (Tue, 11 Feb 2025 19:21:02 GMT) Full text and rfc822 format available.

Message #22 received at 72611-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Brad Howes <bradhowes <at> mac.com>
Cc: Dmitry Gutov <dmitry <at> gutov.dev>, 72611-done <at> debbugs.gnu.org
Subject: Re: bug#72611: [Patch] Store canonical paths to project roots
Date: Tue, 11 Feb 2025 11:20:47 -0800
Brad Howes <bradhowes <at> mac.com> writes:

> Thanks for the info. I see now my patch is not the proper place in
> which to do such a change, so I will withdraw it and close it.

I'm therefore closing this bug report.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 12 Mar 2025 11:24:13 GMT) Full text and rfc822 format available.

This bug report was last modified 118 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.