[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/ebdb 38db90d 063/350: Improve ebdb-copy-mail-as-kill

From: Eric Abrahamsen
Subject: [elpa] externals/ebdb 38db90d 063/350: Improve ebdb-copy-mail-as-kill
Date: Mon, 14 Aug 2017 11:46:04 -0400 (EDT)

branch: externals/ebdb
commit 38db90d02f5dc5f91c80aa33936e8de9edd4ce7f
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>

    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))))
-(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 <address@hidden>\"."
-  (interactive (list (ebdb-do-records)))
-  (let ((str (mapconcat #'ebdb-dwim-mail records ", ")))
-    (kill-new str)
-    (message str)))
+Ie, looks like \"John Doe <address@hidden>\".
+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)))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]