branch: externals/ebdb
commit 6aa15d22ab3b094acf2c632b056e01f63a5161ff
Author: Eric Abrahamsen <[email protected]>
Commit: Eric Abrahamsen <[email protected]>
Change interactive defs for move/copy-records
* ebdb.el (ebdb-move-record, ebdb-copy-records): These should be
"internal", non-interactive functions.
* ebdb-com.el (ebdb-move-records, ebdb-copy-records): New *EBDB*
buffer commands that call the underlying functions.
---
ebdb-com.el | 14 ++++++++++++++
ebdb.el | 11 ++---------
2 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/ebdb-com.el b/ebdb-com.el
index 0bcec03..fd43762 100644
--- a/ebdb-com.el
+++ b/ebdb-com.el
@@ -1716,6 +1716,20 @@ If prefix NOPROMPT is non-nil, do not confirm deletion."
(ebdb-redisplay-record-globally record nil t))))
;;;###autoload
+(defun ebdb-move-records (records db)
+ (interactive (list (ebdb-do-records)
+ (ebdb-prompt-for-db)))
+ (ebdb-with-record-edits (r records)
+ (ebdb-move-record r db)))
+
+;;;###autoload
+(defun ebdb-copy-records (records db)
+ (interactive (list (ebdb-do-records)
+ (ebdb-prompt-for-db)))
+ (ebdb-with-record-edits (r records)
+ (ebdb-copy-record r db)))
+
+;;;###autoload
(defun ebdb-display-all-records (&optional fmt)
"Show all records.
If invoked in a *EBDB* buffer point stays on the currently visible record.
diff --git a/ebdb.el b/ebdb.el
index ee6586b..615bd95 100644
--- a/ebdb.el
+++ b/ebdb.el
@@ -3048,23 +3048,16 @@ the persistent save, or allow them to propagate."
(defun ebdb-move-record (record to-db)
"Move RECORD from its existing database to TO-DB."
- (interactive
- (list (ebdb-current-record)
- (ebdb-prompt-for-db)))
;; It's not quite right to assume that we're *only* removing the
;; record from the first db in its list of dbs.
(let ((existing (car (slot-value (ebdb-record-cache record)
- 'database))))
- (if (equal existing to-db)
- (message "Can't move record into same database")
+ 'database))))
+ (unless (equal existing to-db)
(ebdb-db-add-record to-db record)
(ebdb-db-remove-record existing record))))
(defun ebdb-copy-record (record to-db)
"Copy RECORD into TO-DB."
- (interactive
- (list (ebdb-current-record)
- (ebdb-prompt-for-db)))
(ebdb-db-add-record to-db record))
;;; Utility functions