branch: externals/calibre
commit 04c484a2ef3b4f3a8afb1956c8867636e93821eb
Author: Kjartan Óli Ágústsson <[email protected]>
Commit: Kjartan Óli Ágústsson <[email protected]>
Preserve marks when refreshing library
* calibre-db.el: Require calibre-util
(calibre-library--refresh): Preserve marks.
---
calibre-db.el | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/calibre-db.el b/calibre-db.el
index 4d1864bf63..051ad55927 100644
--- a/calibre-db.el
+++ b/calibre-db.el
@@ -26,6 +26,7 @@
;;; Code:
(require 'calibre)
(require 'calibre-book)
+(require 'calibre-util)
(defun calibre-make-book (entry)
"Create a `calibre-book' from ENTRY.
@@ -271,11 +272,16 @@ If FORCE is non-nil fetch book data from the database."
(let ((buffer (get-buffer calibre-library-buffer)))
(when buffer
(with-current-buffer buffer
- (setf tabulated-list-entries
- (mapcar #'calibre-book--print-info
- (calibre-library--filter calibre-library--filters
- (calibre--books force))))
- (tabulated-list-print)))))
+ (let ((book (tabulated-list-get-id)))
+ (calibre-with-preserved-marks (not force)
+ (setf tabulated-list-entries
+ (mapcar #'calibre-book--print-info
+ (calibre-library--filter calibre-library--filters
+ (calibre--books force))))
+ (tabulated-list-print)
+ (if book
+ (calibre-library--find-book book)
+ (goto-char (point-max)))))))))
(defun calibre-library--set-header ()
"Set the header of the Library buffer."