GNU bug report logs - #50499
28.0.50; project.el: Root of current project

Previous Next

Package: emacs;

Reported by: Augusto Stoffel <arstoffel <at> gmail.com>

Date: Fri, 10 Sep 2021 05:27:02 UTC

Severity: wishlist

Tags: wontfix

Found in version 28.0.50

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

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 50499 in the body.
You can then email your comments to 50499 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#50499; Package emacs. (Fri, 10 Sep 2021 05:27:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Augusto Stoffel <arstoffel <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 10 Sep 2021 05:27:02 GMT) Full text and rfc822 format available.

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

From: Augusto Stoffel <arstoffel <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.0.50; project.el: Root of current project
Date: Fri, 10 Sep 2021 07:26:30 +0200
I guess most uses of `project-root' will be of the form

    (when-let ((p (project-current)))
       (project-root p))

Or at least this is true in the case of an user who is quickly defining
a shortcut command in their config.

Wouldn't it make sense to make the PROJECT argument of `project-root'
optional, giving the above result when omitted?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50499; Package emacs. (Fri, 10 Sep 2021 12:18:01 GMT) Full text and rfc822 format available.

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

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Augusto Stoffel <arstoffel <at> gmail.com>, 50499 <at> debbugs.gnu.org
Subject: Re: bug#50499: 28.0.50; project.el: Root of current project
Date: Fri, 10 Sep 2021 15:16:56 +0300
On 10.09.2021 08:26, Augusto Stoffel wrote:
> I guess most uses of `project-root' will be of the form
> 
>      (when-let ((p (project-current)))
>         (project-root p))
> 
> Or at least this is true in the case of an user who is quickly defining
> a shortcut command in their config.
> 
> Wouldn't it make sense to make the PROJECT argument of `project-root'
> optional, giving the above result when omitted?

Given the way it this works, it would need to be a helper function.

IIUC cl-defmethod does not support default values for arguments, and if 
it did, we'd have to have an implementation of project-root, etc, for 
nil argument. Which is a bad idea because someone else might not want to 
simply do nothing when there is no project found, and our type system 
would then fail to help them notice that.

I don't mind adding said helper (naming suggestions welcome), but the 
way things work now seems fine to me already. Either you have:

  (project-root (project-current t))

where there is no risk of returning nil, and thus no need for when-let,
or you call (project-current) first, check it for nil, and then 
_probably_ use some other fallbacks. If you don't have fallbacks, then 
the other approach seems better, no?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50499; Package emacs. (Fri, 10 Sep 2021 16:10:02 GMT) Full text and rfc822 format available.

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

From: Augusto Stoffel <arstoffel <at> gmail.com>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 50499 <at> debbugs.gnu.org
Subject: Re: bug#50499: 28.0.50; project.el: Root of current project
Date: Fri, 10 Sep 2021 18:08:52 +0200
On Fri, 10 Sep 2021 at 15:16, Dmitry Gutov <dgutov <at> yandex.ru> wrote:

> On 10.09.2021 08:26, Augusto Stoffel wrote:
>> I guess most uses of `project-root' will be of the form
>>      (when-let ((p (project-current)))
>>         (project-root p))
>> Or at least this is true in the case of an user who is quickly
>> defining
>> a shortcut command in their config.
>> Wouldn't it make sense to make the PROJECT argument of
>> `project-root'
>> optional, giving the above result when omitted?
>
> Given the way it this works, it would need to be a helper function.

Okay, introducing a new name is probably not worth the trouble for such
a small benefit.  Only if it was possible/easy to overload the existing
function (and make it analogous the typical “&optional BUFFER” kind of
argument) would there be a gain in it, I think.

>
> IIUC cl-defmethod does not support default values for arguments, and
> if it did, we'd have to have an implementation of project-root, etc,
> for nil argument. Which is a bad idea because someone else might not
> want to simply do nothing when there is no project found, and our type
> system would then fail to help them notice that.
>
> I don't mind adding said helper (naming suggestions welcome), but the
> way things work now seems fine to me already. Either you have:
>
>   (project-root (project-current t))
>
> where there is no risk of returning nil, and thus no need for when-let,
> or you call (project-current) first, check it for nil, and then
> _probably_ use some other fallbacks. If you don't have fallbacks, then
> the other approach seems better, no?




Severity set to 'wishlist' from 'normal' Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Tue, 21 Sep 2021 15:47:05 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50499; Package emacs. (Thu, 25 Aug 2022 14:45:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Augusto Stoffel <arstoffel <at> gmail.com>
Cc: 50499 <at> debbugs.gnu.org, Dmitry Gutov <dgutov <at> yandex.ru>
Subject: Re: bug#50499: 28.0.50; project.el: Root of current project
Date: Thu, 25 Aug 2022 16:43:58 +0200
Augusto Stoffel <arstoffel <at> gmail.com> writes:

> Okay, introducing a new name is probably not worth the trouble for such
> a small benefit.  Only if it was possible/easy to overload the existing
> function (and make it analogous the typical “&optional BUFFER” kind of
> argument) would there be a gain in it, I think.

(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

If I understand correctly, the conclusion here was that we don't want to
do this, so I'm closing this bug report.  If I misunderstood, please
respond to the debbugs address and we'll reopen.




Added tag(s) wontfix. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 25 Aug 2022 14:45:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 50499 <at> debbugs.gnu.org and Augusto Stoffel <arstoffel <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 25 Aug 2022 14:45:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 23 Sep 2022 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 187 days ago.

Previous Next


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