Gnus development mailing list
 help / color / mirror / Atom feed
From: Jan Tatarik <jan.tatarik@gmail.com>
To: Lars Magne Ingebrigtsen <larsi@gnus.org>
Cc: ding@gnus.org
Subject: Re: iCalendar support: reply to invitations, sync to org
Date: Tue, 06 Aug 2013 22:32:31 +0200	[thread overview]
Message-ID: <5n5x2r38qmef1c.fsf@nb-jtatarik2.xing.hh> (raw)
In-Reply-To: <m37gg5knx5.fsf@stories.gnus.org> (Lars Magne Ingebrigtsen's message of "Fri, 02 Aug 2013 01:10:30 +0200")

[-- Attachment #1: Type: text/plain, Size: 451 bytes --]

On Fri, Aug 02 2013, Lars Magne Ingebrigtsen wrote:

> Jan Tatarik <jan.tatarik@gmail.com> writes:

>> Getting compilation errors from the buildbot. Is the pcase macro
>> available in older versions?

> I think it first became available in Emacs 24.  But Emacs 24.1 didn't
> support some expressions that it now supports, so using it for anything
> other than Emacs 24.3 and up isn't very backward-compatible,
> unfortunately.

How about this, then?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: replace pcase with cond --]
[-- Type: text/x-diff, Size: 3211 bytes --]

diff --git a/lisp/gnus-icalendar.el b/lisp/gnus-icalendar.el
index 0286fd5dd8908ad7839b1f541a5946d2814bea3d..3a9e743e8ed98a0b694a2a2f1d597a6e69ae3142 100644
--- a/lisp/gnus-icalendar.el
+++ b/lisp/gnus-icalendar.el
@@ -183,11 +183,11 @@
                      :end (gnus-icalendar-event--decode-datefield event 'DTEND zone-map)
                      :rsvp (string= (plist-get (cadr attendee) 'RSVP)
                                     "TRUE")))
-         (event-class (pcase method
-                        ("REQUEST" 'gnus-icalendar-event-request)
-                        ("CANCEL" 'gnus-icalendar-event-cancel)
-                        ("REPLY" 'gnus-icalendar-event-reply)
-                        (_ 'gnus-icalendar-event))))
+         (event-class (cond
+                       ((string= method "REQUEST") 'gnus-icalendar-event-request)
+                       ((string= method "CANCEL") 'gnus-icalendar-event-cancel)
+                       ((string= method "REPLY") 'gnus-icalendar-event-reply)
+                       (t 'gnus-icalendar-event))))
 
     (labels ((map-property (prop)
                    (let ((value (icalendar--get-event-property event prop)))
@@ -252,14 +252,15 @@ status will be retrieved from the first matching attendee record."
                             ;; NOTE: not all of the below fields are mandatory,
                             ;; but they are often present in other clients'
                             ;; replies. Can be helpful for debugging, too.
-                            (new-line (pcase key
-                                        ("ATTENDEE" (update-attendee-status line))
-                                        ("SUMMARY" (update-summary line))
-                                        ("DTSTAMP" (update-dtstamp))
-                                        ((or "ORGANIZER" "DTSTART" "DTEND"
-                                             "LOCATION" "DURATION" "SEQUENCE"
-                                             "RECURRENCE-ID" "UID") line)
-                                        (_ nil))))
+                            (new-line
+                             (cond
+                              ((string= key "ATTENDEE") (update-attendee-status line))
+                              ((string= key "SUMMARY") (update-summary line))
+                              ((string= key "DTSTAMP") (update-dtstamp))
+                              ((find key '("ORGANIZER" "DTSTART" "DTEND"
+                                           "LOCATION" "DURATION" "SEQUENCE"
+                                           "RECURRENCE-ID" "UID")) line)
+                              (t nil))))
                        (when new-line
                          (push new-line reply-event-lines))))))
 
@@ -405,7 +406,8 @@ Return nil for non-recurring EVENT."
 
 (defun gnus-icalendar--deactivate-org-timestamp (ts)
   (replace-regexp-in-string "[<>]"
-                            (lambda (m) (pcase m ("<" "[") (">" "]")))
+                            (lambda (m) (cond ((string= m "<") "[")
+                                              ((string= m ">") "]")))
                             ts))
 
 (defun gnus-icalendar-find-org-event-file (event &optional org-file)

  parent reply	other threads:[~2013-08-06 20:32 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-02 22:21 Jan Tatarik
2013-04-03  8:23 ` Adam Sjøgren
2013-04-03 12:38   ` Jan Tatarik
2013-04-03 15:27 ` David Engster
2013-04-03 21:28   ` Jan Tatarik
2013-04-03 22:01     ` David Engster
2013-04-03 22:52       ` Jan Tatarik
2013-06-06 15:15   ` Ted Zlatanov
2013-06-06 17:08     ` David Engster
2013-06-06 17:49       ` Ted Zlatanov
2013-06-06 18:12         ` David Engster
2013-06-06 18:17           ` Ted Zlatanov
2013-06-06 20:57             ` Jan Tatarik
2013-06-07 11:43               ` Steinar Bang
2013-06-07 12:13                 ` Jan Tatarik
2013-06-07 12:41                   ` Ted Zlatanov
2013-06-07 13:37                     ` Steinar Bang
2013-06-21  6:56               ` David Engster
2013-08-01 15:40               ` Lars Magne Ingebrigtsen
2013-08-01 18:47                 ` Jan Tatarik
2013-08-01 21:07                   ` Lars Magne Ingebrigtsen
2013-08-01 21:28                     ` Lars Magne Ingebrigtsen
2013-08-06 20:45                       ` Jan Tatarik
2013-08-06 20:54                         ` Lars Magne Ingebrigtsen
2013-08-09 22:07                       ` Mats Lidell
2013-08-01 21:51                     ` Jan Tatarik
2013-08-01 22:08                     ` Jan Tatarik
2013-08-01 23:10                       ` Lars Magne Ingebrigtsen
2013-08-01 23:26                         ` Jan Tatarik
2013-08-06 20:32                         ` Jan Tatarik [this message]
2013-08-06 20:36                           ` Lars Magne Ingebrigtsen
2013-08-06 20:52                           ` Lars Magne Ingebrigtsen
2013-08-06 21:24                             ` Jan Tatarik
2013-08-12 17:32                               ` Lars Magne Ingebrigtsen
2013-08-12 19:09                                 ` Jan Tatarik
2013-08-12 19:20                                   ` Lars Magne Ingebrigtsen
2013-08-02  6:20                     ` Steinar Bang
2013-08-02 12:40                       ` Lars Magne Ingebrigtsen
2013-08-02 13:25                         ` Steinar Bang
2013-04-12 16:25 ` Eric S Fraga
2013-04-15  1:34   ` Jan Tatarik
2013-04-16  9:05     ` Eric S Fraga

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5n5x2r38qmef1c.fsf@nb-jtatarik2.xing.hh \
    --to=jan.tatarik@gmail.com \
    --cc=ding@gnus.org \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).