all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Mattias Engdegård" <mattiase@acm.org>
To: 35331@debbugs.gnu.org
Subject: bug#35331: [PATCH] Neater html table of old versions in ELPA
Date: Fri, 19 Apr 2019 23:36:29 +0200	[thread overview]
Message-ID: <17FAA112-7D1A-49F1-8156-95FED817E370@acm.org> (raw)

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

This patch sorts the "old versions" table for each ELPA package in reverse chronological order, and uses correct unit prefixes.

[-- Attachment #2: 0001-Neater-html-table-of-old-versions.patch --]
[-- Type: application/octet-stream, Size: 2374 bytes --]

From 5fecea5da0cd87f73d77a78a80496f8aaf4a62dc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mattias=20Engdeg=C3=A5rd?= <mattiase@acm.org>
Date: Fri, 19 Apr 2019 23:27:47 +0200
Subject: [PATCH] Neater html table of old versions

* admin/archive-contents.el (archive--html-bytes-format): Use IEC prefixes.
(archive--html-make-pkg): Sort old versions in newest-to-oldest order.
---
 admin/archive-contents.el | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/admin/archive-contents.el b/admin/archive-contents.el
index 30245437f..c7cac6e40 100644
--- a/admin/archive-contents.el
+++ b/admin/archive-contents.el
@@ -388,15 +388,15 @@ Rename DIR/ to PKG-VERS/, and return the descriptor."
 (defun archive--html-bytes-format (bytes) ;Aka memory-usage-format.
   (setq bytes (/ bytes 1024.0))
   (let ((units '(;; "B"
-                 "kB" "MB" "GB" "TB")))
+                 "KiB" "MiB" "GiB" "TiB")))
     (while (>= bytes 1024)
       (setq bytes (/ bytes 1024.0))
       (setq units (cdr units)))
     (cond
-     ;; ((integerp bytes) (format "%4d%s" bytes (car units)))
-     ((>= bytes 100) (format "%4.0f%s" bytes (car units)))
-     ((>= bytes 10) (format "%4.1f%s" bytes (car units)))
-     (t (format "%4.2f%s" bytes (car units))))))
+     ;; ((integerp bytes) (format "%4d %s" bytes (car units)))
+     ((>= bytes 100) (format "%4.0f %s" bytes (car units)))
+     ((>= bytes 10) (format "%4.1f %s" bytes (car units)))
+     (t (format "%4.2f %s" bytes (car units))))))
 
 (defun archive--get-prop (prop name srcdir mainsrcfile)
   (let ((kprop (intern (format ":%s" (downcase prop)))))
@@ -536,7 +536,10 @@ Rename DIR/ to PKG-VERS/, and return the descriptor."
                   "\n</pre>\n")))
       (unless (< (length files) (if (zerop (length latest)) 1 2))
         (insert (format "<h2>Old versions</h2><table>\n"))
-        (dolist (file files)
+        (dolist (file 
+                 (sort files (lambda (f1 f2)
+                               (version-list-< (version-to-list (car f2))
+                                               (version-to-list (car f1))))))
           (unless (equal (pop file) latest)
             (let ((attrs (file-attributes file)))
               (insert (format "<tr><td><a href=%S>%s</a></td><td>%s</td><td>%s</td>\n"
-- 
2.20.1 (Apple Git-117)


             reply	other threads:[~2019-04-19 21:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-19 21:36 Mattias Engdegård [this message]
2019-04-21 16:09 ` bug#35331: [PATCH] Neater html table of old versions in ELPA Basil L. Contovounesios
2019-04-22 13:17   ` Mattias Engdegård
2019-05-13 13:42     ` Mattias Engdegård
2019-05-13 14:25       ` Basil L. Contovounesios
2019-05-13 15:18         ` Mattias Engdegård
2019-05-15 20:16         ` Mattias Engdegård
2019-06-26 11:41           ` Basil L. Contovounesios
2019-06-26 17:11             ` Mattias Engdegård

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=17FAA112-7D1A-49F1-8156-95FED817E370@acm.org \
    --to=mattiase@acm.org \
    --cc=35331@debbugs.gnu.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.