From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.bugs Subject: bug#65386: [PATCH] ; Refine some 'package-vc' docstrings Date: Sun, 20 Aug 2023 16:04:54 +0000 Message-ID: <87edjxu2c9.fsf@posteo.net> References: <83msymyfun.fsf@gnu.org> <83h6ouxn7m.fsf@gnu.org> <871qfyunan.fsf@posteo.net> <87ttstucss.fsf@posteo.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15664"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , 65386@debbugs.gnu.org To: Eshel Yaron Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Aug 20 18:06:18 2023 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 1qXkwT-0003ox-An for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 20 Aug 2023 18:06:17 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qXkwF-00062C-Oj; Sun, 20 Aug 2023 12:06:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qXkwD-00061m-4n for bug-gnu-emacs@gnu.org; Sun, 20 Aug 2023 12:06:01 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qXkwC-0002EC-T2 for bug-gnu-emacs@gnu.org; Sun, 20 Aug 2023 12:06:00 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qXkwE-0002qF-HV for bug-gnu-emacs@gnu.org; Sun, 20 Aug 2023 12:06:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 20 Aug 2023 16:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65386 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 65386-submit@debbugs.gnu.org id=B65386.169254750910858 (code B ref 65386); Sun, 20 Aug 2023 16:06:02 +0000 Original-Received: (at 65386) by debbugs.gnu.org; 20 Aug 2023 16:05:09 +0000 Original-Received: from localhost ([127.0.0.1]:54663 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXkvM-0002p4-Li for submit@debbugs.gnu.org; Sun, 20 Aug 2023 12:05:09 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:53991) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXkvK-0002oI-R8 for 65386@debbugs.gnu.org; Sun, 20 Aug 2023 12:05:08 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 1E523240103 for <65386@debbugs.gnu.org>; Sun, 20 Aug 2023 18:04:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1692547499; bh=thgvI21inBBWLZF2vnm5iwDRXWYhpdMfPVV92VbQBT8=; h=From:To:Cc:Subject:Autocrypt:Date:Message-ID:MIME-Version:From; b=aLHO3qZmaAOlI9Pr0wqIcfBXt8bxZZMoQrpYEAirSSO98rF2hKDs3Lm6lNk4hJjPc womsX6QSTQyR4I44EKoBA4CxF1fq5F4aeJxVb8KgihsUJi8NdMPcwa6Y1S0SW5kuua SiQnZ+Qjv5T4zhO+R46T903XlDFCPsU40rJ/CVOQi0d2A4RHctJMjQKSiUTjebut1t bwivLLw8qaWQTgFdg/+VQ7Dm/SVbFPSPnXZIEPBOcoKaGO2cq6FaysvQqKufUoulW8 kzoipyrmx5Uj6d/W6q+eS/7XiyiG+kHuRMXQyBvpVVRYWL508vQ/rbwybFwhalAr7b iMRVdGaw2Mc/A== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4RTL6L2H3Vz6tw8; Sun, 20 Aug 2023 18:04:57 +0200 (CEST) In-Reply-To: (Eshel Yaron's message of "Sun, 20 Aug 2023 16:44:26 +0200") Autocrypt: addr=philipk@posteo.net; keydata= mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof z4oM 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:268005 Archived-At: Eshel Yaron writes: >> Also, would it make sense to determine this at compile-time? On the >> other hand, if a VC backend is installed later on from ELPA, we would >> want the custom type to reflect this. > > Yes, I couldn't find a way to defer computing the set of candidates to > "customization type", I'm not sure if that even makes total sense. I > think it's not that crucial since someone adding a VC backend and > immediately trying to customize these options seems to me like a very > minor edge case, and we had the same issue prior to my patch anyhow. Likely yes, but if we have two mostly equivalent solutions, I think that flexibility without having to restart Emacs is preferable to performance. [...] > From 8a339d3bffe81f80e7e968505c40855d6598b8ac Mon Sep 17 00:00:00 2001 > From: Eshel Yaron > Date: Sun, 20 Aug 2023 16:20:54 +0200 > Subject: [PATCH] ; Refine 'defcustom' types in 'package-vc' > > Only include VC backends that support cloning in the ':type' of > 'package-vc-heuristic-alist' and 'package-vc-default-backend'. > > * lisp/emacs-lisp/package-vc.el (package-vc--cloning-backend-p) > (package-vc--backends): New functions. > (package-vc-heuristic-alist, package-vc-default-backend): Use it. > --- > lisp/emacs-lisp/package-vc.el | 13 +++++++++++-- > 1 file changed, 11 insertions(+), 2 deletions(-) > > diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el > index a3762d252b0..44a4624e49f 100644 > --- a/lisp/emacs-lisp/package-vc.el > +++ b/lisp/emacs-lisp/package-vc.el > @@ -62,6 +62,15 @@ package-vc > (defconst package-vc--elpa-packages-version 1 > "Version number of the package specification format understood by package-vc.") > > +(defun package-vc--cloning-backend-p (be) > + "Return non-nil if the VC backend BE supports cloning repositories." > + (or (vc-find-backend-function be 'clone) > + (alist-get 'clone (get be 'vc-functions)))) > + > +(defun package-vc--backends () > + "Return a list of VC backends suitable for cloning package VCS repositories." > + (seq-filter #'package-vc--cloning-backend-p vc-handled-backends)) Do you think that these utility functions are useful enough to have in general, or would it be better to just define a defconst once that generates the `(choice ...)' object? > + > (defcustom package-vc-heuristic-alist > `((,(rx bos "http" (? "s") "://" > (or (: (? "www.") "github.com" > @@ -105,7 +114,7 @@ package-vc-heuristic-alist > :type `(alist :key-type (regexp :tag "Regular expression matching URLs") > :value-type (choice :tag "VC Backend" > ,@(mapcar (lambda (b) `(const ,b)) > - vc-handled-backends))) > + (package-vc--backends)))) > :version "29.1") > > (defcustom package-vc-default-backend 'Git > @@ -117,7 +126,7 @@ package-vc-default-backend > The value must be a member of `vc-handled-backends' that supports > the `clone' VC function." > :type `(choice ,@(mapcar (lambda (b) (list 'const b)) > - vc-handled-backends)) > + (package-vc--backends))) > :version "29.1") > > (defcustom package-vc-register-as-project t