all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tony Zorman via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Philip Kaludercic <philipk@posteo.net>
Cc: 67955@debbugs.gnu.org
Subject: bug#67955: [PATCH] Add use-package-vc-prefer-newest user option
Date: Mon, 15 Jan 2024 21:16:19 +0100	[thread overview]
Message-ID: <87h6jecpyk.fsf@hyperspace> (raw)
In-Reply-To: <87fryzxecx.fsf@posteo.net>

[-- Attachment #1: Type: text/plain, Size: 1943 bytes --]

On Mon, Jan 15 2024 07:09, Philip Kaludercic wrote:
> Tony Zorman <soliditsallgood@mailbox.org> writes:
>
>> On Fri, Jan 12 2024 16:32, Philip Kaludercic wrote:
>>> Tony Zorman <soliditsallgood@mailbox.org> 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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-use-package-vc-prefer-newest-user-option.patch --]
[-- Type: text/x-patch, Size: 3853 bytes --]

From 8f207a132f669cf2486ecf0e12ade864a9a6912c Mon Sep 17 00:00:00 2001
From: Tony Zorman <soliditsallgood@mailbox.org>
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


[-- Attachment #3: Type: text/plain, Size: 44 bytes --]


-- 
Tony Zorman | https://tony-zorman.com/

  reply	other threads:[~2024-01-15 20:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-21 18:13 bug#67955: [PATCH] Add use-package-vc-prefer-newest user option Tony Zorman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-11 21:01 ` Stefan Kangas
2024-01-12 16:32 ` Philip Kaludercic
2024-01-13 16:51   ` Tony Zorman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-15  7:09     ` Philip Kaludercic
2024-01-15 20:16       ` Tony Zorman via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-01-16  7:33         ` Philip Kaludercic
2024-03-30  8:15           ` Tony Zorman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-30 13:42             ` Philip Kaludercic
2024-03-30 14:27               ` Tony Zorman via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h6jecpyk.fsf@hyperspace \
    --to=bug-gnu-emacs@gnu.org \
    --cc=67955@debbugs.gnu.org \
    --cc=philipk@posteo.net \
    --cc=soliditsallgood@mailbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.