[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 1435365 06/11: Excorporate: Add appointment deletion in Or
From: |
Thomas Fitzsimmons |
Subject: |
[elpa] master 1435365 06/11: Excorporate: Add appointment deletion in Org buffer |
Date: |
Wed, 23 Sep 2020 21:50:09 -0400 (EDT) |
branch: master
commit 14353650023f29f7c63b72ce2e45ffe3c678a6e2
Author: Thomas Fitzsimmons <fitzsim@fitzsim.org>
Commit: Thomas Fitzsimmons <fitzsim@fitzsim.org>
Excorporate: Add appointment deletion in Org buffer
* packages/excorporate/excorporate-org.el
(exco-org--connection-identifier-at-point): New function.
(exco-org-delete-appointment): Likewise.
---
packages/excorporate/excorporate-org.el | 39 +++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/packages/excorporate/excorporate-org.el
b/packages/excorporate/excorporate-org.el
index 8f9cec4..4fab6b3 100644
--- a/packages/excorporate/excorporate-org.el
+++ b/packages/excorporate/excorporate-org.el
@@ -33,6 +33,45 @@
(defvar exco-org--temporary-buffers '()
"A list of per-connection result buffers.")
+(defun exco-org--connection-identifier-at-point ()
+ "Return the connection identifier associated with point."
+ (let* ((calendar-headline
+ (save-excursion (org-up-heading-safe) (org-element-at-point)))
+ (headline (org-element-property :raw-value calendar-headline)))
+ (string-match "Calendar (\\(.*\\))$" headline)
+ (car (read-from-string (match-string 1 headline)))))
+
+(defun exco-org-delete-appointment ()
+ "Delete the appointment at point."
+ (interactive)
+ (let ((identifier (exco-org--connection-identifier-at-point))
+ (item-identifier
+ (org-entry-get (car (org-get-property-block)) "Identifier")))
+ (when item-identifier
+ (exco-calendar-item-appointment-delete
+ identifier
+ (car (read-from-string item-identifier))
+ (lambda (identifier response)
+ (let ((response-code
+ (exco-extract-value '(ResponseMessages
+ DeleteItemResponseMessage
+ ResponseCode)
+ response)))
+ (if (equal response-code "NoError")
+ (with-current-buffer (get-buffer-create
+ excorporate-org-buffer-name)
+ (save-excursion
+ (org-back-to-heading)
+ (let* ((inhibit-read-only t)
+ (element (org-element-at-point))
+ (begin (org-element-property :begin element))
+ (end (org-element-property :end element)))
+ (kill-region begin end)
+ (message
+ "excorporate-org: Successfully deleted appointment"))))
+ (message "excorporate-org: Failed to delete appointment: %S"
+ response-code))))))))
+
(defun exco-org-initialize-buffer ()
"Add initial text to the destination buffer."
(setq exco-org--temporary-buffers '())
- [elpa] master updated (3e43a84 -> fdfd986), Thomas Fitzsimmons, 2020/09/23
- [elpa] master 784e3fe 02/11: Excorporate: Support appointment deletion, Thomas Fitzsimmons, 2020/09/23
- [elpa] master 1435365 06/11: Excorporate: Add appointment deletion in Org buffer,
Thomas Fitzsimmons <=
- [elpa] master ea318ec 07/11: Excorporate: Support appointment creation, Thomas Fitzsimmons, 2020/09/23
- [elpa] master 42d696c 01/11: Excorporate: Add an item iteration macro, Thomas Fitzsimmons, 2020/09/23
- [elpa] master b3e2449 03/11: Excorporate: Avoid trailing newline in Org buffer, Thomas Fitzsimmons, 2020/09/23
- [elpa] master 08ff756 04/11: Excorporate: Change identifier format in Org buffer, Thomas Fitzsimmons, 2020/09/23
- [elpa] master 5ea2897 05/11: Excorporate: Add item identifiers to Org buffer, Thomas Fitzsimmons, 2020/09/23
- [elpa] master 7ba2f5c 08/11: Excorporate: Add support for synchronous operations, Thomas Fitzsimmons, 2020/09/23
- [elpa] master a9e135d 09/11: Excorporate: Provide organizer to iterators, Thomas Fitzsimmons, 2020/09/23
- [elpa] master 027a95b 10/11: Excorporate: Support creating and cancelling meetings, Thomas Fitzsimmons, 2020/09/23
- [elpa] master fdfd986 11/11: Excorporate: Support cancelling meetings in Org buffer, Thomas Fitzsimmons, 2020/09/23