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

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

[elpa] externals/excorporate de50497 75/93: Excorporate: Support replyin


From: Stefan Monnier
Subject: [elpa] externals/excorporate de50497 75/93: Excorporate: Support replying to meeting requests in Org buffer
Date: Sun, 29 Nov 2020 15:43:12 -0500 (EST)

branch: externals/excorporate
commit de50497193948587a2a3f16ee2650f947a369114
Author: Thomas Fitzsimmons <fitzsim@fitzsim.org>
Commit: Thomas Fitzsimmons <fitzsim@fitzsim.org>

    Excorporate: Support replying to meeting requests in Org buffer
    
    * packages/excorporate/excorporate-org.el
    (exco-org--reply-to-meeting): New function.
    (exco-org-accept-meeting-request): Likewise.
    (exco-org-decline-meeting-request): Likewise.
    (exco-org-tentatively-accept-meeting-request): Likewise.
---
 excorporate-org.el | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/excorporate-org.el b/excorporate-org.el
index a03ebff..f6edc05 100644
--- a/excorporate-org.el
+++ b/excorporate-org.el
@@ -110,6 +110,57 @@ operated on."
             (begin (org-element-property :begin element))
             (end (org-element-property :end element)))
        (delete-region begin end)))))
+
+(defun exco-org--reply-to-meeting (acceptance prompt-for-message)
+  "Reply to a meeting.
+ACCEPTANCE is a symbol, one of `accept', `tentatively-accept', or
+`decline'.  PROMPT-FOR-MESSAGE is non-nil to prompt the user for
+a message to include in the reply or nil to not include a
+message."
+  (let (prompt success failure)
+    (cl-ecase acceptance
+      (accept
+       (setq prompt "Acceptance message: ")
+       (setq success "accepted")
+       (setq failure "accept"))
+      (tentatively-accept
+       (setq prompt "Tentative acceptance message: ")
+       (setq success "accepted tentatively")
+       (setq failure "accept tentatively"))
+      (decline
+       (setq prompt "Declination message: ")
+       (setq success "declined")
+       (setq failure "decline")))
+    (let ((message (when prompt-for-message (read-from-minibuffer prompt)))
+         (identifier (exco-org--connection-identifier-at-point))
+         (item-identifier (exco-org--item-identifier-at-point)))
+      (exco-calendar-item-meeting-reply
+       identifier item-identifier message acceptance
+       (lambda (identifier response)
+        (exco-org--handle-response response CreateItemResponseMessage
+                                   success failure))))))
+
+(defun exco-org-accept-meeting-request (&optional argument)
+  "Accept the meeting at point.
+With a prefix argument, ARGUMENT, prompts for response message
+text."
+  (interactive "P")
+  (exco-org--reply-to-meeting 'accept argument))
+
+(defun exco-org-decline-meeting-request (&optional argument)
+  "Decline the meeting at point.
+With a prefix argument, ARGUMENT, prompts for response message
+text."
+  (interactive "P")
+  (exco-org--reply-to-meeting 'decline argument))
+
+(defun exco-org-tentatively-accept-meeting-request (&optional argument)
+  "Tentatively accept the meeting at point.
+With a prefix argument, ARGUMENT, prompts for response message
+text."
+  (interactive "P")
+  (exco-org--reply-to-meeting 'tentatively-accept argument))
+
 (defun exco-org-cancel-meeting ()
   "Cancel the meeting at point, prompting for a cancellation message."
   (interactive)



reply via email to

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