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#67955: [PATCH] Add use-package-vc-prefer-newest user option Date: Fri, 12 Jan 2024 16:32:49 +0000 Message-ID: <87a5paldfy.fsf@posteo.net> References: <87a5q3bf0e.fsf@hyperspace> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11279"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 67955@debbugs.gnu.org To: Tony Zorman Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jan 12 17:33:26 2024 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 1rOKTF-0002hb-Pl for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 12 Jan 2024 17:33:26 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rOKSy-0002gS-FM; Fri, 12 Jan 2024 11:33:09 -0500 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 1rOKSw-0002c0-3l for bug-gnu-emacs@gnu.org; Fri, 12 Jan 2024 11:33:06 -0500 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 1rOKSu-0002cq-0b for bug-gnu-emacs@gnu.org; Fri, 12 Jan 2024 11:33:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rOKSs-0000gl-08 for bug-gnu-emacs@gnu.org; Fri, 12 Jan 2024 11:33:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 12 Jan 2024 16:33:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67955 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 67955-submit@debbugs.gnu.org id=B67955.17050771792637 (code B ref 67955); Fri, 12 Jan 2024 16:33:01 +0000 Original-Received: (at 67955) by debbugs.gnu.org; 12 Jan 2024 16:32:59 +0000 Original-Received: from localhost ([127.0.0.1]:37466 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rOKSo-0000gT-R8 for submit@debbugs.gnu.org; Fri, 12 Jan 2024 11:32:59 -0500 Original-Received: from mout01.posteo.de ([185.67.36.65]:39731) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rOKSk-0000fx-EB for 67955@debbugs.gnu.org; Fri, 12 Jan 2024 11:32:57 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 3FC03240027 for <67955@debbugs.gnu.org>; Fri, 12 Jan 2024 17:32:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1705077170; bh=GW1+kCmMkidknIcCtZksfk9Pj/C5HhPtgM6R6HCRml0=; h=From:To:Cc:Subject:Autocrypt:OpenPGP:Date:Message-ID:MIME-Version: From; b=fZ/fEjzmP4Kuje9D0tXEjFoam5a5Igvm4RBehLDXaIwaNXTUTEqFp/nzYaIx2Wk1t am82oI/ZrELyYWU+ifo9LHYFT4E9/qUEJD0QGyHnmAicIcl24evZSM3CG7a1MYa0jY A6yyL8fUjBJNJfbhIAFiRrlpWHw8ln/1r9OnsdbhyhE2IqFKXl09JUtl4fJFT3wyF7 phccp4k49tB6SHgZOkTwRndhTnd+XouQkYyvsrYsIKhJ71QruuCzvFZ+BF3v3P5ZEP T9V6RFB85MSx06IvAlSu5IgHn4YSUWwsl/8Vvz8nvNJdRYcRL02J4F5HpcAeC0Z1Fb pHO6IxWuaLoEw== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4TBRsY5HBGz6tsf; Fri, 12 Jan 2024 17:32:49 +0100 (CET) In-Reply-To: <87a5q3bf0e.fsf@hyperspace> (Tony Zorman's message of "Thu, 21 Dec 2023 19:13:21 +0100") 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 OpenPGP: id=7126E1DE2F0CE35C770BED01F2C3CC513DB89F66; url="https://keys.openpgp.org/vks/v1/by-fingerprint/7126E1DE2F0CE35C770BED01F2C3CC513DB89F66"; preference=signencrypt 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:278052 Archived-At: Tony Zorman writes: > Hi, > > as stated in the subject, the attached patch adds a > 'use-package-vc-prefer-newest' user option. When non-nil, packages > installed with use-package's :vc keyword will default to the latest > commit, instead of the latest release. > > Thanks > Tony > >>>From c7271b7f50f7628757bd9d7070a4b4d8a5f05bb4 Mon Sep 17 00:00:00 2001 > From: Tony Zorman > Date: Thu, 21 Dec 2023 17:51:09 +0100 > Subject: [PATCH] Add use-package-vc-prefer-newest user option > > * lisp/use-package/use-package-core.el (use-package-vc-prefer-newest): > User option to prefer the latest commit (as opposed to the latest > release) of a package. > (use-package-normalize--vc-arg): Check for > use-package-vc-prefer-newest. > > * doc/misc/use-package.texi (Install package): Document > use-package-vc-prefer-newest. > > * etc/NEWS: Document use-package-vc-prefer-newest. > --- > doc/misc/use-package.texi | 8 ++++++-- > etc/NEWS | 5 +++++ > lisp/use-package/use-package-core.el | 17 ++++++++++++++--- > 3 files changed, 25 insertions(+), 5 deletions(-) > > diff --git a/doc/misc/use-package.texi b/doc/misc/use-package.texi > index 37ed50ab2b1..ea0504b3deb 100644 > --- a/doc/misc/use-package.texi > +++ b/doc/misc/use-package.texi > @@ -1639,8 +1639,12 @@ Install package > 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: > +@vindex use-package-vc-prefer-newest > +Alternatively, the @code{use-package-vc-prefer-newest} user option > +exists to always prefer the latest commit. > + > +The @code{:vc} keyword can also be used for local packages, by > +combining it with @code{:load-path} (@pxref{Load path}): > > @example > @group > diff --git a/etc/NEWS b/etc/NEWS > index b39dd5f5ab6..100c6b78291 100644 > --- a/etc/NEWS > +++ b/etc/NEWS > @@ -971,6 +971,11 @@ interactive Python interpreter specified by 'python-interpreter'. > *** New ':vc' keyword. > This keyword enables the user to install packages using 'package-vc'. > > ++++ > +*** New user option 'use-package-vc-prefer-newest'. > +This allows the user to always install the newest commit of a package > +when using the ':vc' keyword. I wonder if this should be merged into the previous point, or if it is even worth mentioning, since it is part of a few feature that has been added in Emacs 30. > + > ** Gnus > > *** The 'nnweb-type' option 'gmane' has been removed. > diff --git a/lisp/use-package/use-package-core.el b/lisp/use-package/use-package-core.el > index 2897b60b2f9..cb3d73ee284 100644 > --- a/lisp/use-package/use-package-core.el > +++ b/lisp/use-package/use-package-core.el > @@ -346,6 +346,15 @@ use-package-compute-statistics > :type 'boolean > :group 'use-package) > > +(defcustom use-package-vc-prefer-newest nil > + "Prefer the newest commit over the latest release. > +If non-nil, the `:vc' keyword will prefer the latest commit of a > +package instead of the latest stable release. This has the same > +effect as specifying `:rev :newest' in every invocation of `:vc'." > + :type 'boolean > + :version "30.1" > + :group 'use-package) I would briefly mention what the issue could be when setting this option to non-nil, just to give some context as to why it is disabled by default. > + > (defvar use-package-statistics (make-hash-table)) > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > @@ -1649,9 +1658,11 @@ use-package-normalize--vc-arg > (if (and s (stringp s)) (intern s) s)) > (normalize (k v) > (pcase k > - (:rev (cond ((or (eq v :last-release) (not v)) :last-release) > - ((eq v :newest) nil) > - (t (ensure-string v)))) > + (:rev (pcase v > + ('nil (if use-package-vc-prefer-newest nil :last-release)) > + (:last-release :last-release) > + (:newest nil) > + (_ (ensure-string v)))) > (:vc-backend (ensure-symbol v)) > (_ (ensure-string v))))) > (pcase-let ((valid-kws '(:url :branch :lisp-dir :main-file :vc-backend :rev)) > -- > 2.42.0