all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Mattias Engdegård" <mattiase@acm.org>
To: "Basil L. Contovounesios" <contovob@tcd.ie>
Cc: 35331@debbugs.gnu.org
Subject: bug#35331: [PATCH] Neater html table of old versions in ELPA
Date: Mon, 13 May 2019 15:42:35 +0200	[thread overview]
Message-ID: <299F3CF6-3DA6-4B95-BFEB-B462875FBFBA@acm.org> (raw)
In-Reply-To: <491EC399-F6F1-4512-8926-69BA056B73A1@acm.org>

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

> 21 apr. 2019 kl. 18.09 skrev Basil L. Contovounesios <contovob@tcd.ie>:
>> 
>> (dolist (file (sort files (lambda (f1 f2)
>>                             (version< (car f2) (car f1)))))
>>   ...)

Revised patch.


[-- Attachment #2: 0001-Neater-HTML-table-of-old-package-versions-bug-35331.patch --]
[-- Type: application/octet-stream, Size: 2219 bytes --]

From f9a3ca2c0e76b93394bf20e7dba9912376da8f4e 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 package versions (bug#35331)

* 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 | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/admin/archive-contents.el b/admin/archive-contents.el
index de444e381..c4c2e5af1 100644
--- a/admin/archive-contents.el
+++ b/admin/archive-contents.el
@@ -387,16 +387,14 @@ 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")))
+  (let ((units '("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))))))
+     ((>= bytes 100) (format "%4.0f&nbsp;%s" bytes (car units)))
+     ((>= bytes 10) (format "%4.1f&nbsp;%s" bytes (car units)))
+     (t (format "%4.2f&nbsp;%s" bytes (car units))))))
 
 (defun archive--get-prop (prop name srcdir mainsrcfile)
   (let ((kprop (intern (format ":%s" (downcase prop)))))
@@ -536,7 +534,8 @@ 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< (car f2) (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-05-13 13:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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=299F3CF6-3DA6-4B95-BFEB-B462875FBFBA@acm.org \
    --to=mattiase@acm.org \
    --cc=35331@debbugs.gnu.org \
    --cc=contovob@tcd.ie \
    /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.