branch: externals/calibre
commit dd7b8936e84651ccd4e6106ae6b8910095df1b9c
Author: Kjartan Oli Agustsson <[email protected]>
Commit: Kjartan Oli Agustsson <[email protected]>

    Do nothing if not on book when unmarking
    
    * calibre-library.el (calibre-library-mark-unmark): Do nothing if
    point is not on a book.
---
 calibre-library.el | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/calibre-library.el b/calibre-library.el
index 6e52b4154d..281356da6c 100644
--- a/calibre-library.el
+++ b/calibre-library.el
@@ -160,17 +160,18 @@ are marked return those books otherwise return the book 
at point."
   "Clear any marks on a book and move to the next line."
   (interactive "p" calibre-library-mode)
   (let ((book (calibre-library-book-at-point)))
-    (beginning-of-line)
-    (let ((mark (char-after)))
-      (unless (char-equal mark 32)
-        (cond
-         ((char-equal mark calibre-mod-marker)
-          (calibre-edit-revert book)
-          (tabulated-list-put-tag " " t))
-         ((char-equal mark calibre-mark-marker)
-          (if (calibre-edit-modified-p book)
-              (calibre-edit-mark-modified book)
-            (tabulated-list-put-tag " " t))))))))
+    (when book
+      (beginning-of-line)
+      (let ((mark (char-after)))
+        (unless (char-equal mark 32)
+          (cond
+           ((char-equal mark calibre-mod-marker)
+            (calibre-edit-revert book)
+            (tabulated-list-put-tag " " t))
+           ((char-equal mark calibre-mark-marker)
+            (if (calibre-edit-modified-p book)
+                (calibre-edit-mark-modified book)
+              (tabulated-list-put-tag " " t)))))))))
 
 (defun calibre-library-unmark-all (&optional mark)
   "Clear all marks from the library buffer.

Reply via email to