From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tony Zorman via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#60418: [PATCH] Add :vc keyword to use-package Date: Sun, 23 Apr 2023 08:07:37 +0200 Message-ID: <87jzy3ku6u.fsf@hyperspace> 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> Reply-To: Tony Zorman 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="4494"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , felician.nemeth@gmail.com, 60418@debbugs.gnu.org, stefankangas@gmail.com To: Philip Kaludercic Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 23 08:08:33 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 1pqStl-0000xv-4P for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 23 Apr 2023 08:08:33 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqStO-0004R7-3n; Sun, 23 Apr 2023 02:08:11 -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 1pqStG-0004Ql-9D for bug-gnu-emacs@gnu.org; Sun, 23 Apr 2023 02:08: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 1pqStG-0003pz-0u for bug-gnu-emacs@gnu.org; Sun, 23 Apr 2023 02:08:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pqStF-0001Wt-Kz for bug-gnu-emacs@gnu.org; Sun, 23 Apr 2023 02:08:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Tony Zorman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 23 Apr 2023 06:08:01 +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.16822300705863 (code B ref 60418); Sun, 23 Apr 2023 06:08:01 +0000 Original-Received: (at 60418) by debbugs.gnu.org; 23 Apr 2023 06:07:50 +0000 Original-Received: from localhost ([127.0.0.1]:44509 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pqSt4-0001WV-8w for submit@debbugs.gnu.org; Sun, 23 Apr 2023 02:07:50 -0400 Original-Received: from mout-p-103.mailbox.org ([80.241.56.161]:58462) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pqSt1-0001WF-Qg for 60418@debbugs.gnu.org; Sun, 23 Apr 2023 02:07:48 -0400 Original-Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-103.mailbox.org (Postfix) with ESMTPS id 4Q3yV374qgz9sQc; Sun, 23 Apr 2023 08:07:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1682230060; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=d1fUUB7bu2Qg9g3jXwyKl+ddDawtqpQpGqyJ4qVTyQQ=; b=DIwDojfwpVKDAmnr6QkjVlXRg11TVISRWLiqw99K8gSwgF/hbIE9d+EW284PA4xKaBYfmz N7OtXPLRAFuPgd82gxsjNCAcXAZ4wSGnhw4+Sy2+2U7PqYPTvOHFS+9CmBZHW+Q7ZO8xgH Y3jYMg1X7S9tXsJGWeWL0Cjgyv86QYPCZOR1WTFUoZ7I+SzTJAj48jvxf0oPRcjPMQBvo0 x/UVdR55YH6S6Yt3wp2BXwFWDQJt+qxZa5rRpsoUQjJmjDN2FzPBIaLhMt7O25hZbnAx49 8zlhN0Z3DeU45VsFVdH9Qu/4tzg98QKBtOisorcAwXqUDgspECxw5y1EI56YtQ== In-Reply-To: <87cz3w2lvb.fsf@posteo.net> X-MBO-RS-ID: 77b73d2efa3ac442ed9 X-MBO-RS-META: 9fwwdc49gghjfofd68cpg87nr7ex9hzk 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:260494 Archived-At: 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. 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 "q= ux.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-director= y))))) >> + (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" :rev= "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 >> 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? >> +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? >> +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. --=20 Tony Zorman | https://tony-zorman.com/