emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master 6e796b5: Stop project-root from going into infinite recursion


From: Dmitry Gutov
Subject: Re: master 6e796b5: Stop project-root from going into infinite recursion
Date: Thu, 18 Mar 2021 02:37:21 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1

On 18.03.2021 00:29, Stefan Monnier wrote:
I see.  I consider the difference between the two as an error in CLOS,
but I didn't have the courage to remove it in cl-generic.el;-)

I'm no CLOS expect, so I was choosing purely on how the names sound.

FWIW, you could also get what you want with something like:

     (cl-defgeneric project-root (project)
       "Return root directory of the current project.
It usually contains the main build file, dependencies
     configuration file, etc. Though neither is mandatory.
The directory name must be absolute.")

     (cl-defmethod project-root (project
                                 &context (project--within-roots-fallback
                                           (eql nil)))
       (car (project-roots project)))

This way there indeed won't be any applicable method when
project--within-roots-fallback is non-nil;-)

That's a neat suggestion, thanks!



reply via email to

[Prev in Thread] Current Thread [Next in Thread]