From: Dmitry Gutov <dgutov@yandex.ru>
To: Juri Linkov <juri@linkov.net>,
47168@debbugs.gnu.org, Stefan Monnier <monnier@IRO.UMontreal.CA>
Subject: bug#47168: 28.0.50; Infinite recursion in project-root
Date: Wed, 17 Mar 2021 04:47:15 +0200 [thread overview]
Message-ID: <36f5ca08-1ddc-a183-3f12-e942f6a7ff89@yandex.ru> (raw)
In-Reply-To: <87ft0wpooj.fsf@mail.linkov.net>
Hi Juri,
On 15.03.2021 19:04, Juri Linkov wrote:
> When for some reason the argument of 'project-root' becomes nil,
> for example, when the current buffer is not under version control,
> then
>
> (project-root (project-current))
>
> goes into infinite recursion:
>
> Debugger entered--Lisp error: (error "Lisp nesting exceeds ‘max-lisp-eval-depth’")
> project-root(nil)
> project-roots(nil)
> ...
> project-root(nil)
> project-roots(nil)
> ...
Note that the right way to write this code is either
(project-root (project-current t))
or
(when-let ((project (project-current)))
(project-root project))
so we only see this when the programmer failed to account for the
absence of current project.
Still, it would be nice to never show a backtrace like this, even in
those cases.
The idea here was to keep compatibility with backends which implement
project-roots and not project-root (perhaps the built-in vc backend in
Emacs 27), as well as let the clients call either project-root or
project-roots, also for backward compatibility purposes. Worst case, we
can give up on that and require all 3rd party code standardize on
project-root and have all users install the latest project.el from ELPA.
But perhaps we still can have it both ways?
Stefan, any chance there's a relatively non-dirty way we can check
whether there is a non-default implementation for the generic function
with given args, before calling it? That would allow us to break recursion.
next prev parent reply other threads:[~2021-03-17 2:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-15 17:04 bug#47168: 28.0.50; Infinite recursion in project-root Juri Linkov
2021-03-17 2:47 ` Dmitry Gutov [this message]
2021-03-17 3:54 ` Stefan Monnier
2021-03-17 16:51 ` Dmitry Gutov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=36f5ca08-1ddc-a183-3f12-e942f6a7ff89@yandex.ru \
--to=dgutov@yandex.ru \
--cc=47168@debbugs.gnu.org \
--cc=juri@linkov.net \
--cc=monnier@IRO.UMontreal.CA \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).