From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Augusto Stoffel Newsgroups: gmane.emacs.bugs Subject: bug#50499: 28.0.50; project.el: Root of current project Date: Fri, 10 Sep 2021 18:08:52 +0200 Message-ID: <87lf44e7l7.fsf@gmail.com> References: <87v939ypa1.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3107"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 50499@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 10 18:10:34 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mOj6l-0000OT-6e for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 10 Sep 2021 18:10:31 +0200 Original-Received: from localhost ([::1]:54120 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mOj6k-0003tp-3p for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 10 Sep 2021 12:10:30 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34002) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mOj6J-0003Xq-AS for bug-gnu-emacs@gnu.org; Fri, 10 Sep 2021 12:10:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55713) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mOj6I-0003nJ-Vf for bug-gnu-emacs@gnu.org; Fri, 10 Sep 2021 12:10:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mOj6I-0005Fo-D8 for bug-gnu-emacs@gnu.org; Fri, 10 Sep 2021 12:10:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Augusto Stoffel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 10 Sep 2021 16:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50499 X-GNU-PR-Package: emacs Original-Received: via spool by 50499-submit@debbugs.gnu.org id=B50499.163129014320115 (code B ref 50499); Fri, 10 Sep 2021 16:10:02 +0000 Original-Received: (at 50499) by debbugs.gnu.org; 10 Sep 2021 16:09:03 +0000 Original-Received: from localhost ([127.0.0.1]:39026 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mOj5L-0005EN-2b for submit@debbugs.gnu.org; Fri, 10 Sep 2021 12:09:03 -0400 Original-Received: from mail-wm1-f51.google.com ([209.85.128.51]:40617) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mOj5I-0005Ds-AD for 50499@debbugs.gnu.org; Fri, 10 Sep 2021 12:09:01 -0400 Original-Received: by mail-wm1-f51.google.com with SMTP id n14-20020a05600c3b8e00b002f8bd2f8ab6so1818131wms.5 for <50499@debbugs.gnu.org>; Fri, 10 Sep 2021 09:09:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=cz7yuYxILT4Vwp3hk8PYFFdvv7B5Hw7LcwiaY2qa5ts=; b=o2pJkQLoPBoZGLVPeE/s+UcxhoCUljslhV4fQVMjXnmKBC5F/mwC+sULEtW1PGQCiO CfFpDHXxOfdwuLNadmEIM8lcXsnWInFyX8WbNHUI7nH8eJ0wkCW2G1Et1mc5gxhNvQOU /FQW3Ya71sFuMP+2ieaS2ELIj5DGqekBpSzKuGLoBBroXBtzfVCqW/ildUs7cvTJ93op No5YOQIdoUa+FxBnyjFGbirJgJA1800Ehfb/osP/2UEaO7WktfItFSq8JgzZ+gXqognV NBp3uG4XvWA2EDTNeVue6PIagEwar5k+n51u1O9RazwkflqTm0h/SHTmFSp4gPHQxPJu Y8HA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=cz7yuYxILT4Vwp3hk8PYFFdvv7B5Hw7LcwiaY2qa5ts=; b=xcl1c+VK1V79qFryIQDjY6qIoS7BYSPcWFchmxiYJx+NzpB9z7PynBOXx1BhO6HjT2 6FoUok4reQCswYdl+2baX77uIG7EUVm/1YqK1XXCoyzifm5PhklMT5HbIDGPtWq73guU sr28kS8PJSldBEn1ZSAIUnrDArtgnjiecKzbV0yEq2fuwO5ift1Ie00qPaTOq2PSAE+A yqGvL6bB+lA7jv8Vkqm+bA8chEpp4AYdHmBbyln+WKb5z6CnS3H1O9NFMS91p9lLk10O khFTAtA9NR1R5riH2D1y4nW7W0LLtHeAedRmNWs34ycZ9fcvZ7Hx1DDCEY2OrqPE9mR4 adWQ== X-Gm-Message-State: AOAM531SIw1ohyiBpC8JBGJtR1UqPGsm1dhNmVTGNVAZ28yWNQq1Mc+C l+RqjwC8dHeo0qeCjCYVAVGG8kUOZg0Z4Q== X-Google-Smtp-Source: ABdhPJyr4dlE1oKNOb1DX8RBk8HXEEsWGaGL2OaaXGqFZ/jsul6DWndnJDWqDQ5sytv86Bzuq/ekhA== X-Received: by 2002:a7b:c0d5:: with SMTP id s21mr8519070wmh.125.1631290134211; Fri, 10 Sep 2021 09:08:54 -0700 (PDT) Original-Received: from ars3 ([2a02:8109:8ac0:56d0::b1d]) by smtp.gmail.com with ESMTPSA id s13sm4725971wmc.47.2021.09.10.09.08.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Sep 2021 09:08:53 -0700 (PDT) In-Reply-To: (Dmitry Gutov's message of "Fri, 10 Sep 2021 15:16:56 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:214025 Archived-At: On Fri, 10 Sep 2021 at 15:16, Dmitry Gutov 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 =E2=80=9C&optional BUFFER=E2=80= =9D 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?