branch: externals/calibre
commit afe5581b7d6941a2be76b0266cf8a545e22971cd
Author: Kjartan Óli Ágústsson <[email protected]>
Commit: Kjartan Óli Ágústsson <[email protected]>

    Only prompt to select library if more than one is defined
    
    * calibre-db.el (calibre-select-library): Add a check if there is more
    than one library defined before prompting.
---
 calibre-db.el | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/calibre-db.el b/calibre-db.el
index 9bbb623f7a..976714f4b6 100644
--- a/calibre-db.el
+++ b/calibre-db.el
@@ -229,8 +229,11 @@ If FORCE is non-nil the list is refreshed from the 
database."
 If LIBRARY is non-nil, select that instead."
   (interactive)
   (setf calibre--library (if library
-                            library
-                           (completing-read "Library: " 
(calibre--library-names) nil t))
+                             library
+                           (let ((names (calibre--library-names)))
+                             (if (not (length> names 1))
+                               (car names)
+                             (completing-read "Library: " names nil t))))
         calibre--db nil
         calibre--books nil)
   (calibre-library--refresh t))

Reply via email to