unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Philip Kaludercic <philipk@posteo.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 68317@debbugs.gnu.org, joseph@breatheoutbreathe.in
Subject: bug#68317: Can't sort *Packages* buffer by version after installing with package-vc
Date: Tue, 09 Jan 2024 20:19:15 +0000	[thread overview]
Message-ID: <87plyaqmyk.fsf@posteo.net> (raw)
In-Reply-To: <83y1cynv02.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 09 Jan 2024 21:53:49 +0200")

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

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Philip Kaludercic <philipk@posteo.net>
>> Cc: Joseph Turner <joseph@breatheoutbreathe.in>,  68317@debbugs.gnu.org
>> Date: Tue, 09 Jan 2024 19:25:44 +0000
>> 
>> Eli Zaretskii <eliz@gnu.org> writes:
>> 
>> >> version-to-list: Invalid version syntax: ‘c99367ebc2f0afe0baaf2f5e5ca1ad9d62ba6e21’ (must start with a number)
>> >
>> > Sounds like package-vc-commit should be modified to produce a valid
>> > version string (which SHA1 is not)?  Philip?
>> 
>> We can also adjust `package-menu--version-predicate' to handle
>> non-version numbers, which I think would be more robust.
>
> Fine by me, but can this be done safely enough for emacs-29?

This would be a simple implementation, I don't know if it is safe enough
for you:


[-- Attachment #2: Type: text/plain, Size: 789 bytes --]

diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index fa9903e13e3..f97c2cff783 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -4070,8 +4070,8 @@ package-menu-execute
 (defun package-menu--version-predicate (A B)
   "Predicate to sort \"*Packages*\" buffer by the version column.
 This is used for `tabulated-list-format' in `package-menu-mode'."
-  (let ((vA (or (version-to-list (aref (cadr A) 1)) '(0)))
-        (vB (or (version-to-list (aref (cadr B) 1)) '(0))))
+  (let ((vA (or (ignore-error error (version-to-list (aref (cadr A) 1))) '(0)))
+        (vB (or (ignore-error error (version-to-list (aref (cadr B) 1))) '(0))))
     (if (version-list-= vA vB)
         (package-menu--name-predicate A B)
       (version-list-< vA vB))))

  reply	other threads:[~2024-01-09 20:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-08  8:59 bug#68317: Can't sort *Packages* buffer by version after installing with package-vc Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-08 13:03 ` Eli Zaretskii
2024-01-09 19:25   ` Philip Kaludercic
2024-01-09 19:53     ` Eli Zaretskii
2024-01-09 20:19       ` Philip Kaludercic [this message]
2024-01-10  3:27         ` Eli Zaretskii
2024-01-10  5:16           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-10  8:28             ` Philip Kaludercic
2024-01-10  9:06               ` Stefan Kangas
2024-01-10 19:10                 ` Philip Kaludercic
2024-01-10 13:13             ` Eli Zaretskii

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87plyaqmyk.fsf@posteo.net \
    --to=philipk@posteo.net \
    --cc=68317@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=joseph@breatheoutbreathe.in \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).