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 18:33:46 +0000 Message-ID: <875y59tvg5.fsf@posteo.net> References: <83msymyfun.fsf@gnu.org> <83h6ouxn7m.fsf@gnu.org> <871qfyunan.fsf@posteo.net> <87ttstucss.fsf@posteo.net> <87edjxu2c9.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="34037"; 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 20:34: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 1qXnFh-0008bf-GV for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 20 Aug 2023 20:34:17 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qXnFR-0002Kg-Pt; Sun, 20 Aug 2023 14:34:01 -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 1qXnFR-0002KX-0e for bug-gnu-emacs@gnu.org; Sun, 20 Aug 2023 14:34: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 1qXnFQ-0007Pb-Ow for bug-gnu-emacs@gnu.org; Sun, 20 Aug 2023 14:34:00 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qXnFS-0003Rx-E7 for bug-gnu-emacs@gnu.org; Sun, 20 Aug 2023 14:34: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 18:34: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.169255643913251 (code B ref 65386); Sun, 20 Aug 2023 18:34:02 +0000 Original-Received: (at 65386) by debbugs.gnu.org; 20 Aug 2023 18:33:59 +0000 Original-Received: from localhost ([127.0.0.1]:54861 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXnFO-0003Rf-OK for submit@debbugs.gnu.org; Sun, 20 Aug 2023 14:33:59 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:39909) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXnFM-0003RS-Hr for 65386@debbugs.gnu.org; Sun, 20 Aug 2023 14:33:57 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id CC337240101 for <65386@debbugs.gnu.org>; Sun, 20 Aug 2023 20:33:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1692556428; bh=Y9cEU/C6sH9b8ebTFlHAr8pZDDL+bSuhWgLWYHrOoCk=; h=From:To:Cc:Subject:Autocrypt:Date:Message-ID:MIME-Version:From; b=RIyI8A8jKShglWSXzlQOenMDROVlLxsJmp9WoRYKr0C2JCCOCqoLg6cz+DwWoneFa WlTZv59QPGVOKsiP2r/gKvWRmC2fuSz9xHrY/X/igRqGKd0xvL21ClsR3EhFRFb8iD lZhaG4M+wKumaSUcrHezCM/YPUyxvn25FSBxqjQ+c2sED6cpvfvaaZOMTYlTHF8oxN +q0+sKAsf0CNCQWqUU/S53l1aHI8ghg8iJ3h+gxuhB5XoGgZCKWg8w30RITJQc2BxI 7dCwYCSLjqS+eGJv/HM4G0qG5+ur/jiXnoNZzSYr7Q+ZF2yk3/8qweFkNemKs9mKbl ZU8JMEdb1i2ag== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4RTPQ42FDkz6twC; Sun, 20 Aug 2023 20:33:48 +0200 (CEST) In-Reply-To: (Eshel Yaron's message of "Sun, 20 Aug 2023 18:22:28 +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:268026 Archived-At: Eshel Yaron writes: > Philip Kaludercic writes: > >> 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. >> > > Hmm I'm not sure I completely follow. Which two solutions do you have > in mind? I agree that it would be nice have the `:type` updated if the > user adds a relevant VC backend, but I don't think `defcustom` supports > something like that. How do you propose to achieve that flexibility? Sorry, in the end it doesn't matter, I can't quickly think of a way to define a type flexible enough to automatically update to the environment, nor does computing a constant value at compile time seem either worth it. >> [...] >> >>> 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? > > I think these are nice to have, but I don't mind removing them in favor > of a `defconst` (or a `define-widget` for that matter) if you think > that's better. I think a defconst would be a simpler solution, having functions like these always bear the danger of being misused, despite being marked as internal.