emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/calibre 533c68f55f 27/76: Do right alignment correctly


From: ELPA Syncer
Subject: [elpa] externals/calibre 533c68f55f 27/76: Do right alignment correctly
Date: Thu, 18 May 2023 09:57:43 -0400 (EDT)

branch: externals/calibre
commit 533c68f55f170b8b7aa0ba1fe22b4cc50f0d72bf
Author: Kjartan Óli Ágústsson <kjartanoli@disroot.org>
Commit: Kjartan Óli Ágústsson <kjartanoli@disroot.org>

    Do right alignment correctly
    
    * calibre-db.el (calibre-book--print-info): Simply call int-to-string
    instead of using format.
    Don't get the now useless width attribute of a column.
    * calibre-library.el (calibre-library--header-format): Add docstring.
    Set right-align property on id and series-index.
    Allow sorting by series-index.
---
 calibre-db.el      |  5 ++---
 calibre-library.el | 16 +++++++++++-----
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/calibre-db.el b/calibre-db.el
index aa2fede8c3..848ecb02dc 100644
--- a/calibre-db.el
+++ b/calibre-db.el
@@ -158,10 +158,9 @@ BOOK is a `calibre-book'."
   (list book
         (with-slots (id title authors publishers series series-index tags 
formats) book
           (vconcat (mapcar (lambda (x)
-                             (let ((column (car x))
-                                   (width (cdr x)))
+                             (let ((column (car x)))
                                (cl-case column
-                                 (id (format (format "%%%ds" width) id))
+                                 (id (int-to-string id))
                                  (title title)
                                  (authors (string-join authors ", "))
                                  (publishers (string-join publishers ", "))
diff --git a/calibre-library.el b/calibre-library.el
index 5c4e9f4077..71da2f5f2c 100644
--- a/calibre-library.el
+++ b/calibre-library.el
@@ -99,6 +99,9 @@ ARGS should be a list of strings.  SENTINEL is a process 
sentinel to install."
   (find-file (calibre-book--file book (calibre-book--pick-format book))))
 
 (defun calibre-library--header-format ()
+  "Create the header for the Library buffer.
+Return a vector suitable as the value of `tabulated-list-format'
+with values determined by `calibre-library-columns'."
   (vconcat
    (mapcar (lambda (x)
              (let ((column (car x))
@@ -106,13 +109,16 @@ ARGS should be a list of strings.  SENTINEL is a process 
sentinel to install."
                (cl-case column
                  (id `("ID" ,width (lambda (a b)
                                      (< (calibre-book-id (car a))
-                                        (calibre-book-id (car b))))))
-                 (title `("Title" ,width))
-                 (authors `("Author(s)" ,width))
-                 (publishers `("Publisher(s)" ,width))
+                                        (calibre-book-id (car b))))
+                       :right-align t))
+                 (title `("Title" ,width t))
+                 (authors `("Author(s)" ,width t))
+                 (publishers `("Publisher(s)" ,width t))
                  (series `("Series" ,width (lambda (a b)
                                              (calibre-book-sort-by-series (car 
a) (car b)))))
-                 (series-index `("#" ,width))
+                 (series-index `("#" ,width (lambda (a b)
+                                              (calibre-book-sort-by-series 
(car a) (car b)))
+                                 :right-align t))
                  (tags `("Tags" ,width))
                  (formats `("Formats" ,width)))))
            calibre-library-columns)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]