GNU bug report logs - #59756
[PATCH] Use file-name-nondirectory to determine project-name

Previous Next

Package: emacs;

Reported by: Randy Taylor <dev <at> rjt.dev>

Date: Fri, 2 Dec 2022 03:35:01 UTC

Severity: normal

Tags: patch

Done: Dmitry Gutov <dgutov <at> yandex.ru>

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 59756 in the body.
You can then email your comments to 59756 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 dgutov <at> yandex.ru, bug-gnu-emacs <at> gnu.org:
bug#59756; Package emacs. (Fri, 02 Dec 2022 03:35:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Randy Taylor <dev <at> rjt.dev>:
New bug report received and forwarded. Copy sent to dgutov <at> yandex.ru, bug-gnu-emacs <at> gnu.org. (Fri, 02 Dec 2022 03:35:02 GMT) Full text and rfc822 format available.

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

From: Randy Taylor <dev <at> rjt.dev>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: [PATCH] Use file-name-nondirectory to determine project-name
Date: Fri, 02 Dec 2022 03:34:30 +0000
[Message part 1 (text/plain, inline)]
X-Debbugs-CC: dgutov <at> yandex.ru

If a project is named something like ".emacs.d", file-name-base will return ".emacs" instead of ".emacs.d" as expected (or at least as I expect it).

Therefore, we use file-name-nondirectory instead.
[Message part 2 (text/html, inline)]
[0001-Use-file-name-nondirectory-to-determine-project-name.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59756; Package emacs. (Fri, 02 Dec 2022 08:10:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Randy Taylor <dev <at> rjt.dev>
Cc: dgutov <at> yandex.ru, 59756 <at> debbugs.gnu.org
Subject: Re: bug#59756: [PATCH] Use file-name-nondirectory to determine
 project-name
Date: Fri, 02 Dec 2022 10:08:42 +0200
> Cc: dgutov <at> yandex.ru
> Date: Fri, 02 Dec 2022 03:34:30 +0000
> From: Randy Taylor <dev <at> rjt.dev>
> 
> If a project is named something like ".emacs.d", file-name-base will return ".emacs" instead of ".emacs.d" as
> expected (or at least as I expect it).
> 
> Therefore, we use file-name-nondirectory instead.

Why do we want to support such project names?

I could also name my project /foo/bar/baz, and defeat file-name-nondirectory
as well.  Where does it end?

My suggestion is to require that project names don't include slashes,
backslashes, periods and maybe also colon characters.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59756; Package emacs. (Fri, 02 Dec 2022 12:48:01 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>, Randy Taylor <dev <at> rjt.dev>
Cc: 59756 <at> debbugs.gnu.org, dgutov <at> yandex.ru
Subject: Re: bug#59756: [PATCH] Use file-name-nondirectory to determine
 project-name
Date: Fri, 2 Dec 2022 04:47:35 -0800
Eli Zaretskii <eliz <at> gnu.org> writes:

>> If a project is named something like ".emacs.d", file-name-base will
>> return ".emacs" instead of ".emacs.d" as expected (or at least as I
>> expect it).
>>
>> Therefore, we use file-name-nondirectory instead.
>
> Why do we want to support such project names?

Because people put their configuration files under version control, and
they want to use project commands there.  For example "~/.emacs.d",
which is what I use.

> I could also name my project /foo/bar/baz, and defeat file-name-nondirectory
> as well.  Where does it end?
>
> My suggestion is to require that project names don't include slashes,
> backslashes, periods and maybe also colon characters.

It's fine to disallow slashes, backslashes, and colons, but banning
periods would break some of my most important use-cases.  So I hope we
won't do that.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59756; Package emacs. (Fri, 02 Dec 2022 14:38:01 GMT) Full text and rfc822 format available.

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

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Eli Zaretskii <eliz <at> gnu.org>, Randy Taylor <dev <at> rjt.dev>
Cc: 59756 <at> debbugs.gnu.org
Subject: Re: bug#59756: [PATCH] Use file-name-nondirectory to determine
 project-name
Date: Fri, 2 Dec 2022 16:37:26 +0200
On 02/12/2022 10:08, Eli Zaretskii wrote:
>> Cc: dgutov <at> yandex.ru
>> Date: Fri, 02 Dec 2022 03:34:30 +0000
>> From: Randy Taylor <dev <at> rjt.dev>
>>
>> If a project is named something like ".emacs.d", file-name-base will return ".emacs" instead of ".emacs.d" as
>> expected (or at least as I expect it).
>>
>> Therefore, we use file-name-nondirectory instead.
> 
> Why do we want to support such project names?

The bug's description is not very good.

The goal of the code in question is to produce an automatic version of 
the project name from its root directory, allowing individual project 
backends to override that logic.

This fix is an update for the same (logic to produce the default name), 
restoring what I'm sure was the original intent. The directories just 
don't often have extensions, so it passed by the initial testing.

> I could also name my project /foo/bar/baz, and defeat file-name-nondirectory
> as well.  Where does it end?

This is not about the user naming a project something.

ELISP> (file-name-nondirectory (directory-file-name "/foo/bar/baz/"))
"baz"

This is correct.

This custom name (e.g. set through project-vc-name) does not pass 
through this conversion. You can use whatever special characters you 
want, why not? Newlines might break some UI, but if the user wants that...




Reply sent to Dmitry Gutov <dgutov <at> yandex.ru>:
You have taken responsibility. (Fri, 02 Dec 2022 15:25:02 GMT) Full text and rfc822 format available.

Notification sent to Randy Taylor <dev <at> rjt.dev>:
bug acknowledged by developer. (Fri, 02 Dec 2022 15:25:02 GMT) Full text and rfc822 format available.

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

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Randy Taylor <dev <at> rjt.dev>, 59756-done <at> debbugs.gnu.org
Subject: Re: bug#59756: [PATCH] Use file-name-nondirectory to determine
 project-name
Date: Fri, 2 Dec 2022 17:24:11 +0200
On 02/12/2022 05:34, Randy Taylor wrote:
> X-Debbugs-CC: dgutov <at> yandex.ru <mailto:dgutov <at> yandex.ru>
> 
> If a project is named something like ".emacs.d", file-name-base will 
> return ".emacs" instead of ".emacs.d" as expected (or at least as I 
> expect it).
> 
> Therefore, we use file-name-nondirectory instead.

Applied, thanks!




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 31 Dec 2022 12:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 166 days ago.

Previous Next


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