emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/org-contacts c32dbab114 081/154: contrib/lisp/org-conta


From: ELPA Syncer
Subject: [elpa] externals/org-contacts c32dbab114 081/154: contrib/lisp/org-contacts.el: Allow the user to customize interactively the vcard export
Date: Fri, 9 Sep 2022 15:58:34 -0400 (EDT)

branch: externals/org-contacts
commit c32dbab1147401b637f2d5097e20a97adb7dc307
Author: Grégoire Jadi <gregoire.jadi@gmail.com>
Commit: Grégoire Jadi <gregoire.jadi@gmail.com>

    contrib/lisp/org-contacts.el: Allow the user to customize interactively the 
vcard export
    
    * contrib/lisp/org-contacts.el (org-contacts-export-as-vcard): Wrap
      `org-contacts-export-as-vcard-internal' to prompt for the parameters
      when called interactively.
    (org-contacts-export-as-vcard-internal): The old function
      `org-contacts-export-as-vcard'.
    
    Thanks to Esben Stien for the suggestion.
---
 org-contacts.el | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/org-contacts.el b/org-contacts.el
index 583da4ab10..88aef9d201 100644
--- a/org-contacts.el
+++ b/org-contacts.el
@@ -1016,11 +1016,39 @@ to do our best."
            "END:VCARD\n\n")))
 
 (defun org-contacts-export-as-vcard (&optional name file to-buffer)
+  "Export org contacts to V-Card 3.0.
+
+By default, all contacts are exported to `org-contacts-vcard-file'.
+
+When NAME is \\[universal-argument], prompts for a contact name.
+
+When NAME is \\[universal-argument] \\[universal-argument],
+prompts for a contact name and a file name where to export.
+
+When NAME is \\[universal-argument] \\[universal-argument]
+\\[universal-argument], prompts for a contact name and a buffer where to 
export.
+
+If the function is not called interactively, all parameters are
+passed to `org-contacts-export-as-vcard-internal'."
+  (interactive "P")
+  (when (called-interactively-p 'any)
+    (cl-psetf name
+            (when name
+              (read-string "Contact name: "
+                           (first (org-contacts-at-point))))
+            file
+            (when (equal name '(16))
+              (read-file-name "File: " nil org-contacts-vcard-file))
+            to-buffer
+            (when (equal name '(64))
+              (read-buffer "Buffer: "))))
+  (org-contacts-export-as-vcard-internal name file to-buffer))
+
+(defun org-contacts-export-as-vcard-internal (&optional name file to-buffer)
   "Export all contacts matching NAME as VCard 3.0.
 If TO-BUFFER is nil, the content is written to FILE or
 `org-contacts-vcard-file'.  If TO-BUFFER is non-nil, the buffer
 is created and the VCard is written into that buffer."
-  (interactive) ; TODO ask for name?
   (let* ((filename (or file org-contacts-vcard-file))
         (buffer (if to-buffer
                     (get-buffer-create to-buffer)



reply via email to

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