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

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

[elpa] externals/calibre 8c791fb915 05/76: Add missing sort by series fu


From: ELPA Syncer
Subject: [elpa] externals/calibre 8c791fb915 05/76: Add missing sort by series function
Date: Thu, 18 May 2023 09:57:40 -0400 (EDT)

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

    Add missing sort by series function
    
    * calibre-book.el (calibre-book-sort-by-series): Created
---
 calibre-book.el | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/calibre-book.el b/calibre-book.el
index c3bfecd44d..c421b0133b 100644
--- a/calibre-book.el
+++ b/calibre-book.el
@@ -131,5 +131,18 @@ BOOK is a `calibre-book'."
   (car (seq-intersection calibre-format-preferences
                          (calibre-book-formats book))))
 
+(defun calibre-book-sort-by-series (a b)
+  "Return t if A should appear before B when sorting by series."
+  (if (not (calibre-book-series a))
+      t
+    (if (not (calibre-book-series b))
+        nil
+      (cl-case (compare-strings (calibre-book-series a) nil nil
+                                  (calibre-book-series b) nil nil)
+          (-1 t)
+          ((eq t) (> (calibre-book-series-index a)
+                     (calibre-book-series-index b)))
+          (1 nil)))))
+
 (provide 'calibre-book)
 ;;; calibre-book.el ends here



reply via email to

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