branch: externals/ebdb
commit 38db90d02f5dc5f91c80aa33936e8de9edd4ce7f
Author: Eric Abrahamsen <[email protected]>
Commit: Eric Abrahamsen <[email protected]>
Improve ebdb-copy-mail-as-kill
* ebdb-com.el (ebdb-copy-mail-as-kill): Now takes a prefix argument,
which prompts for which record mail address to use.
---
ebdb-com.el | 27 +++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/ebdb-com.el b/ebdb-com.el
index 6cc2116..e9afcf6 100644
--- a/ebdb-com.el
+++ b/ebdb-com.el
@@ -2955,14 +2955,29 @@ is a list, copy only the NUMth list element."
(message "%s" str))))
;;;###autoload
-(defun ebdb-copy-mail-as-kill (records)
+(defun ebdb-copy-mail-as-kill (records &optional arg)
"Copy dwim-style mail addresses for RECORDS.
-Ie, looks like \"John Doe <[email protected]>\"."
- (interactive (list (ebdb-do-records)))
- (let ((str (mapconcat #'ebdb-dwim-mail records ", ")))
- (kill-new str)
- (message str)))
+Ie, looks like \"John Doe <[email protected]>\".
+
+With prefix argument ARG, prompt for which mail address to use."
+ (interactive (list (ebdb-do-records)
+ current-prefix-arg))
+ (let* (mail-list mail result)
+ (dolist (r records)
+ (setq mail (if arg
+ (ebdb-prompt-for-mail r)
+ (car-safe (ebdb-record-mail r t))))
+ (when mail
+ (push (cons r mail) mail-list)))
+ (setq result
+ (mapconcat
+ (lambda (e)
+ (ebdb-dwim-mail
+ (car e) (cdr e)))
+ (reverse mail-list) ", "))
+ (kill-new result)
+ (message result)))