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: Thu, 21 Dec 2023 19:13:21 +0100 Message-ID: <87a5q3bf0e.fsf@hyperspace> 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="36051"; mail-complaints-to="usenet@ciao.gmane.io" To: 67955@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 21 19:14: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 1rGNYq-00096N-UV for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 21 Dec 2023 19:14:21 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rGNYV-0003Zt-TQ; Thu, 21 Dec 2023 13:13:59 -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 1rGNYU-0003Yq-IN for bug-gnu-emacs@gnu.org; Thu, 21 Dec 2023 13:13:58 -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 1rGNYU-0005Gd-A3 for bug-gnu-emacs@gnu.org; Thu, 21 Dec 2023 13:13:58 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rGNYY-0007aZ-1V for bug-gnu-emacs@gnu.org; Thu, 21 Dec 2023 13:14: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: Thu, 21 Dec 2023 18:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 67955 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.170318243729151 (code B ref -1); Thu, 21 Dec 2023 18:14:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 21 Dec 2023 18:13:57 +0000 Original-Received: from localhost ([127.0.0.1]:45392 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rGNYS-0007a6-MG for submit@debbugs.gnu.org; Thu, 21 Dec 2023 13:13:57 -0500 Original-Received: from lists.gnu.org ([2001:470:142::17]:48030) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rGNYQ-0007Zp-Jp for submit@debbugs.gnu.org; Thu, 21 Dec 2023 13:13:55 -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 1rGNYE-0003Ut-6A for bug-gnu-emacs@gnu.org; Thu, 21 Dec 2023 13:13:42 -0500 Original-Received: from mout-p-101.mailbox.org ([80.241.56.151]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1rGNYA-0005F0-6P for bug-gnu-emacs@gnu.org; Thu, 21 Dec 2023 13:13:41 -0500 Original-Received: from smtp1.mailbox.org (smtp1.mailbox.org [10.196.197.1]) (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-101.mailbox.org (Postfix) with ESMTPS id 4Swz7l019zz9sVm for ; Thu, 21 Dec 2023 19:13:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1703182403; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=0ieZ/Jths5QfVumZ+8iofMN1Y3rmjuSJLdnItFD90kA=; b=jeTposH3kystTzmRLXlFH7SvZf32qksu+8bXaFUwPDgBGm1I2/paEpWbeOglF1qMe4nVzy KU6AZ2BxWoHJwDbUcXGxtfck4Iyn8fs63jHJHf+92yNbMdSXqgwD6By43an4hiFb42LFW6 SwGpgMuT9lZhQOkbBWABlfwKwQAJkUffCSxihouANqBtp1e/w4ywTdiDF2H3qiSDehnN6z caDkp+xjCUxqueVpwEnsv5vuYGIrAQo0lmnzAAr6jaHxtoiL7Z043kBGYI6oTUgOBpZfh3 f7QE/YQB8ANBsLItki+HJkCLt32lTYqqPScX4HtBk71MkOOF6OalktXwBi4owg== X-MBO-RS-META: apdd6rkws5hfu8m34ufi93mz1nwigjio X-MBO-RS-ID: 76234a625fff78ebe91 Received-SPF: pass client-ip=80.241.56.151; envelope-from=soliditsallgood@mailbox.org; helo=mout-p-101.mailbox.org X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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:276641 Archived-At: --=-=-= Content-Type: text/plain 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 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Add-use-package-vc-prefer-newest-user-option.patch >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. + ** 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) + (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 --=-=-= Content-Type: text/plain -- Tony Zorman | https://tony-zorman.com/ --=-=-=--