branch: externals/calibre
commit 1c0bf191d51a95ef7789d1d615c0ee3207d55f6e
Author: Kjartan Óli Ágústsson <[email protected]>
Commit: Kjartan Óli Ágústsson <[email protected]>
Refresh Library buffer when calibre-library-columns is changed
* calibre-db.el (calibre-library-columns): Move from calibre.el.
Add explicit :group.
Add :set which makes sure the Library buffer is refreshed when
calibre-library-columns is modified.
* calibre.el (calibre-library-columns): Move to calibre-db.el.
---
calibre-db.el | 31 +++++++++++++++++++++++++++++++
calibre.el | 26 --------------------------
2 files changed, 31 insertions(+), 26 deletions(-)
diff --git a/calibre-db.el b/calibre-db.el
index 60cd02163e..9d43190d5c 100644
--- a/calibre-db.el
+++ b/calibre-db.el
@@ -153,6 +153,37 @@ If FORCE is non-nil fetch book data from the database."
(calibre--books force)))
(tabulated-list-print)))))
+(defcustom calibre-library-columns '((id . 4)
+ (title . 35)
+ (authors . 20)
+ (publishers . 10)
+ (series . 15)
+ (series-index . 3)
+ (tags . 10)
+ (formats . 10))
+ "The metadata fields to display in the library buffer.
+Each entry is a key identifying a metadata field and the width that
+column should have."
+ :type '(repeat (cons
+ :tag "Column"
+ (choice
+ :tag "Attribute"
+ (const :tag "ID" id)
+ (const :tag "Title" title)
+ (const :tag "Author(s)" authors)
+ (const :tag "Publisher(s)" publishers)
+ (const :tag "Series" series)
+ (const :tag "Series Index" series-index)
+ (const :tag "Tags" tags)
+ (const :tag "Formats" formats))
+ (integer :tag "Width")))
+ :set (lambda (symbol value)
+ (set-default symbol value)
+ (calibre-library--set-header)
+ (calibre-library--refresh))
+ :package-version '("calibre" . "0.1.0")
+ :group 'calibre)
+
(defun calibre-library--set-header ()
"Set the header of the Library buffer."
(setf tabulated-list-format (calibre-library--header-format)))
diff --git a/calibre.el b/calibre.el
index b33531dbfb..bc4cdb6c9c 100644
--- a/calibre.el
+++ b/calibre.el
@@ -46,32 +46,6 @@
(directory :tag "Location")))
:package-version '("calibre" . "0.1.0"))
-(defcustom calibre-library-columns '((id . 4)
- (title . 35)
- (authors . 20)
- (publishers . 10)
- (series . 15)
- (series-index . 3)
- (tags . 10)
- (formats . 10))
- "The metadata fields to display in the library buffer.
-Each entry is a key identifying a metadata field and the width that
-column should have."
- :type '(repeat (cons
- :tag "Column"
- (choice
- :tag "Attribute"
- (const :tag "ID" id)
- (const :tag "Title" title)
- (const :tag "Author(s)" authors)
- (const :tag "Publisher(s)" publishers)
- (const :tag "Series" series)
- (const :tag "Series Index" series-index)
- (const :tag "Tags" tags)
- (const :tag "Formats" formats))
- (integer :tag "Width")))
- :package-version '("calibre" . "0.1.0"))
-
(defun calibre--library-names ()
"Return a list of the names of defined libraries."
(mapcar #'car calibre-libraries))