bug#35331: [PATCH] Neater html table of old versions in ELPA

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

bug#35331: [PATCH] Neater html table of old versions in ELPA

Mattias Engdegård-2
This patch sorts the "old versions" table for each ELPA package in reverse chronological order, and uses correct unit prefixes.

0001-Neater-html-table-of-old-versions.patch (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

bug#35331: [PATCH] Neater html table of old versions in ELPA

Basil L. Contovounesios
Mattias Engdegård <[hidden email]> writes:

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

AKA

  (dolist (file (sort files (lambda (f1 f2)
                              (version< (car f2) (car f1)))))
    ...)

Thanks,

--
Basil



Reply | Threaded
Open this post in threaded view
|

bug#35331: [PATCH] Neater html table of old versions in ELPA

Mattias Engdegård-2
21 apr. 2019 kl. 18.09 skrev Basil L. Contovounesios <[hidden email]>:
>
>  (dolist (file (sort files (lambda (f1 f2)
>                              (version< (car f2) (car f1)))))
>    ...)

Thank you, I obviously didn't do my homework properly.
Please consider the patch as if it had that improvement.




Reply | Threaded
Open this post in threaded view
|

bug#35331: [PATCH] Neater html table of old versions in ELPA

Mattias Engdegård-2
> 21 apr. 2019 kl. 18.09 skrev Basil L. Contovounesios <[hidden email]>:
>>
>> (dolist (file (sort files (lambda (f1 f2)
>>                             (version< (car f2) (car f1)))))
>>   ...)

Revised patch.


0001-Neater-HTML-table-of-old-package-versions-bug-35331.patch (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

bug#35331: [PATCH] Neater html table of old versions in ELPA

Basil L. Contovounesios
Mattias Engdegård <[hidden email]> writes:

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

Is it possible to reuse file-size-human-readable here?

Does the no-break space have to be a HTML entity,
or can it be Unicode ?\u00A0?

Thanks,

--
Basil



Reply | Threaded
Open this post in threaded view
|

bug#35331: [PATCH] Neater html table of old versions in ELPA

Mattias Engdegård-2
13 maj 2019 kl. 16.25 skrev Basil L. Contovounesios <[hidden email]>:
>
> Is it possible to reuse file-size-human-readable here?

That either requires modifying that function to (optionally) put a hard space between the number and unit, or post-processing its return value to achieve the same effect. The former is obviously the heroic way to go. Patch attached!

> Does the no-break space have to be a HTML entity,
> or can it be Unicode ?\u00A0?

Probably either would do, but since we don't control the web browser interpreting it, I went with what I thought was the safer option.


0001-Optional-space-in-file-size-human-readable.patch (8K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

bug#35331: [PATCH] Neater html table of old versions in ELPA

Mattias Engdegård-2
In reply to this post by Basil L. Contovounesios
13 maj 2019 kl. 16.25 skrev Basil L. Contovounesios <[hidden email]>:
>
> Is it possible to reuse file-size-human-readable here?

There turned out to be more things to fix in that function, so I opened a new bug for it (bug#35756).

I'm not sure what Emacs version elpa.gnu.org is using, so it is perhaps unwise to depend on a very recent addition to Emacs master.