aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Tatarik2014-04-20 22:10:33 +0000
committerKatsumi Yamaoka2014-04-20 22:10:33 +0000
commit5fd1888bf6020240b6950331c7780e3f475d5cae (patch)
treedb3ecd38a05cb7c8ac63d35e97a429062982fb8f
parente100022976f0e878ce88cf4a0230cbee86951ba1 (diff)
downloademacs-5fd1888bf6020240b6950331c7780e3f475d5cae.tar.gz
emacs-5fd1888bf6020240b6950331c7780e3f475d5cae.zip
* gnus-icalendar.el (gnus-icalendar-event->org-entry)
(gnus-icalendar--update-org-event): put event timestamp in the org entry body instead of the drawer. (gnus-icalendar-event--get-attendee-names): list of participants should contain even attendees without common name attribute. (gnus-icalendar--update-org-event): don't generate duplicates of empty property tags in org drawers.
-rw-r--r--lisp/gnus/ChangeLog10
-rw-r--r--lisp/gnus/gnus-icalendar.el40
2 files changed, 37 insertions, 13 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 41ad2875691..9f7e6aaefd6 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,13 @@
12014-04-20 Jan Tatarik <jan.tatarik@gmail.com>
2
3 * gnus-icalendar.el (gnus-icalendar-event->org-entry)
4 (gnus-icalendar--update-org-event): put event timestamp in
5 the org entry body instead of the drawer.
6 (gnus-icalendar-event--get-attendee-names): list of participants should
7 contain even attendees without common name attribute.
8 (gnus-icalendar--update-org-event): don't generate duplicates of empty
9 property tags in org drawers.
10
12014-04-15 Katsumi Yamaoka <yamaoka@jpl.org> 112014-04-15 Katsumi Yamaoka <yamaoka@jpl.org>
2 12
3 * gmm-utils.el (gmm-format-time-string): New function. 13 * gmm-utils.el (gmm-format-time-string): New function.
diff --git a/lisp/gnus/gnus-icalendar.el b/lisp/gnus/gnus-icalendar.el
index 79f1e2fe203..852ce537d9f 100644
--- a/lisp/gnus/gnus-icalendar.el
+++ b/lisp/gnus/gnus-icalendar.el
@@ -170,7 +170,9 @@
170 (caddr event)))) 170 (caddr event))))
171 171
172 (gmm-labels ((attendee-role (prop) (plist-get (cadr prop) 'ROLE)) 172 (gmm-labels ((attendee-role (prop) (plist-get (cadr prop) 'ROLE))
173 (attendee-name (prop) (plist-get (cadr prop) 'CN)) 173 (attendee-name (prop)
174 (or (plist-get (cadr prop) 'CN)
175 (replace-regexp-in-string "^.*MAILTO:" "" (caddr prop))))
174 (attendees-by-type (type) 176 (attendees-by-type (type)
175 (gnus-remove-if-not 177 (gnus-remove-if-not
176 (lambda (p) (string= (attendee-role p) type)) 178 (lambda (p) (string= (attendee-role p) type))
@@ -452,7 +454,6 @@ Return nil for non-recurring EVENT."
452 "Not replied yet")) 454 "Not replied yet"))
453 (props `(("ICAL_EVENT" . "t") 455 (props `(("ICAL_EVENT" . "t")
454 ("ID" . ,uid) 456 ("ID" . ,uid)
455 ("DT" . ,(gnus-icalendar-event:org-timestamp event))
456 ("ORGANIZER" . ,(gnus-icalendar-event:organizer event)) 457 ("ORGANIZER" . ,(gnus-icalendar-event:organizer event))
457 ("LOCATION" . ,(gnus-icalendar-event:location event)) 458 ("LOCATION" . ,(gnus-icalendar-event:location event))
458 ("PARTICIPATION_TYPE" . ,(symbol-name (gnus-icalendar-event:participation-type event))) 459 ("PARTICIPATION_TYPE" . ,(symbol-name (gnus-icalendar-event:participation-type event)))
@@ -470,7 +471,9 @@ Return nil for non-recurring EVENT."
470 (when description 471 (when description
471 (save-restriction 472 (save-restriction
472 (narrow-to-region (point) (point)) 473 (narrow-to-region (point) (point))
473 (insert description) 474 (insert (gnus-icalendar-event:org-timestamp event)
475 "\n\n"
476 description)
474 (indent-region (point-min) (point-max) 2) 477 (indent-region (point-min) (point-max) 2)
475 (fill-region (point-min) (point-max)))) 478 (fill-region (point-min) (point-max))))
476 479
@@ -551,20 +554,31 @@ is searched."
551 (when description 554 (when description
552 (save-restriction 555 (save-restriction
553 (narrow-to-region (point) (point)) 556 (narrow-to-region (point) (point))
554 (insert "\n" (replace-regexp-in-string "[\n]+$" "\n" description) "\n") 557 (insert "\n"
558 (gnus-icalendar-event:org-timestamp event)
559 "\n\n"
560 (replace-regexp-in-string "[\n]+$" "\n" description)
561 "\n")
555 (indent-region (point-min) (point-max) (1+ entry-outline-level)) 562 (indent-region (point-min) (point-max) (1+ entry-outline-level))
556 (fill-region (point-min) (point-max)))) 563 (fill-region (point-min) (point-max))))
557 564
558 ;; update entry properties 565 ;; update entry properties
559 (org-entry-put event-pos "DT" (gnus-icalendar-event:org-timestamp event)) 566 (gmm-labels
560 (org-entry-put event-pos "ORGANIZER" organizer) 567 ((update-org-entry (position property value)
561 (org-entry-put event-pos "LOCATION" location) 568 (if (or (null value)
562 (org-entry-put event-pos "PARTICIPATION_TYPE" (symbol-name participation-type)) 569 (string= value ""))
563 (org-entry-put event-pos "REQ_PARTICIPANTS" (gnus-icalendar--format-participant-list req-participants)) 570 (org-entry-delete position property)
564 (org-entry-put event-pos "OPT_PARTICIPANTS" (gnus-icalendar--format-participant-list opt-participants)) 571 (org-entry-put position property value))))
565 (org-entry-put event-pos "RRULE" recur) 572
566 (when reply-status (org-entry-put event-pos "REPLY" 573 (update-org-entry event-pos "ORGANIZER" organizer)
567 (capitalize (symbol-name reply-status)))) 574 (update-org-entry event-pos "LOCATION" location)
575 (update-org-entry event-pos "PARTICIPATION_TYPE" (symbol-name participation-type))
576 (update-org-entry event-pos "REQ_PARTICIPANTS" (gnus-icalendar--format-participant-list req-participants))
577 (update-org-entry event-pos "OPT_PARTICIPANTS" (gnus-icalendar--format-participant-list opt-participants))
578 (update-org-entry event-pos "RRULE" recur)
579 (update-org-entry event-pos "REPLY"
580 (if reply-status (capitalize (symbol-name reply-status))
581 "Not replied yet")))
568 (save-buffer))))))))) 582 (save-buffer)))))))))
569 583
570 584