diff options
| author | Jan Tatarik | 2013-11-21 22:55:59 +0000 |
|---|---|---|
| committer | Katsumi Yamaoka | 2013-11-21 22:55:59 +0000 |
| commit | 680f4ae6ba858da2e078a7f9c2f2d3eb4b6f325d (patch) | |
| tree | a48bbfe999cab9daea02070881f114b39687a0ed | |
| parent | 1cf525ad7287cff411afb390560163641e9d43d8 (diff) | |
| download | emacs-680f4ae6ba858da2e078a7f9c2f2d3eb4b6f325d.tar.gz emacs-680f4ae6ba858da2e078a7f9c2f2d3eb4b6f325d.zip | |
lisp/gnus/gnus-icalendar.el: Fix org-timestamp for events ending at midnight; RSVP handling
| -rw-r--r-- | lisp/gnus/ChangeLog | 10 | ||||
| -rw-r--r-- | lisp/gnus/gnus-icalendar.el | 63 |
2 files changed, 66 insertions, 7 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 11f9e59c478..b44cca022ee 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2013-11-21 Jan Tatarik <jan.tatarik@gmail.com> | ||
| 2 | |||
| 3 | * gnus-icalendar.el (gnus-icalendar-additional-identities): New. | ||
| 4 | (gnus-icalendar-identities): Support additional-identities. | ||
| 5 | |||
| 6 | 2013-11-21 Jan Tatarik <jan.tatarik@gmail.com> | ||
| 7 | |||
| 8 | * gnus-icalendar.el (gnus-icalendar-event:org-timestamp): Fix | ||
| 9 | org-timestamp for events ending at midnight. | ||
| 10 | |||
| 1 | 2013-11-21 Ivan Shmakov <ivan@siamics.net> (tiny change) | 11 | 2013-11-21 Ivan Shmakov <ivan@siamics.net> (tiny change) |
| 2 | 12 | ||
| 3 | * nndoc.el (nndoc-type-alist, nndoc-debbugs-db-type-p): Support debbugs | 13 | * nndoc.el (nndoc-type-alist, nndoc-debbugs-db-type-p): Support debbugs |
diff --git a/lisp/gnus/gnus-icalendar.el b/lisp/gnus/gnus-icalendar.el index a8277635f3e..56c56f3dd46 100644 --- a/lisp/gnus/gnus-icalendar.el +++ b/lisp/gnus/gnus-icalendar.el | |||
| @@ -387,14 +387,46 @@ Return nil for non-recurring EVENT." | |||
| 387 | (end (gnus-icalendar-event:end-time event)) | 387 | (end (gnus-icalendar-event:end-time event)) |
| 388 | (start-date (format-time-string "%Y-%m-%d %a" start)) | 388 | (start-date (format-time-string "%Y-%m-%d %a" start)) |
| 389 | (start-time (format-time-string "%H:%M" start)) | 389 | (start-time (format-time-string "%H:%M" start)) |
| 390 | (start-at-midnight (string= start-time "00:00")) | ||
| 390 | (end-date (format-time-string "%Y-%m-%d %a" end)) | 391 | (end-date (format-time-string "%Y-%m-%d %a" end)) |
| 391 | (end-time (format-time-string "%H:%M" end)) | 392 | (end-time (format-time-string "%H:%M" end)) |
| 393 | (end-at-midnight (string= end-time "00:00")) | ||
| 394 | (start-end-date-diff (/ (float-time (time-subtract | ||
| 395 | (date-to-time end-date) | ||
| 396 | (date-to-time start-date))) | ||
| 397 | 86400)) | ||
| 392 | (org-repeat (gnus-icalendar-event:org-repeat event)) | 398 | (org-repeat (gnus-icalendar-event:org-repeat event)) |
| 393 | (repeat (if org-repeat (concat " " org-repeat) ""))) | 399 | (repeat (if org-repeat (concat " " org-repeat) "")) |
| 394 | 400 | (time-1-day '(0 86400))) | |
| 395 | (if (equal start-date end-date) | 401 | |
| 396 | (format "<%s %s-%s%s>" start-date start-time end-time repeat) | 402 | ;; NOTE: special care is needed with appointments ending at midnight |
| 397 | (format "<%s %s>--<%s %s>" start-date start-time end-date end-time)))) | 403 | ;; (typically all-day events): the end time has to be changed to 23:59 to |
| 404 | ;; prevent org agenda showing the event on one additional day | ||
| 405 | (cond | ||
| 406 | ;; start/end midnight | ||
| 407 | ;; A 0:0 - A+1 0:0 -> A | ||
| 408 | ;; A 0:0 - A+n 0:0 -> A - A+n-1 | ||
| 409 | ((and start-at-midnight end-at-midnight) (if (> start-end-date-diff 1) | ||
| 410 | (let ((end-ts (format-time-string "%Y-%m-%d %a" (time-subtract end time-1-day)))) | ||
| 411 | (format "<%s>--<%s>" start-date end-ts)) | ||
| 412 | (format "<%s%s>" start-date repeat))) | ||
| 413 | ;; end midnight | ||
| 414 | ;; A .:. - A+1 0:0 -> A .:.-23:59 | ||
| 415 | ;; A .:. - A+n 0:0 -> A .:. - A_n-1 | ||
| 416 | (end-at-midnight (if (= start-end-date-diff 1) | ||
| 417 | (format "<%s %s-23:59%s>" start-date start-time repeat) | ||
| 418 | (let ((end-ts (format-time-string "%Y-%m-%d %a" (time-subtract end time-1-day)))) | ||
| 419 | (format "<%s %s>--<%s>" start-date start-time end-ts)))) | ||
| 420 | ;; start midnight | ||
| 421 | ;; A 0:0 - A .:. -> A 0:0-.:. (default 1) | ||
| 422 | ;; A 0:0 - A+n .:. -> A - A+n .:. | ||
| 423 | ((and start-at-midnight | ||
| 424 | (plusp start-end-date-diff)) (format "<%s>--<%s %s>" start-date end-date end-time)) | ||
| 425 | ;; default | ||
| 426 | ;; A .:. - A .:. -> A .:.-.:. | ||
| 427 | ;; A .:. - B .:. | ||
| 428 | ((zerop start-end-date-diff) (format "<%s %s-%s%s>" start-date start-time end-time repeat)) | ||
| 429 | (t (format "<%s %s>--<%s %s>" start-date start-time end-date end-time))))) | ||
| 398 | 430 | ||
| 399 | (defun gnus-icalendar--format-summary-line (summary &optional location) | 431 | (defun gnus-icalendar--format-summary-line (summary &optional location) |
| 400 | (if location | 432 | (if location |
| @@ -617,6 +649,22 @@ is searched." | |||
| 617 | :type '(string) | 649 | :type '(string) |
| 618 | :group 'gnus-icalendar) | 650 | :group 'gnus-icalendar) |
| 619 | 651 | ||
| 652 | (defcustom gnus-icalendar-additional-identities nil | ||
| 653 | "We need to know your identity to make replies to calendar requests work. | ||
| 654 | |||
| 655 | Gnus will only offer you the Accept/Tentative/Decline buttons for | ||
| 656 | calendar events if any of your identities matches at least one | ||
| 657 | RSVP participant. | ||
| 658 | |||
| 659 | Your identity is guessed automatically from the variables `user-full-name', | ||
| 660 | `user-mail-address', and `gnus-ignored-from-addresses'. | ||
| 661 | |||
| 662 | If you need even more aliases you can define them here. It really | ||
| 663 | only makes sense to define names or email addresses." | ||
| 664 | |||
| 665 | :type '(repeat string) | ||
| 666 | :group 'gnus-icalendar) | ||
| 667 | |||
| 620 | (make-variable-buffer-local | 668 | (make-variable-buffer-local |
| 621 | (defvar gnus-icalendar-reply-status nil)) | 669 | (defvar gnus-icalendar-reply-status nil)) |
| 622 | 670 | ||
| @@ -630,8 +678,9 @@ is searched." | |||
| 630 | (apply #'append | 678 | (apply #'append |
| 631 | (mapcar (lambda (x) (if (listp x) x (list x))) | 679 | (mapcar (lambda (x) (if (listp x) x (list x))) |
| 632 | (list user-full-name (regexp-quote user-mail-address) | 680 | (list user-full-name (regexp-quote user-mail-address) |
| 633 | ; NOTE: this one can be a list | 681 | ; NOTE: these can be lists |
| 634 | gnus-ignored-from-addresses)))) | 682 | gnus-ignored-from-addresses ; already regexp-quoted |
| 683 | (mapcar #'regexp-quote gnus-icalendar-additional-identities))))) | ||
| 635 | 684 | ||
| 636 | ;; TODO: make the template customizable | 685 | ;; TODO: make the template customizable |
| 637 | (defmethod gnus-icalendar-event->gnus-calendar ((event gnus-icalendar-event) &optional reply-status) | 686 | (defmethod gnus-icalendar-event->gnus-calendar ((event gnus-icalendar-event) &optional reply-status) |