[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ebdb fd66ed0 05/11: Add optional "shortcut" arg to ebdb
From: |
Eric Abrahamsen |
Subject: |
[elpa] externals/ebdb fd66ed0 05/11: Add optional "shortcut" arg to ebdb-prompt-for-db |
Date: |
Sun, 22 Oct 2017 13:17:02 -0400 (EDT) |
branch: externals/ebdb
commit fd66ed012e6dd85469e37a33bbadb46b867fdfe1
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>
Add optional "shortcut" arg to ebdb-prompt-for-db
* ebdb.el (ebdb-prompt-for-db): If non-nil and there's only one
database, just return it without prompting.
* ebdb-migrate.el (ebdb-migrate-from-bbdb): Adjust call.
* ebdb-com.el (ebdb-create-record-extended): Adjust call.
---
ebdb-com.el | 5 +----
ebdb-migrate.el | 4 +---
ebdb.el | 29 ++++++++++++++++++-----------
3 files changed, 20 insertions(+), 18 deletions(-)
diff --git a/ebdb-com.el b/ebdb-com.el
index 4e31108..449049a 100644
--- a/ebdb-com.el
+++ b/ebdb-com.el
@@ -1573,10 +1573,7 @@ in `ebdb-db-list', using its default record class. Use
;;;###autoload
(defun ebdb-create-record-extended ()
(interactive)
- (let ((db
- (if (= 1 (length ebdb-db-list))
- (car ebdb-db-list)
- (ebdb-prompt-for-db)))
+ (let ((db (ebdb-prompt-for-db nil t))
(record-class
(eieio-read-subclass "Use which record class? " 'ebdb-record nil t)))
(ebdb-create-record db record-class)))
diff --git a/ebdb-migrate.el b/ebdb-migrate.el
index f1d1a0b..0375757 100644
--- a/ebdb-migrate.el
+++ b/ebdb-migrate.el
@@ -404,9 +404,7 @@ BBDB sets the default of that option."
(when (and (/= (point-min) (point-max))
(yes-or-no-p "Upgrade from previous version of BBDB? "))
(let ((v-records (ebdb-migrate-parse-records))
- (target-db (if (= (length ebdb-db-list) 1)
- (car ebdb-db-list)
- (ebdb-prompt-for-db)))
+ (target-db (ebdb-prompt-for-db nil t))
(total 0)
c-records duds)
(message "Migrating records from BBDB...")
diff --git a/ebdb.el b/ebdb.el
index 65fc15f..f9a12a8 100644
--- a/ebdb.el
+++ b/ebdb.el
@@ -4118,19 +4118,26 @@ Returns a list of (\"label\" slot . field-class)."
(or (assoc choice field-list)
(list choice (cons 'fields 'ebdb-field-user-simple)))))
-(defun ebdb-prompt-for-db (&optional db-list)
+(defun ebdb-prompt-for-db (&optional db-list shortcut)
+ "Prompt the user to choose a database.
+Possible choices come from `ebdb-db-list', or from DB-LIST, if
+that argument is given. If SHORTCUT is non-nil, don't bother
+prompting if there's only one database."
(unless (or db-list ebdb-db-list)
(ebdb-load))
- (let* ((collection (or db-list ebdb-db-list))
- (db-string
- (ebdb-read-string "Choose a database: "
- nil
- (mapcar
- (lambda (d)
- (slot-value d 'object-name))
- collection)
- t)))
- (object-assoc db-string 'object-name collection)))
+ (let ((collection (or db-list ebdb-db-list))
+ db-string)
+ (if (and shortcut (= 1 (length collection)))
+ (car collection)
+ (setq db-string
+ (ebdb-read-string "Choose a database: "
+ nil
+ (mapcar
+ (lambda (d)
+ (slot-value d 'object-name))
+ collection)
+ t))
+ (object-assoc db-string 'object-name collection))))
(defun ebdb-prompt-for-mail (record)
(let ((mail-alist (mapcar
- [elpa] externals/ebdb updated (aac31a3 -> db53550), Eric Abrahamsen, 2017/10/22
- [elpa] externals/ebdb c9acc38 04/11: Add ebdb-org-field-tags to ebdb-hash-extra-predicates, Eric Abrahamsen, 2017/10/22
- [elpa] externals/ebdb eee0868 03/11: Downcase all-completions string when searching, Eric Abrahamsen, 2017/10/22
- [elpa] externals/ebdb fd66ed0 05/11: Add optional "shortcut" arg to ebdb-prompt-for-db,
Eric Abrahamsen <=
- [elpa] externals/ebdb db53550 11/11: Protect against bug with timestamp/creation-dates, Eric Abrahamsen, 2017/10/22
- [elpa] externals/ebdb c56d9e2 02/11: Get ebdb-ispell working again, Eric Abrahamsen, 2017/10/22
- [elpa] externals/ebdb 121281d 01/11: Part one of migration from org-contacts, Eric Abrahamsen, 2017/10/22
- [elpa] externals/ebdb d4dbf34 07/11: New ebdb-record-change-name methods for strings, Eric Abrahamsen, 2017/10/22
- [elpa] externals/ebdb 59449b9 10/11: New defsubst ebdb-record-self, Eric Abrahamsen, 2017/10/22
- [elpa] externals/ebdb 2661406 09/11: Use cached record name string in cl-print-object, Eric Abrahamsen, 2017/10/22
- [elpa] externals/ebdb d806d7d 08/11: Compiler-inspired fixes, vol 335534, Eric Abrahamsen, 2017/10/22
- [elpa] externals/ebdb 90ff5d1 06/11: New MUA command for toggling record layout, Eric Abrahamsen, 2017/10/22