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#67955: [PATCH] Add use-package-vc-prefer-newest user option Date: Mon, 15 Jan 2024 21:16:19 +0100 Message-ID: <87h6jecpyk.fsf@hyperspace> References: <87a5q3bf0e.fsf@hyperspace> <87a5paldfy.fsf@posteo.net> <878r4t18in.fsf@hyperspace> <87fryzxecx.fsf@posteo.net> Reply-To: Tony Zorman 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="8376"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 67955@debbugs.gnu.org To: Philip Kaludercic Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jan 15 21:17:50 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 1rPTP2-0001qY-5g for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 15 Jan 2024 21:17:48 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rPTON-00085k-2e; Mon, 15 Jan 2024 15:17:07 -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 1rPTOI-000859-Pd for bug-gnu-emacs@gnu.org; Mon, 15 Jan 2024 15:17:03 -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 1rPTOI-000829-HO for bug-gnu-emacs@gnu.org; Mon, 15 Jan 2024 15:17:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rPTOI-0001ZX-A6 for bug-gnu-emacs@gnu.org; Mon, 15 Jan 2024 15:17:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Tony Zorman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 15 Jan 2024 20:17:02 +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.17053497965404 (code B ref 67955); Mon, 15 Jan 2024 20:17:02 +0000 Original-Received: (at 67955) by debbugs.gnu.org; 15 Jan 2024 20:16:36 +0000 Original-Received: from localhost ([127.0.0.1]:47078 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rPTNr-0001OR-QH for submit@debbugs.gnu.org; Mon, 15 Jan 2024 15:16:36 -0500 Original-Received: from mout-p-202.mailbox.org ([2001:67c:2050:0:465::202]:46798) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rPTNp-0001Gm-1J for 67955@debbugs.gnu.org; Mon, 15 Jan 2024 15:16:34 -0500 Original-Received: from smtp2.mailbox.org (smtp2.mailbox.org [10.196.197.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4TDNh700Lpz9spK; Mon, 15 Jan 2024 21:16:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1705349783; 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: in-reply-to:in-reply-to:references:references; bh=XLc2y8zJ0m9wcfTOsziv17tUJttHt0myMEmZPy6gdcI=; b=yecK8CYbkpXnGzFzhdJ089Q+hhciFSgptj7haGO6TTHavcEzWUatStPrgKrKYmDo45zgMF BfDPsVTVmlmslWwStOUfRqOtcj3soF4yJRayhB/MI2heI0StdJ+A3Y8a5XoduSxCVOxDOm dPlR9KRHUmIs7CWW85zxxxoyMngQhwYoIj2CHE00Gzwz6JTum7AQ0WbahzHXQhk9a5jxJI 0hmayOkX4q3vrfMNCTlOunwBWVe1j9/gV1rfrCgZw8XQ5ilTvRQDm4yMMkvPjJmx/MjGVT dnyGqDf3Q/dZxxOLEJP8rBV3GG//7ZiUYyjNcAxU7e0yMQKK5LbHF45209UrzA== In-Reply-To: <87fryzxecx.fsf@posteo.net> X-MBO-RS-META: 5tmt66n3kfxdr5rcfr6csch64dwsii8t X-MBO-RS-ID: 70bf9c8ece4d7a15e03 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:278300 Archived-At: --=-=-= Content-Type: text/plain On Mon, Jan 15 2024 07:09, Philip Kaludercic wrote: > Tony Zorman writes: > >> On Fri, Jan 12 2024 16:32, Philip Kaludercic wrote: >>> Tony Zorman writes: >>>> ++++ >>>> +*** 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. >> >> No strong opinions here, I can change this to whatever people prefer. > > Let us leave it then, because I don't know what would be better either. > >>>> +(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. >> >> Do you mean something like how this goes against what [Non]GNU ELPA do, >> and could lead to increased instability (as we are, by definition, >> tracking a moving target)? I guess a lot of users will be familiar with >> this style of development from MELPA, so I'm not sure any additional >> warning here is necessary. Again, I don't feel very strongly about this, >> so if you want this changed I'll think of something. > > Yes, that was what I meant. I don't want to assume that users are > familiar with MELPA, so a brief comment to that effect should suffice. > Thanks! Okay, I've attached a new version of the patch. Thanks for the review! T --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Add-use-package-vc-prefer-newest-user-option.patch >From 8f207a132f669cf2486ecf0e12ade864a9a6912c 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 | 22 +++++++++++++++++++--- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/doc/misc/use-package.texi b/doc/misc/use-package.texi index d834e1be754..c2b6404b68b 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 03b8c3b517a..f9e01b14f92 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1035,6 +1035,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. + ** 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 d9343e14839..ba2e93c97e9 100644 --- a/lisp/use-package/use-package-core.el +++ b/lisp/use-package/use-package-core.el @@ -346,6 +346,20 @@ use-package-compute-statistics :type 'boolean :group 'use-package) +(defcustom use-package-vc-prefer-newest nil + "Prefer the newest commit over the latest release. +By default, much like GNU ELPA and NonGNU ELPA, the `:vc' keyword +tracks the latest stable release of a package. If this option is +non-nil, the latest commit is preferred instead. This has the +same effect as specifying `:rev :newest' in every invocation of +`:vc'. + +Note that always tracking a package's latest commit might lead to +stability issues." + :type 'boolean + :version "30.1" + :group 'use-package) + (defvar use-package-statistics (make-hash-table)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -1649,9 +1663,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.43.0 --=-=-= Content-Type: text/plain -- Tony Zorman | https://tony-zorman.com/ --=-=-=--