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: Stefan Monnier
Subject: Re: master 6e796b5: Stop project-root from going into infinite recursion
Date: Wed, 17 Mar 2021 18:29:34 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

>> I think `cl-call-next-method` is a better choice.
> If you're sure about that.
> The idea here was, some prospective backend author might look at the error
> symbol and make a decision on how to fix the problem based on it.
> And "you need to implement this method" seems better expressed with "No
>  applicable method" rather than with "No next method".

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 ;-)

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 ;-)


        Stefan




reply via email to

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