[elpa] externals/phps-mode f2c386d: Fixed interface class imenu indexing and bookkeeping of isset() !empty() conditional blocks
branch: externals/phps-mode commit f2c386d6d48e9101268ccd5858ad6842d7ed7058 Author: Christian Johansson Commit: Christian Johansson Fixed interface class imenu indexing and bookkeeping of isset() !empty() conditional blocks --- phps-mode-lex-analyzer.el | 974 +--- phps-mode.el| 4 +- test/phps-mode-test-lex-analyzer.el | 95 +++- 3 files changed, 668 insertions(+), 405 deletions(-) diff --git a/phps-mode-lex-analyzer.el b/phps-mode-lex-analyzer.el index 35ff67e..e0a1d64 100644 --- a/phps-mode-lex-analyzer.el +++ b/phps-mode-lex-analyzer.el @@ -608,145 +608,146 @@ (setq buffer (current-buffer))) (phps-mode-debug-message (message "Run process changes on buffer '%s'" buffer)) - (with-current-buffer buffer -(let ((run-full-lexer nil) - (old-tokens phps-mode-lex-analyzer--tokens) - (old-states phps-mode-lex-analyzer--states) - (log '())) - - (if phps-mode-lex-analyzer--change-min - (progn -(phps-mode-debug-message - (message "Processing change point minimum: %s" phps-mode-lex-analyzer--change-min)) -(let ((incremental-state nil) - (incremental-state-stack nil) - (incremental-heredoc-label nil) - (incremental-heredoc-label-stack nil) - (incremental-tokens nil) - (head-states '()) - (head-tokens '()) - (change-start phps-mode-lex-analyzer--change-min) - (incremental-start-new-buffer phps-mode-lex-analyzer--change-min)) - - ;; Reset idle timer - (phps-mode-lex-analyzer--cancel-idle-timer) - - ;; Reset buffer changes minimum index - (phps-mode-lex-analyzer--reset-changes) - - ;; Reset tokens and states here - (setq phps-mode-lex-analyzer--tokens nil) - (setq phps-mode-lex-analyzer--states nil) - (setq phps-mode-lex-analyzer--state nil) - (setq phps-mode-lex-analyzer--state-stack nil) - (setq phps-mode-lex-analyzer--heredoc-label nil) - (setq phps-mode-lex-analyzer--heredoc-label-stack nil) - - ;; NOTE Starts are inclusive while ends are exclusive buffer locations - - ;; Some tokens have dynamic length and if a change occurs at token-end - ;; we must start the incremental process at previous token start - - ;; Build list of tokens from old buffer before start of changes (head-tokens) - - (catch 'quit -(dolist (token old-tokens) - (let ((start (car (cdr token))) -(end (cdr (cdr token -(if (< end change-start) -(push token head-tokens) - (when (< start change-start) -(phps-mode-debug-message - (message "New incremental-start-new-buffer: %s" start)) -(setq incremental-start-new-buffer start)) - (throw 'quit "break") + (when (get-buffer buffer) +(with-current-buffer buffer + (let ((run-full-lexer nil) +(old-tokens phps-mode-lex-analyzer--tokens) +(old-states phps-mode-lex-analyzer--states) +(log '())) - (setq head-tokens (nreverse head-tokens)) +(if phps-mode-lex-analyzer--change-min +(progn (phps-mode-debug-message - (message "Head tokens: %s" head-tokens) - (message "Incremental-start-new-buffer: %s" incremental-start-new-buffer)) + (message "Processing change point minimum: %s" phps-mode-lex-analyzer--change-min)) + (let ((incremental-state nil) +(incremental-state-stack nil) +(incremental-heredoc-label nil) +(incremental-heredoc-label-stack nil) +(incremental-tokens nil) +(head-states '()) +(head-tokens '()) +(change-start phps-mode-lex-analyzer--change-min) +(incremental-start-new-buffer phps-mode-lex-analyzer--change-min)) + +;; Reset idle timer +(phps-mode-lex-analyzer--cancel-idle-timer) + +;; Reset buffer changes minimum index +(phps-mode-lex-analyzer--reset-changes) + +;; Reset tokens and states here +(setq phps-mode-lex-analyzer--tokens nil) +(setq phps-mode-lex-analyzer--states nil) +(setq phps-mode-lex-analyzer--state nil) +(setq phps-mode-lex-analyzer--state-stack nil) +(setq phps-mode-lex-analyzer--heredoc-label nil) +(setq phps-mode-lex-analyzer--heredoc-label-stack nil) + +;
[elpa] master 3e43a84: [org-translate] Fix bum link following, bump to 0.1.1
branch: master commit 3e43a8435d8d46cc1a4eac36fba39f794cc1cd00 Author: Eric Abrahamsen Commit: Eric Abrahamsen [org-translate] Fix bum link following, bump to 0.1.1 * packages/org-translate/org-translate.el (ogt-follow-link): Apparently this takes a prefix arg, don't know how this passed basic testing. --- packages/org-translate/org-translate.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/org-translate/org-translate.el b/packages/org-translate/org-translate.el index 0bc8061..f9ecf3c 100644 --- a/packages/org-translate/org-translate.el +++ b/packages/org-translate/org-translate.el @@ -2,7 +2,7 @@ ;; Copyright (C) 2020 Free Software Foundation, Inc. -;; Version: 0.1 +;; Version: 0.1.1 ;; Package-Requires: ((emacs "25.1") (org "9.1")) ;; Author: Eric Abrahamsen @@ -302,8 +302,8 @@ fragilely, and deleted and re-set with abandon.") :keymap ogt-link-keymap :export #'ogt-export-link) -(defun ogt-follow-link (link) - (org-id-open link)) +(defun ogt-follow-link (link arg) + (org-id-open link arg)) (defun ogt-export-link (_path desc _backend) "Export a translation link.
[elpa] master 5ea2897 05/11: Excorporate: Add item identifiers to Org buffer
branch: master commit 5ea28971861ddd6f97ef43d294eb5cdd0f61ecdc Author: Thomas Fitzsimmons Commit: Thomas Fitzsimmons Excorporate: Add item identifiers to Org buffer * packages/excorporate/excorporate-org.el (exco-org-insert-meeting-headline): Add item identifier argument and set Org property to it. (exco-org-insert-meeting): Add item identifier argument. (exco-org-insert-meetings): Call exco-calendar-item-iterate-general to be called back with item-identifier argument. (exco-org-finalize-buffer): Close all PROPERTIES drawers. --- packages/excorporate/excorporate-org.el | 26 +++--- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/packages/excorporate/excorporate-org.el b/packages/excorporate/excorporate-org.el index b8a5a12..8f9cec4 100644 --- a/packages/excorporate/excorporate-org.el +++ b/packages/excorporate/excorporate-org.el @@ -58,11 +58,16 @@ "Format an Org headline using IDENTIFIER." (format "* Calendar (%S)\n" identifier)) -(defun exco-org-insert-meeting-headline (subject start-time end-time) +(defun exco-org-insert-meeting-headline (subject +start-time end-time +&optional item-identifier) "Insert and schedule a meeting. SUBJECT is the meeting's subject, START-TIME and END-TIME are the meeting's start and end times in the same format as is returned -by `current-time'." +by `current-time'. ITEM-IDENTIFIER is the item identifier in the +form: + +(ItemId (Id . ID-STRING) (ChangeKey . CHANGEKEY-STRING))" (let* ((now (current-time)) (keyword (if (time-less-p now end-time) "TODO" @@ -74,6 +79,7 @@ by `current-time'." (end-of-line) (insert "--" (format-time-string "<%Y-%m-%d %a %H:%M>" end-time)) (forward-line) +(org-set-property "Identifier" (format "%S" item-identifier)) (org-insert-time-stamp (current-time) t t "+ Retrieved " "\n"))) (defun exco-org-insert-invitees (invitees) @@ -98,14 +104,17 @@ by `current-time'." nil t " + Date " "\n") (defun exco-org-insert-meeting (subject start end location - main-invitees optional-invitees) + main-invitees optional-invitees + &optional item-identifier) "Insert a scheduled meeting. SUBJECT is a string, the subject of the meeting. START is the meeting start time in Emacs internal date time format, and END is the end of the meeting in the same format. LOCATION is a string representing the location. MAIN-INVITEES and OPTIONAL-INVITEES -are the requested participants." - (exco-org-insert-meeting-headline subject start end) +are the requested participants. ITEM-IDENTIFIER, a pair of +strings represending the item identifier and the change +identifier for that item." + (exco-org-insert-meeting-headline subject start end item-identifier) (insert (format "+ Duration: %d minutes\n" (round (/ (float-time (time-subtract end start)) 60.0 (insert (format "+ Location: %s\n" location)) @@ -126,11 +135,13 @@ are the requested participants." (with-current-buffer (exco-org--identifier-buffer identifier) (let ((inhibit-read-only t)) (org-insert-time-stamp (current-time) t t " + Last checked " "\n") - (exco-calendar-item-iterate + (exco-calendar-item-iterate-general response (lambda (&rest arguments) (with-current-buffer (exco-org--identifier-buffer identifier) (org-mode) - (apply #'exco-org-insert-meeting arguments + (apply #'exco-org-insert-meeting arguments))) + subject start-internal end-internal + location main-invitees optional-invitees item-identifier) (goto-char (point-min)) (if (save-excursion (org-goto-first-child)) (org-sort-entries t ?s) @@ -147,6 +158,7 @@ are the requested participants." (insert "done.\n") (dolist (result-buffer (nreverse exco-org--temporary-buffers)) (insert-buffer-substring result-buffer) + (save-excursion (org-up-heading-safe) (org-cycle-hide-drawers 'all)) (kill-buffer result-buffer)) (setq exco-org--temporary-buffers '()
[elpa] master 42d696c 01/11: Excorporate: Add an item iteration macro
branch: master commit 42d696ccedbb946a03562c716cafbc21b6741ee3 Author: Thomas Fitzsimmons Commit: Thomas Fitzsimmons Excorporate: Add an item iteration macro * packages/excorporate/excorporate.el (exco-calendar-item-iterate-general): New macro. (exco-calendar-item-iterate): Call exco-calendar-item-iterate-general. --- packages/excorporate/excorporate.el | 52 + 1 file changed, 36 insertions(+), 16 deletions(-) diff --git a/packages/excorporate/excorporate.el b/packages/excorporate/excorporate.el index 271f2cc..694be81 100644 --- a/packages/excorporate/excorporate.el +++ b/packages/excorporate/excorporate.el @@ -756,28 +756,48 @@ processing is done." location main-invitees optional-invitees icalendar-text))) +(defmacro exco-calendar-item-iterate-general (response + callback &rest care-abouts) + "Iterate through calendar items in RESPONSE, calling CALLBACK on each. +Return a list of results from callback. CARE-ABOUTS is a list of +symbols representing the arguments with which CALLBACK should be +called. Options are: +SUBJECT, a string, the subject of the meeting. +START, the start date and time in Emacs internal representation. +END, the start date and time in Emacs internal representation. +LOCATION, the location of the meeting. +MAIN-INVITEES, a list of strings, email addresses of the required +participants. +OPTIONAL-INVITEES, a list of strings, email addresses of optional +participants. +ITEM-IDENTIFIER, a structure of the form (ItemId (Id +. ID-STRING) (ChangeKey . CHANGEKEY-STRING))." + `(let ((result-list '())) + (exco--calendar-item-dolist + calendar-item (exco-extract-value '(ResponseMessages + FindItemResponseMessage + RootFolder + Items) + ,response) + (push (funcall ,callback ,@care-abouts) + result-list)) + (nreverse result-list))) + (defun exco-calendar-item-iterate (response callback) "Iterate through calendar items in RESPONSE, calling CALLBACK on each. -Returns a list of results from callback. CALLBACK takes arguments: +Return a list of results from callback. CALLBACK takes arguments: SUBJECT, a string, the subject of the meeting. START, the start date and time in Emacs internal representation. END, the start date and time in Emacs internal representation. LOCATION, the location of the meeting. -MAIN-INVITEES, a list of strings representing required participants. -OPTIONAL-INVITEES, a list of strings representing optional participants." - (let ((result-list '())) -(exco--calendar-item-dolist - calendar-item (exco-extract-value '(ResponseMessages -FindItemResponseMessage -RootFolder -Items) - response) - ;; Silence byte compiler unused warning. - item-identifier - (push (funcall callback subject start-internal end-internal - location main-invitees optional-invitees) - result-list)) -(nreverse result-list))) +MAIN-INVITEES, a list of strings, email addresses of the required +participants. +OPTIONAL-INVITEES, a list of strings, email addresses of optional +participants." + (exco-calendar-item-iterate-general + response callback + subject start-internal end-internal + location main-invitees optional-invitees)) ;; Date-time utility functions. (defun exco-extend-timezone (date-time-string)
[elpa] master 784e3fe 02/11: Excorporate: Support appointment deletion
branch: master commit 784e3fe6676d0f80c9f89a003f5073cbc2b1ff78 Author: Thomas Fitzsimmons Commit: Thomas Fitzsimmons Excorporate: Support appointment deletion * packages/excorporate/excorporate.el (exco-calendar-item-appointment-delete): New function. --- packages/excorporate/excorporate.el | 18 ++ 1 file changed, 18 insertions(+) diff --git a/packages/excorporate/excorporate.el b/packages/excorporate/excorporate.el index 694be81..66ba673 100644 --- a/packages/excorporate/excorporate.el +++ b/packages/excorporate/excorporate.el @@ -659,6 +659,24 @@ PATH is an ordered list of node names." (setq values (assoc path-element values))) (cdr values))) +(defun exco-calendar-item-appointment-delete (identifier + item-identifier callback) + "Delete an appointment. +IDENTIFIER is the connection identifier. ITEM-IDENTIFIER is the +item identifier in the form: + +(ItemId (Id . ID-STRING) (ChangeKey . CHANGEKEY-STRING)) + +CALLBACK is the callback called with the identifier and +response." + (exco-operate identifier + "DeleteItem" + `(((DeleteType . "MoveToDeletedItems") + (SendMeetingCancellations . "SendToAllAndSaveCopy") + (ItemIds ,item-identifier)) + nil nil nil) + callback)) + (defun exco-calendar-item-get-details (identifier item-identifier process-item) "Query server for details about ITEM-IDENTIFIER. IDENTIFIER is the connection identifier. Call PROCESS-ITEM with
[elpa] master b3e2449 03/11: Excorporate: Avoid trailing newline in Org buffer
branch: master commit b3e24494244060b9fccd3d8bd29588b704587558 Author: Thomas Fitzsimmons Commit: Thomas Fitzsimmons Excorporate: Avoid trailing newline in Org buffer * packages/excorporate/excorporate-org.el (exco-org-initialize-buffer): Avoid trailing newline. --- packages/excorporate/excorporate-org.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/excorporate/excorporate-org.el b/packages/excorporate/excorporate-org.el index 8e951d0..d7d747c 100644 --- a/packages/excorporate/excorporate-org.el +++ b/packages/excorporate/excorporate-org.el @@ -52,7 +52,7 @@ (let ((inhibit-read-only t)) (delete-region (point-min) (point-max)) (goto-char (point-min)) - (insert "# Updated...\n" + (insert "# Updated..." (defun exco-org-format-headline (identifier) "Format an Org headline using IDENTIFIER."
[elpa] master 08ff756 04/11: Excorporate: Change identifier format in Org buffer
branch: master commit 08ff756067b5a234c00255b5ccf7191e7fcabaca Author: Thomas Fitzsimmons Commit: Thomas Fitzsimmons Excorporate: Change identifier format in Org buffer * packages/excorporate/excorporate-org.el (exco-org-format-headline): Insert connection identifier s-expression. --- packages/excorporate/excorporate-org.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/excorporate/excorporate-org.el b/packages/excorporate/excorporate-org.el index d7d747c..b8a5a12 100644 --- a/packages/excorporate/excorporate-org.el +++ b/packages/excorporate/excorporate-org.el @@ -56,7 +56,7 @@ (defun exco-org-format-headline (identifier) "Format an Org headline using IDENTIFIER." - (format "* Calendar (%s)\n" identifier)) + (format "* Calendar (%S)\n" identifier)) (defun exco-org-insert-meeting-headline (subject start-time end-time) "Insert and schedule a meeting.
[elpa] master 027a95b 10/11: Excorporate: Support creating and cancelling meetings
branch: master commit 027a95bc388c79a1e9df34191402a1121c7c96cc Author: Thomas Fitzsimmons Commit: Thomas Fitzsimmons Excorporate: Support creating and cancelling meetings * packages/excorporate/excorporate.el (exco--create-attendee-structure): New function. (exco-calendar-item-meeting-create): Likewise. (exco-calendar-item-meeting-cancel): Likewise. --- packages/excorporate/excorporate.el | 82 + 1 file changed, 82 insertions(+) diff --git a/packages/excorporate/excorporate.el b/packages/excorporate/excorporate.el index 7402bf0..03cf969 100644 --- a/packages/excorporate/excorporate.el +++ b/packages/excorporate/excorporate.el @@ -674,6 +674,88 @@ PATH is an ordered list of node names." (setq values (assoc path-element values))) (cdr values))) +(defun exco--create-attendee-structure (attendees required) + "Convert a list of email addresses to an Attendees structure or nil. +ATTENDEES is a list of strings, attendee email addresses. +REQUIRED is t if the structure should represent required +attendees and nil for optional attendees. +Return a structure, or nil, suitable for splicing into +`exco-operate` parameters with ,@." + (when attendees +(let ((attendee-list '())) + (dolist (address attendees) + (push `(Attendee (Mailbox (EmailAddress . ,address))) attendee-list)) + (list (cons (if required 'RequiredAttendees 'OptionalAttendees) + (nreverse attendee-list)) + +(defun exco-calendar-item-meeting-create (identifier + subject body start end location + main-invitees optional-invitees + callback) + "Create a meeting calendar item. +IDENTIFIER is the connection identifier. +SUBJECT is a string, the subject of the appointment. +BODY is a string, the message text of the appointment. +START is the start date and time in Emacs internal representation. +END is the end date and time in Emacs internal representation. +LOCATION is a string representing the location of the meeting. +MAIN-INVITEES is a list of strings representing required +participants. +OPTIONAL-INVITEES is a list of strings representing optional +participants +CALLBACK is a callback function called with two arguments, +IDENTIFIER, the connection identifier for the responding +connection, and RESPONSE, the server's response to the meeting +creation." + (exco-operate + identifier + "CreateItem" + `(((SendMeetingInvitations . "SendToAllAndSaveCopy") + (Items + (CalendarItem + (Subject . ,subject) + (Body (BodyType . "Text") ,body) +(Start . ,(exco-format-date-time start)) +(End . ,(exco-format-date-time end)) +(Location . ,location) + ,@(exco--create-attendee-structure main-invitees t) + ,@(exco--create-attendee-structure optional-invitees nil + ;; Empty arguments. + ,@(let* ((wsdl (exco--with-fsm identifier + (plist-get (fsm-get-state-data fsm) :service-wsdl))) + (arity (soap-operation-arity wsdl + "ExchangeServicePort" + "CreateItem"))) + (make-list (- arity 1) nil))) + callback)) + +(defun exco-calendar-item-meeting-cancel (identifier + item-identifier message callback) + "Cancel a meeting. +IDENTIFIER is the connection identifier. ITEM-IDENTIFIER is the +meeting identifier. MESSAGE is the body of the cancellation +message that will be sent to attendees. CALLBACK is a callback +function called with two arguments, IDENTIFIER, the connection +identifier for the responding connection, and RESPONSE, the +server's response to the meeting cancellation." + (exco-operate + identifier + "CreateItem" + `(((MessageDisposition . "SendAndSaveCopy") + (Items + (CancelCalendarItem + (ReferenceItemId ,@(cdr item-identifier)) + (NewBodyContent (BodyType . "Text") ,message + ;; Empty arguments. + ,@(let* ((wsdl (exco--with-fsm identifier + (plist-get (fsm-get-state-data fsm) + :service-wsdl))) + (arity (soap-operation-arity wsdl + "ExchangeServicePort" + "CreateItem"))) + (make-list (- arity 1) nil))) + callback)) + (defun exco-calendar-item-appointment-create (identifier subject body start end callback) "Create an appointment calendar item.
[elpa] master 1435365 06/11: Excorporate: Add appointment deletion in Org buffer
branch: master commit 14353650023f29f7c63b72ce2e45ffe3c678a6e2 Author: Thomas Fitzsimmons Commit: Thomas Fitzsimmons 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 a9e135d 09/11: Excorporate: Provide organizer to iterators
branch: master commit a9e135dc11ba7d9cc545b8d3e899c44bc5901304 Author: Thomas Fitzsimmons Commit: Thomas Fitzsimmons Excorporate: Provide organizer to iterators * packages/excorporate/excorporate.el (exco-calendar-item-meeting-create): Provide organizer email address. (exco-calendar-item-iterate-general): Document organizer option. --- packages/excorporate/excorporate.el | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/excorporate/excorporate.el b/packages/excorporate/excorporate.el index a478262..7402bf0 100644 --- a/packages/excorporate/excorporate.el +++ b/packages/excorporate/excorporate.el @@ -768,7 +768,10 @@ On each iteration, ITEM is set, and FORMS are run." (optional-invitees (when cc-invitees (mapcar 'org-trim (split-string cc-invitees ";" - (item-identifier (assoc 'ItemId ,item))) + (item-identifier (assoc 'ItemId ,item)) + (organizer (cdr (assoc 'EmailAddress + (assoc 'Mailbox + (assoc 'Organizer ,item)) ,@forms))) (defun exco-calendar-item-with-details-iterate (identifier @@ -827,8 +830,10 @@ MAIN-INVITEES, a list of strings, email addresses of the required participants. OPTIONAL-INVITEES, a list of strings, email addresses of optional participants. -ITEM-IDENTIFIER, a structure of the form (ItemId (Id -. ID-STRING) (ChangeKey . CHANGEKEY-STRING))." +ITEM-IDENTIFIER, a structure of the form +\(ItemId (Id . ID-STRING) (ChangeKey . CHANGEKEY-STRING)). +ORGANIZER, a string representing the email address of the +organizer of the meeting, in server-internal format." `(let ((result-list '())) (exco--calendar-item-dolist calendar-item (exco-extract-value '(ResponseMessages
[elpa] master fdfd986 11/11: Excorporate: Support cancelling meetings in Org buffer
branch: master commit fdfd986c9766de86cf924e00b38267350c012a7f Author: Thomas Fitzsimmons Commit: Thomas Fitzsimmons Excorporate: Support cancelling meetings in Org buffer * packages/excorporate/excorporate-org.el (exco-org--is-meeting): New function. (exco-org--organizer): Likewise. (exco-org--organizer-matches-connection): Likewise. (exco-org-cancel-meeting): Likewise. (exco-org-delete-appointment): Check if calendar entry looks like a meeting. (exco-org-insert-meeting-headline): Adjust documentation. (exco-org-insert-meeting): Insert organizer email address. (exco-org-insert-meetings): Call exco-org-insert-meeting with organizer and identifier. (exco-org-insert-meeting): Add organizer and identifier arguments. --- packages/excorporate/excorporate-org.el | 138 +++- 1 file changed, 118 insertions(+), 20 deletions(-) diff --git a/packages/excorporate/excorporate-org.el b/packages/excorporate/excorporate-org.el index 4fab6b3..78d04ff 100644 --- a/packages/excorporate/excorporate-org.el +++ b/packages/excorporate/excorporate-org.el @@ -41,9 +41,88 @@ (string-match "Calendar (\\(.*\\))$" headline) (car (read-from-string (match-string 1 headline) +(defun exco-org--is-meeting () + "Return t if the entry at point is a meeting, not an appointment." + (save-excursion +(org-back-to-heading) +(let ((element (org-element-at-point))) + ;; Rule out top Calendar item. + (when (equal (org-element-property :level element) 2) + (not (null + (re-search-forward +"^\+ Invitees:$" +(org-element-property :end (org-element-at-point)) t))) + +(defun exco-org--organizer () + "Return a string representing the item at point's organizer." + (save-excursion +(org-back-to-heading) +(let* ((element (org-element-at-point)) + (begin (org-element-property :begin element)) + (end (org-element-property :end element)) + (entry-text (buffer-substring-no-properties begin end))) + ;; Rule out top Calendar item. + (when (equal (org-element-property :level element) 2) + (string-match "^+ Organizer: \\(.*\\)$" entry-text) + (match-string 1 entry-text) + +(defun exco-org--organizer-matches-connection () + "Return non-nil if the entry at point is owned by the connection owner." + (let ((identifier (exco-org--connection-identifier-at-point)) + (organizer (exco-org--organizer))) +(cond + ((stringp identifier) + (equal identifier organizer)) + ((consp identifier) + (equal (car identifier) organizer)) + (t + (error "Did not recognize error") + +(defun exco-org-cancel-meeting () + "Cancel the meeting at point, prompting for a cancellation message." + (interactive) + (unless (exco-org--is-meeting) +(error (concat "This looks like an appointment," + " try `exco-org-delete-appointment' instead."))) + (let ((identifier (exco-org--connection-identifier-at-point)) + (item-identifier +(org-entry-get (car (org-get-property-block)) "Identifier"))) +;; Make sure the meeting owner matches the connection owner before +;; attempting to cancel the meeting. +(unless (exco-org--organizer-matches-connection) + (error (concat "exco-org will only attempt to delete" +" meetings for which you are the organizer"))) +(when item-identifier + (exco-calendar-item-meeting-cancel + identifier + (car (read-from-string item-identifier)) + (read-from-minibuffer "Cancellation message: ") + (lambda (identifier response) +(let ((response-code + (exco-extract-value '(ResponseMessages + CreateItemResponseMessage + 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 cancelled meeting" +(message "excorporate-org: Failed to cancel meeting: %S" + response-code + (defun exco-org-delete-appointment () "Delete the appointment at point." (interactive) + (when (exco-org--is-meeting) +(error "This looks like a meeting, try `exco-org-cancel-meeting' instead")) (let ((identifier (exco-org--connection-identifier-at-point)) (item-identifier
[elpa] master updated (3e43a84 -> fdfd986)
fitzsim pushed a change to branch master. from 3e43a84 [org-translate] Fix bum link following, bump to 0.1.1 new 42d696c Excorporate: Add an item iteration macro new 784e3fe Excorporate: Support appointment deletion new b3e2449 Excorporate: Avoid trailing newline in Org buffer new 08ff756 Excorporate: Change identifier format in Org buffer new 5ea2897 Excorporate: Add item identifiers to Org buffer new 1435365 Excorporate: Add appointment deletion in Org buffer new ea318ec Excorporate: Support appointment creation new 7ba2f5c Excorporate: Add support for synchronous operations new a9e135d Excorporate: Provide organizer to iterators new 027a95b Excorporate: Support creating and cancelling meetings new fdfd986 Excorporate: Support cancelling meetings in Org buffer Summary of changes: packages/excorporate/excorporate-org.el | 185 --- packages/excorporate/excorporate.el | 216 2 files changed, 357 insertions(+), 44 deletions(-)
[elpa] master 7ba2f5c 08/11: Excorporate: Add support for synchronous operations
branch: master commit 7ba2f5c33c480845a8717e023a3a989b14c127d0 Author: Thomas Fitzsimmons Commit: Thomas Fitzsimmons Excorporate: Add support for synchronous operations * packages/excorporate/excorporate.el (exco--fsm): Support synchronous finite state machine calls in :retrieving-data state. (exco-operate): Throw error if callback argument is nil. (exco-operate-synchronously): New function. --- packages/excorporate/excorporate.el | 33 - 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/packages/excorporate/excorporate.el b/packages/excorporate/excorporate.el index 25f2b5c..a478262 100644 --- a/packages/excorporate/excorporate.el +++ b/packages/excorporate/excorporate.el @@ -560,20 +560,26 @@ the FSM should transition to on success." (list state-data nil)) (define-state exco--fsm :retrieving-data - (_fsm state-data event _callback) + (_fsm state-data event fsm-result-callback) (let* ((identifier (plist-get state-data :identifier)) (wsdl (plist-get state-data :service-wsdl)) (name (pop event)) (arguments (pop event)) (callback (pop event))) -(apply #'soap-invoke-async - (lambda (response) -(funcall callback identifier response)) - nil - wsdl - "ExchangeServicePort" - name - arguments)) +(if callback + ;; exco-operate. + (apply #'soap-invoke-async + (lambda (response) +(funcall callback identifier response)) + nil + wsdl + "ExchangeServicePort" + name + arguments) + ;; exco-operate-synchronously. + (funcall + fsm-result-callback + (apply #'soap-invoke wsdl "ExchangeServicePort" name arguments (list :retrieving-data state-data nil)) (defun exco--ensure-connection () @@ -631,10 +637,19 @@ use the `cdr' of the pair as the service URL." IDENTIFIER is the connection identifier. Execute operation NAME with ARGUMENTS then call CALLBACK with two arguments, IDENTIFIER and the server's response." + (when (null callback) (error "CALLBACK cannot be nil")) (exco--with-fsm identifier (fsm-send fsm (list name arguments callback))) nil) +(defun exco-operate-synchronously (identifier name arguments) + "Execute a service operation synchronously. +IDENTIFIER is the connection identifier. Execute operation NAME +with ARGUMENTS then call CALLBACK with two arguments, IDENTIFIER +and the server's response." + (exco--with-fsm identifier +(fsm-call fsm (list name arguments + (defun exco-server-version (identifier) "Return the server version for connection IDENTIFIER, as a string. Examples are \"Exchange2010\", \"Exchange2010_SP1\",
[elpa] master ea318ec 07/11: Excorporate: Support appointment creation
branch: master commit ea318ec872072b84b6e4e5e4c81964755d14a86b Author: Thomas Fitzsimmons Commit: Thomas Fitzsimmons Excorporate: Support appointment creation * packages/excorporate/excorporate.el (exco-calendar-item-appointment-delete): Adjust documentation. (exco-calendar-item-appointment-create): New function. --- packages/excorporate/excorporate.el | 36 ++-- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/packages/excorporate/excorporate.el b/packages/excorporate/excorporate.el index 66ba673..25f2b5c 100644 --- a/packages/excorporate/excorporate.el +++ b/packages/excorporate/excorporate.el @@ -659,16 +659,40 @@ PATH is an ordered list of node names." (setq values (assoc path-element values))) (cdr values))) +(defun exco-calendar-item-appointment-create (identifier + subject body start end callback) + "Create an appointment calendar item. +IDENTIFIER is the connection identifier. +SUBJECT is a string, the subject of the appointment. +BODY is a string, the message text of the appointment. +START is the start date and time in Emacs internal representation. +END is the end date and time in Emacs internal representation. +CALLBACK is a callback function called with two arguments, +IDENTIFIER, the connection identifier for the responding +connection, and RESPONSE, the server's response to the +appointment creation." + (exco-operate identifier + "CreateItem" + `(((SendMeetingInvitations . "SendToNone") + (Items + (CalendarItem + (Subject . ,subject) +(Body (BodyType . "Text") ,body) + (Start . ,(exco-format-date-time start)) + (End . ,(exco-format-date-time end) + nil nil nil nil) + callback)) + (defun exco-calendar-item-appointment-delete (identifier item-identifier callback) "Delete an appointment. IDENTIFIER is the connection identifier. ITEM-IDENTIFIER is the -item identifier in the form: - -(ItemId (Id . ID-STRING) (ChangeKey . CHANGEKEY-STRING)) - -CALLBACK is the callback called with the identifier and -response." +item identifier in the form +\(ItemId (Id . ID-STRING) (ChangeKey . CHANGEKEY-STRING)). +CALLBACK is a callback function called with two arguments, +IDENTIFIER, the connection identifier for the responding +connection, and RESPONSE, the server's response to the +appointment deletion." (exco-operate identifier "DeleteItem" `(((DeleteType . "MoveToDeletedItems")