unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: emacs-devel@gnu.org
Subject: Re: master 6e796b5: Stop project-root from going into infinite recursion
Date: Wed, 17 Mar 2021 18:29:34 -0400	[thread overview]
Message-ID: <jwvsg4th13u.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <ca951efb-6d66-1dcf-4195-c2abf4891bda@yandex.ru> (Dmitry Gutov's message of "Wed, 17 Mar 2021 23:52:06 +0200")

>> 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	other threads:[~2021-03-17 22:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210317164927.28196.12402@vcs0.savannah.gnu.org>
     [not found] ` <20210317164928.C2C11209AA@vcs0.savannah.gnu.org>
2021-03-17 21:33   ` master 6e796b5: Stop project-root from going into infinite recursion Stefan Monnier
2021-03-17 21:52     ` Dmitry Gutov
2021-03-17 22:29       ` Stefan Monnier [this message]
2021-03-18  0:37         ` 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=jwvsg4th13u.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=dgutov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    /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).