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: Mon, 21 Aug 2023 09:27:54 +0000 Message-ID: <87wmxohhid.fsf@posteo.net> References: <7a0f6dcb-3e56-8009-3f54-bb7b9fb6fce3@gmail.com> <87pm3hsb8t.fsf@posteo.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25171"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , Mauro Aranda , 65386@debbugs.gnu.org To: Eshel Yaron Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 21 11:29:09 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 1qY1Dh-0006Jn-1C for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 21 Aug 2023 11:29:09 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qY1Da-0004Bd-Lh; Mon, 21 Aug 2023 05:29:02 -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 1qY1DY-0004BH-MI for bug-gnu-emacs@gnu.org; Mon, 21 Aug 2023 05:29:00 -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 1qY1DY-0004L3-CP for bug-gnu-emacs@gnu.org; Mon, 21 Aug 2023 05:29:00 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qY1Da-0007BJ-7U for bug-gnu-emacs@gnu.org; Mon, 21 Aug 2023 05:29: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: Mon, 21 Aug 2023 09:29: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.169261008627542 (code B ref 65386); Mon, 21 Aug 2023 09:29:02 +0000 Original-Received: (at 65386) by debbugs.gnu.org; 21 Aug 2023 09:28:06 +0000 Original-Received: from localhost ([127.0.0.1]:55595 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qY1Cf-0007AA-Va for submit@debbugs.gnu.org; Mon, 21 Aug 2023 05:28:06 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:49951) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qY1Ce-00079h-1g for 65386@debbugs.gnu.org; Mon, 21 Aug 2023 05:28:04 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 4A8B3240103 for <65386@debbugs.gnu.org>; Mon, 21 Aug 2023 11:27:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1692610076; bh=3UMB7NVos5w01St4FW9H5slOir53Do/4U6r501EQy+I=; h=From:To:Cc:Subject:Autocrypt:Date:Message-ID:MIME-Version:From; b=n94CrZ/PV9iJRE7ALgsebGsmkwT9kwkIhqM0+f+zPJjG+kWqjmaWnv1QtK/wXcoem /wFfILx8Aaryp5DXnAgktvUZiI+wrQ+ZU71prAW0VGFCt+l/UtFO5vV9kCeaJBOdul ukDMrmdTrwwh4osNiKv96FUaYuctCTVELf2xMFrgix4Q1Ij1C4M3wA/N6YFoWdQ1EX mUtEgq8/jlgSIF/v+oCuQP1jxxgeVrMBTQ5MiHjZMORwzFKfaeTEZWnMx0meu9NvQ3 Sz/nqzQMoYLvvDe1BL1n0Y/gOKbdpioGjnMt+0PnGessnMKlXvF/Lfx0kcVLnUys1D R+pe0BNDT4UZw== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4RTnFl2fhpz9rxF; Mon, 21 Aug 2023 11:27:55 +0200 (CEST) In-Reply-To: (Eshel Yaron's message of "Mon, 21 Aug 2023 10:16:59 +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:268074 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Eshel Yaron writes: > Philip Kaludercic writes: > >> Mauro Aranda writes: >> >>> >>> I haven't watch this thread closely, but do note that creating dynamic >>> choices is quite possible, if I understand correctly what you're looking >>> for. >>> >>> If you can, take a look at the defcustom of completion-styles, in >>> minibuffer.el.=C2=A0 Its type uses a choice with a specialized >>> :convert-widget function to keep the choices up-to date. >> >> This might be exactly what we are looking for. It should be possible to >> adapt `completion--update-styles-options' pretty much directly to our >> example. > > Mauro, thanks for the great tip. As Philip said, this seems to be > exactly what we need here. Accordingly, I'm attaching an updated patch f= or the > `defcustom` types (the two other patches from my previous message are > not affected and remain applicable). I have slightly modified it to remove the helper functions. As mentioned before. Hope you are fine with it: --=-=-= Content-Type: text/plain Content-Disposition: inline diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el index bf4cad4f319..dfaedbcc84c 100644 --- a/lisp/emacs-lisp/package-vc.el +++ b/lisp/emacs-lisp/package-vc.el @@ -62,6 +62,18 @@ package-vc (defconst package-vc--elpa-packages-version 1 "Version number of the package specification format understood by package-vc.") +(defconst package-vc--backend-type + `(choice :convert-widget + ,(lambda (widget) + (let (opts) + (dolist (be vc-handled-backends) + (when (or (vc-find-backend-function be 'clone) + (alist-get 'clone (get be 'vc-functions))) + (push (widget-convert (list 'const be)) opts))) + (widget-put widget :args opts)) + widget)) + "The type of VC backends that support cloning package VCS repositories.") + (defcustom package-vc-heuristic-alist `((,(rx bos "http" (? "s") "://" (or (: (? "www.") "github.com" @@ -103,9 +115,7 @@ package-vc-heuristic-alist the URL-REGEXP of the association. If no match is found, `package-vc-install' uses `package-vc-default-backend' instead." :type `(alist :key-type (regexp :tag "Regular expression matching URLs") - :value-type (choice :tag "VC Backend" - ,@(mapcar (lambda (b) `(const ,b)) - vc-handled-backends))) + :value-type ,package-vc--backend-type) :version "29.1") (defcustom package-vc-default-backend 'Git @@ -116,8 +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)) + :type package-vc--backend-type :version "29.1") (defcustom package-vc-register-as-project t --=-=-=--