unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#35331: [PATCH] Neater html table of old versions in ELPA
@ 2019-04-19 21:36 Mattias Engdegård
  2019-04-21 16:09 ` Basil L. Contovounesios
  0 siblings, 1 reply; 9+ messages in thread
From: Mattias Engdegård @ 2019-04-19 21:36 UTC (permalink / raw)
  To: 35331

[-- 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)


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-06-26 17:11 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-19 21:36 bug#35331: [PATCH] Neater html table of old versions in ELPA Mattias Engdegård
2019-04-21 16:09 ` 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

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).