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#60418: [PATCH] Add :vc keyword to use-package Date: Sun, 23 Apr 2023 12:35:29 +0000 Message-ID: <87bkje93ou.fsf@posteo.net> References: <87zgb6uk2r.fsf@hyperspace> <87tu0tl1s4.fsf@hyperspace> <87a5zt2emd.fsf@betli.tmit.bme.hu> <87fs9l9bim.fsf@posteo.net> <87y1n3zsro.fsf@posteo.net> <871qku220f.fsf@betli.tmit.bme.hu> <874jpq920b.fsf@posteo.net> <87cz4ezpwi.fsf@betli.tmit.bme.hu> <87h6tlinft.fsf@hyperspace> <87r0spa712.fsf@posteo.net> <87edopiif5.fsf@hyperspace> <87wn2bzvcp.fsf@hyperspace> <835y9vbyfr.fsf@gnu.org> <87mt36uwl8.fsf@hyperspace> <83ttxd8k1z.fsf@gnu.org> <87v8hrn56l.fsf@hyperspace> <87cz3w2lvb.fsf@posteo.net> <87jzy3ku6u.fsf@hyperspace> 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="20348"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , felician.nemeth@gmail.com, 60418@debbugs.gnu.org, stefankangas@gmail.com To: Tony Zorman Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 23 14:36:31 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 1pqYxD-00054l-7Q for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 23 Apr 2023 14:36:31 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqYwm-0005IO-F4; Sun, 23 Apr 2023 08:36: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 1pqYwk-0005I9-Ub for bug-gnu-emacs@gnu.org; Sun, 23 Apr 2023 08:36:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pqYwk-0003wx-MQ for bug-gnu-emacs@gnu.org; Sun, 23 Apr 2023 08:36:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pqYwk-0006bq-6q for bug-gnu-emacs@gnu.org; Sun, 23 Apr 2023 08:36: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, 23 Apr 2023 12:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60418 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 60418-submit@debbugs.gnu.org id=B60418.168225331125343 (code B ref 60418); Sun, 23 Apr 2023 12:36:02 +0000 Original-Received: (at 60418) by debbugs.gnu.org; 23 Apr 2023 12:35:11 +0000 Original-Received: from localhost ([127.0.0.1]:44818 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pqYvu-0006ag-Az for submit@debbugs.gnu.org; Sun, 23 Apr 2023 08:35:10 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:44335) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pqYvn-0006a0-Pv for 60418@debbugs.gnu.org; Sun, 23 Apr 2023 08:35:08 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id F10AC24015A for <60418@debbugs.gnu.org>; Sun, 23 Apr 2023 14:34:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1682253298; bh=gm+JWRwdOvyhnLJbvHKmiNxitFwPysEcR/p0E1KarGc=; h=From:To:Cc:Subject:Autocrypt:Date:From; b=fvHrQR+IXsxz98cuyHuZdjqdNh9w7q72tmGx0AM0EVgOlM18ddrIysU8XDEqBKplx QoFCSwjRUiPs/jIOhqU1LckS2GZp95cypC7E4pwFbK+9yc+LxmCjx5O/2A/KJ1u0a2 K11DuHKvpMCebF00zufxPGfYevXUNdhyDegyheMMBVMHSjvlF5/hCcpuuLUIJTlvHE itori2w7cqGRyKnXegAQ1MJeqsw/A+xiaE57B6FgbQsh4lmKt4XpgO1RBHLwP+mp4W D4eCxgh8evnUjRQ0bB+HWv3mFW3uhDof+7voAetfWdf2tkrrB3ADBXv1PppzZd8+2m cQ6pjycDkFRaQ== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Q474x1Lmlz6twp; Sun, 23 Apr 2023 14:34:57 +0200 (CEST) In-Reply-To: <87jzy3ku6u.fsf@hyperspace> (Tony Zorman's message of "Sun, 23 Apr 2023 08:07:37 +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:260508 Archived-At: Tony Zorman writes: > On Sat, Apr 22 2023 11:32, Philip Kaludercic wrote: >> (Sorry for all the back and forth, I hope you understand that this is >> just to get stuff right and not for my own sake of being pedantic. If >> you don't have the time, I can also make the changes I'd just like to >> hear your opinions.) > > No, I totally get it. Getting this stuff right the first time is much > easier than going back and trying to fix it afterwards. OK, great. I just didn't want to make this seem like a ritual GNU thing ^^. > I agree with most of your suggestions, so I'm just going to answer those > where I have questions/comments. > >>> +(ert-deftest use-package-test/:vc-1 () >>> + (match-expansion >>> + (use-package foo :vc (:url "bar")) >>> + '(use-package-vc-install '(foo (:url "bar") :last-release) nil))) >>> + >>> +(ert-deftest use-package-test/:vc-2 () >>> + (match-expansion >>> + (use-package foo >>> + :vc (baz . (:url "baz" :vc-backend "Git" >>> + :main-file qux.el :rev "rev-string"))) >>> + `(use-package-vc-install '(baz >>> + (:url "baz" :vc-backend Git :main-file "= qux.el") >>> + "rev-string") >>> + nil))) >>> + >>> +(ert-deftest use-package-test/:vc-3 () >>> + (match-expansion >>> + (use-package foo :vc (bar . "baz")) >>> + `(use-package-vc-install '(bar "baz") nil))) >>> + >>> +(ert-deftest use-package-test/:vc-4 () >>> + (match-expansion >>> + (use-package foo :vc (bar . (:url "baz" :rev :head))) >>> + '(use-package-vc-install '(bar (:url "baz") nil) nil))) >>> + >>> +(ert-deftest use-package-test/:vc-5 () >>> + (let ((load-path? '(pred (apply-partially >>> + #'string=3D >>> + (expand-file-name "bar" user-emacs-directo= ry))))) >>> + (match-expansion >>> + (use-package foo :vc other-name :load-path "bar") >>> + `(progn (eval-and-compile >>> + (add-to-list 'load-path ,load-path?)) >>> + (use-package-vc-install '(other-name) ,load-path?))))) >>> + >>> +(ert-deftest use-package-test-normalize/:vc () >>> + (should (equal '(foo "version-string") >>> + (use-package-normalize/:vc 'foo :vc '("version-string= ")))) >>> + (should (equal '(bar "version-string") >>> + (use-package-normalize/:vc 'foo :vc '((bar . "version= -string"))))) >>> + (should (equal '(foo (:url "bar") "baz") >>> + (use-package-normalize/:vc 'foo :vc '((:url "bar" :re= v "baz"))))) >>> + (should (equal '(foo) >>> + (use-package-normalize/:vc 'foo :vc '(t)))) >>> + (should (equal '(foo) >>> + (use-package-normalize/:vc 'foo :vc nil))) >>> + (should (equal '(bar) >>> + (use-package-normalize/:vc 'foo :vc '(bar))))) >> >> On my machine, these tests appear to fail? Also, it would probably be >> useful to document them (at leat the ...-1 to ...-5 ones) so that a >> failure can be more easily understood. > > They don't fail for me=E2=80=94maybe I'm running the tests wrong? So far,= I've > done so interactively by evaluating the whole buffer and then running > `M-x ert'. The -1=E2=80=A6-5 tests just test the macro expansion, so e.g. > > (ert-deftest use-package-test/:vc-1 () > (match-expansion > (use-package foo :vc (:url "bar")) > '(use-package-vc-install '(foo (:url "bar") :last-release) nil))) > > would test if the first argument to `match-expansion' actually expands > into the second one or not (which I guess explains why the error > messages are a bit hard to understand).=20=20=20 But that isn't the case, or am I mistaken? The use-package form expands to a lot mroe than just (use-package-vc-install ...)? >>> It accepts the same arguments as >>> +@code{package-vc-selected-packages} (@pxref{Specifying Package >>> +Sources,,, emacs, GNU Emacs Manual}), except that a name need not >> >> This link does not appear to work. I believe you can only link to a >> node, and this is just a section. Also, referring to the variable has >> become an unnecessary redirection, since the variable documentation now >> refers to the manual. > > Oh, I see. I have to admit that info links are still a bit of a mystery > to me; sorry. So should I just link to the closest node, which would be > "Fetching Package Sources" again, here? You should be able to test this yourself by compiling Emacs and then opening the manual to see how it was compiled. >>> +For example, >>> + >>> +@lisp >>> +@group >>> +(use-package foo >>> + :vc (:url "https://bar.com/foo" :rev :head)) >>> +@end group >>> +@end lisp >> >> I think it would make sense to use the same examples as the Emacs manual >> has been updated to use (BBDB) so that users can directly try out the >> code. > > Sorry, I'm not sure I follow: the same examples as what exactly? Or do > you just mean an actual package that users could try out when executing > this code, instead of a dummy one? Sorry, I should have been more explicit here. I am referring to the changes in 6e6e8b5c974202d2691c1971be66c1cb3788b7c1, where we moved some of the documentation from package-vc.el to the Emacs manual. Part of the change included the addition of some package specification examples, that I think would be a good fit here as well. >>> +would try -- by invoking @code{package-vc-install} -- to install the >>> +latest commit of the package @code{foo} from the specified remote. >>> + >>> +This can also be used for local packages, by combining it with the >>> +@code{:load-path} (@pxref{Load path}) keyword: >>> + >>> +@lisp >>> +@group >>> +(use-package foo >>> + :vc t >>> + :load-path "/path/to/foo/) >>> +@end group >>> +@end lisp >>> + >>> +The above dispatches to @code{package-vc-install-from-checkout} >>> +(@pxref{Fetching Package Sources,,, emacs, GNU Emacs Manual}). >> >> Does this reference here really help? > > Perhaps not. I don't have any strong opinions about this, so if you > prefer I can remove this. I think it would read better.