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 12:18:59 +0000 Message-ID: <87ttstucss.fsf@posteo.net> References: <83msymyfun.fsf@gnu.org> <83h6ouxn7m.fsf@gnu.org> <871qfyunan.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="27863"; 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 14:20:24 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 1qXhPr-00075D-TB for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 20 Aug 2023 14:20:24 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qXhPX-0001ii-HL; Sun, 20 Aug 2023 08:20:03 -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 1qXhPV-0001hm-GB for bug-gnu-emacs@gnu.org; Sun, 20 Aug 2023 08:20: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 1qXhPV-0006Pv-6i for bug-gnu-emacs@gnu.org; Sun, 20 Aug 2023 08:20:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qXhPW-0004a2-OU for bug-gnu-emacs@gnu.org; Sun, 20 Aug 2023 08:20: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 12:20: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.169253395217527 (code B ref 65386); Sun, 20 Aug 2023 12:20:02 +0000 Original-Received: (at 65386) by debbugs.gnu.org; 20 Aug 2023 12:19:12 +0000 Original-Received: from localhost ([127.0.0.1]:53285 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXhOh-0004Yc-MR for submit@debbugs.gnu.org; Sun, 20 Aug 2023 08:19:12 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:50803) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qXhOf-0004YO-Iv for 65386@debbugs.gnu.org; Sun, 20 Aug 2023 08:19:10 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id EEF02240103 for <65386@debbugs.gnu.org>; Sun, 20 Aug 2023 14:19:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1692533942; bh=qW9Jxp/wU/CQXTBdtBmUpWDbV03Cr3znIH3vtgsw7G0=; h=From:To:Cc:Subject:Autocrypt:Date:Message-ID:MIME-Version:From; b=BYztSzbYCxlYJK750PlOAzohVPsuSzQIEz29yuT+yZM/QRuW86ZOx5Vzd8ii2Xn6z k0r6TNPTV1ywxGWV/EnGhB42E8g8Z/tDyGU2NQyRjSTHGp4xZZNVnAx/4DrlbLAyt3 +SXquhy6PrW0Kf5qnVxSROuv9Ah8GA+UOcMGigqk9g1UfXevbr7Y/93iqkcD/Qz6Ja 4pKRqWsQniO3jEgmNsTHrCEtFZ4ZPY6o4dwwAwvND/qaYJq3+RmpdP6VRMcogaVInJ aIMq8pURHpHaQtoZ0bGp04s04QCLZHLKGJNyByPcgacVG8PigNkAR/tdCmnDNLiwUl ajQHDzIpBi8uw== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4RTF5d0qlsz9rxG; Sun, 20 Aug 2023 14:19:00 +0200 (CEST) In-Reply-To: (Eshel Yaron's message of "Sun, 20 Aug 2023 12:14:48 +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:267989 Archived-At: Eshel Yaron writes: > Thanks for reviewing, I've replied to your comments and attached an > updated patch (v4) below. > > Philip Kaludercic writes: > >>> :type `(alist :key-type (regexp :tag "Regular expression matching URLs") >>> :value-type (choice :tag "VC Backend" >>> ,@(mapcar (lambda (b) `(const ,b)) >>> @@ -102,14 +107,19 @@ package-vc-heuristic-alist >>> :version "29.1") >>> >>> (defcustom package-vc-default-backend 'Git >>> - "Default VC backend used when cloning a package repository. >>> -If no repository type was specified or could be guessed by >>> -`package-vc-heuristic-alist', this is the default VC backend >>> -used as fallback. The value must be a member of >>> -`vc-handled-backends' and the named backend must implement >>> -the `clone' function." >>> - :type `(choice ,@(mapcar (lambda (b) (list 'const b)) >>> - vc-handled-backends)) >>> + "Default VC backend to use for cloning package repositories. >>> +`package-vc-install' uses this backend when you specify neither >>> +the backend nor a repository URL that's recognized via >>> +`package-vc-heuristic-alist'. >>> + >>> +The value must be a member of `vc-handled-backends' that supports >>> +the `clone' VC function." >>> + :type `(choice ,@(seq-keep >>> + (lambda (be) >>> + (when (or (vc-find-backend-function be 'clone) >>> + (alist-get 'clone (get be 'vc-functions))) >>> + (list 'const be))) >>> + vc-handled-backends)) >> >> This is good, but shouldn't we do something like this in a separate >> patch? No hard opinions on that though. > > I thought it was a small enough change to include along with the doc > improvements, but if you prefer I can update the `:type` in a separate > patch. BTW, this should probably be applied also to > `package-vc-heuristic-alist` either way. In that case I think it would be better to prepare a separate patch. 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. >> Also, it seems this is not returning all the available VC backends... > > Which backend do you see missing? It should include all VC backends > that support `vc-call-backend` with `clone` as FUNCTION-NAME. I get > SVN, Bzr, Git and Hg. Anything missing? Is there a better way to check > if a VC backend supports cloning for the purposes of `package-vc`? Nevermind, I was mistaken in believing there was a vc-cvs-clone implementation... but for some reason I appear not to be able to find any reference to the implementation except in a ChangeLog file... >>> +Some packages specify \"make\" targets or other shell commands >>> +that should run prior to building the package, by including the >>> +:make or :shell-command keywords in their specification. By >>> +default, Emacs ignores these keywords when installing and >>> +upgrading VC packages, but if the value is a list of package >>> +names (symbols), the build commands will be run for those >> >> Perhaps "... as symbols"? >> > > I tried that but I find it makes the sentence less comprehensible > because it's already quite long, and the parenthesis help with that a > bit. But I'm fine with either phrasing if you feel strongly about it. No strong opinions here. >>> ;;;###autoload >>> (defun package-vc-upgrade-all () >>> - "Attempt to upgrade all installed VC packages." >>> + "Upgrade all installed VC packages." >> >> The attempt here is intentional, since upgrading can fail if it was not >> possible to successfully update the local VCS state due to merge >> conflicts. We can mention that there, and emphasise it at other places >> as a major downside of VC packages. >> > > Got it. I don't think it's that useful to include "attempt to" in the > first line, because most commands have some failure modes. Instead, > I've added a sentence about this possible failure after the first line. Fine with that. >>> (interactive (list (package-vc--read-package-desc "Upgrade VC package: " t))) >>> ;; HACK: To run `package-vc--unpack-1' after checking out the new >>> ;; revision, we insert a hook into `vc-post-command-functions', and >>> @@ -792,34 +810,45 @@ package-vc--release-rev >>> >>> ;;;###autoload >>> (defun package-vc-install (package &optional rev backend name) >>> - "Fetch a PACKAGE and set it up for using with Emacs. >>> - >>> -If PACKAGE is a string containing an URL, download the package >>> -from the repository at that URL; the function will try to guess >>> -the name of the package from the URL. This can be overridden by >>> -passing the optional argument NAME. If PACKAGE is a cons-cell, >>> -it should have the form (NAME . SPEC), where NAME is a symbol >>> -indicating the package name and SPEC is a plist as described in >>> -`package-vc-selected-packages'. Otherwise PACKAGE should be a >>> -symbol whose name is the package name, and the URL for the >>> -package will be taken from the package's metadata. >>> + "Fetch a package described by PACKAGE and set it up for use with Emacs. >> >> I wonder if we even have to mention the "use with Emacs"? What else >> could it mean? The only issue I can think of is if someone hasn't yet >> understood that package.el & co. are elisp package managers. >> > > I don't have a strong preference about this one either way. As long as the docstring remains short enough, it should be fine. >>> + >>> +PACKAGE specifies which package to install, where to find its >>> +source repository and how to build it. >>> + >>> +If PACKAGE is a symbol, install the package with that name >>> +according to metadata that package archives provide for it. This >>> +is the simplest way to call this function, but it only works if >>> +the package you want to install is listed in a package archive >>> +you have configured. >> >> AND the package archive hosts elpa-packages.eld, UNLESS a heuristic can >> be used to guess the repository. >> > > Do you think we need to include these details in the docstring? It > feels a bit too nitty gritty so I wonder if we can avoid it. Are there > common use case in which this extra information is significant? The thing is, it should be explained somewhere (and I might have just forgotten that i was explained at some point). Perhaps the manual is a better place to go into these complications. The patch looks fine to me, but considering my history with documentation I think it is best to let a few others take a look at your revision as well. Other than that, the plan is to pull out the `package-vc-default-backend' custom type and rename `package-vc-allow-side-effects', right?