branch: externals/calibre
commit d07b13442ba0a564f055f74427529c62675edbc8
Author: Kjartan Oli Agustsson <[email protected]>
Commit: Kjartan Oli Agustsson <[email protected]>
Add command to unmark all marked books
* calibre-library.el (calibre-library-mark-unmark): New function.
(calibre-library-mode-map): Add binding for calibre-library-mark-unmark.
---
calibre-library.el | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/calibre-library.el b/calibre-library.el
index acef570285..5d550da74c 100644
--- a/calibre-library.el
+++ b/calibre-library.el
@@ -166,7 +166,23 @@ are marked return those books otherwise return the book at
point."
((char-equal mark calibre-mark-marker)
(if (calibre-edit-modified-p book)
(calibre-edit-mark-modified book)
- (tabulated-list-put-tag " " t))))))))
+ (tabulated-list-put-tag " " t))))))))
+
+(defun calibre-library-unmark-all (&optional mark)
+ "Clear all marks from the library buffer.
+
+If MARK is provided clear only that mark. When called with a prefix
+argument prompts for MARK."
+ (interactive (list (if current-prefix-arg (read-char "Mark: ") nil)))
+ (let ((book (tabulated-list-get-id)))
+ (goto-char (point-min))
+ (while (not (eobp))
+ (let ((current-mark (char-after)))
+ (when (or (and mark (char-equal current-mark mark))
+ (and (not mark) (not (char-equal current-mark 32))))
+ (tabulated-list-put-tag " " nil)))
+ (forward-line))
+ (calibre-library--find-book book)))
(defun calibre-library-get-marked (&optional mark)
"Return books marked with MARK.
@@ -260,6 +276,7 @@ If called with a prefix argument prompt the user for the
format."
"m" #'calibre-library-mark
"d" #'calibre-library-mark-remove
"u" #'calibre-library-mark-unmark
+ "U" #'calibre-library-unmark-all
"e" #'calibre-edit-book
"x" #'calibre-library-execute
"a" #'calibre-library-add-book