GNU bug report logs - #11525
24.0.97; Add icalendar-import-format-uid

Previous Next

Package: emacs;

Reported by: Leo <sdl.web <at> gmail.com>

Date: Sun, 20 May 2012 13:56:01 UTC

Severity: wishlist

Tags: patch

Found in version 24.0.97

Fixed in version 24.2

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 11525 in the body.
You can then email your comments to 11525 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to ulf.jasper <at> web.de, bug-gnu-emacs <at> gnu.org:
bug#11525; Package emacs. (Sun, 20 May 2012 13:56:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Leo <sdl.web <at> gmail.com>:
New bug report received and forwarded. Copy sent to ulf.jasper <at> web.de, bug-gnu-emacs <at> gnu.org. (Sun, 20 May 2012 13:56:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Leo <sdl.web <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.0.97; Add icalendar-import-format-uid
Date: Sun, 20 May 2012 21:54:34 +0800
[Message part 1 (text/plain, inline)]
Hello Ulf,

I am teaching Gnus to add invitation/events to diary and so I have found
UID in icalendar useful to identify events. Does it make sense to apply
the following patch, which I have been using since may 2011? Thanks.

[ical.diff (text/x-diff, inline)]
=== modified file 'lisp/calendar/icalendar.el'
--- lisp/calendar/icalendar.el	2012-03-13 06:54:37 +0000
+++ lisp/calendar/icalendar.el	2012-05-20 13:45:46 +0000
@@ -130,6 +130,7 @@
 %s Summary, see `icalendar-import-format-summary'
 %t Status, see `icalendar-import-format-status'
 %u URL, see `icalendar-import-format-url'
+%U UID, see `icalendar-import-format-uid'
 
 A formatting FUNCTION will be called with a VEVENT as its only
 argument.  It must return a string.  See
@@ -179,6 +180,14 @@
   :type 'string
   :group 'icalendar)
 
+(defcustom icalendar-import-format-uid
+  "\n UID: %s"
+  "Format string defining how the UID element is formatted.
+This applies only if the UID is not empty! `%s' is replaced by
+the UID."
+  :type 'string
+  :group 'icalendar)
+
 (defcustom icalendar-import-format-status
   "\n Status: %s"
   "Format string defining how the status element is formatted.
@@ -1098,7 +1107,8 @@
         ;; can't do anything
         nil
       ;; split summary-and-rest
-      (let* ((s icalendar-import-format)
+      (let* ((case-fold-search nil)
+             (s icalendar-import-format)
              (p-cla (or (string-match "%c" icalendar-import-format) -1))
              (p-des (or (string-match "%d" icalendar-import-format) -1))
              (p-loc (or (string-match "%l" icalendar-import-format) -1))
@@ -1106,9 +1116,10 @@
              (p-sum (or (string-match "%s" icalendar-import-format) -1))
              (p-sta (or (string-match "%t" icalendar-import-format) -1))
              (p-url (or (string-match "%u" icalendar-import-format) -1))
-             (p-list (sort (list p-cla p-des p-loc p-org p-sta p-sum p-url) '<))
+             (p-uid (or (string-match "%U" icalendar-import-format) -1))
+             (p-list (sort (list p-cla p-des p-loc p-org p-sta p-sum p-url p-uid) '<))
 	     (ct 0)
-             pos-cla pos-des pos-loc pos-org pos-sta pos-sum pos-url)
+             pos-cla pos-des pos-loc pos-org pos-sta pos-sum pos-url pos-uid)
         (dotimes (i (length p-list))
 	  ;; Use 'ct' to keep track of current position in list
           (cond ((and (>= p-cla 0) (= (nth i p-list) p-cla))
@@ -1131,7 +1142,10 @@
                  (setq pos-sum (* 2 ct)))
                 ((and (>= p-url 0) (= (nth i p-list) p-url))
 		 (setq ct (+ ct 1))
-                 (setq pos-url (* 2 ct)))) )
+                 (setq pos-url (* 2 ct)))
+                ((and (>= p-uid 0) (= (nth i p-list) p-uid))
+		 (setq ct (+ ct 1))
+                 (setq pos-uid (* 2 ct)))) )
         (mapc (lambda (ij)
                 (setq s (icalendar--rris (car ij) (cadr ij) s t t)))
               (list
@@ -1149,13 +1163,15 @@
                (list "%t"
                      (concat "\\(" icalendar-import-format-status "\\)??"))
                (list "%u"
-                     (concat "\\(" icalendar-import-format-url "\\)??"))))
+                     (concat "\\(" icalendar-import-format-url "\\)??"))
+               (list "%U"
+                     (concat "\\(" icalendar-import-format-uid "\\)??"))))
 	;; Need the \' regexp in order to detect multi-line items
         (setq s (concat "\\`"
 			   (icalendar--rris "%s" "\\(.*?\\)" s nil t)
                         "\\'"))
         (if (string-match s summary-and-rest)
-            (let (cla des loc org sta sum url)
+            (let (cla des loc org sta sum url uid)
               (if (and pos-sum (match-beginning pos-sum))
                   (setq sum (substring summary-and-rest
                                        (match-beginning pos-sum)
@@ -1184,13 +1200,18 @@
                   (setq url (substring summary-and-rest
                                        (match-beginning pos-url)
                                        (match-end pos-url))))
+              (if (and pos-uid (match-beginning pos-uid))
+                  (setq uid (substring summary-and-rest
+                                       (match-beginning pos-uid)
+                                       (match-end pos-uid))))
               (list (if cla (cons 'cla cla) nil)
                     (if des (cons 'des des) nil)
                     (if loc (cons 'loc loc) nil)
                     (if org (cons 'org org) nil)
                     (if sta (cons 'sta sta) nil)
                     ;;(if sum (cons 'sum sum) nil)
-                    (if url (cons 'url url) nil))))))))
+                    (if url (cons 'url url) nil)
+                    (if uid (cons 'uid uid) nil))))))))
 
 ;; subroutines for icalendar-export-region
 (defun icalendar--convert-ordinary-to-ical (nonmarker entry-main)
@@ -1864,6 +1885,7 @@
   (if (functionp icalendar-import-format)
       (funcall icalendar-import-format event)
     (let ((string icalendar-import-format)
+          (case-fold-search nil)
         (conversion-list
          '(("%c" CLASS       icalendar-import-format-class)
            ("%d" DESCRIPTION icalendar-import-format-description)
@@ -1871,7 +1893,8 @@
            ("%o" ORGANIZER   icalendar-import-format-organizer)
            ("%s" SUMMARY     icalendar-import-format-summary)
            ("%t" STATUS      icalendar-import-format-status)
-           ("%u" URL         icalendar-import-format-url))))
+           ("%u" URL         icalendar-import-format-url)
+           ("%U" UID         icalendar-import-format-uid))))
     ;; convert the specifiers in the format string
     (mapc (lambda (i)
 	    (let* ((spec (car i))


Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11525; Package emacs. (Mon, 21 May 2012 18:18:01 GMT) Full text and rfc822 format available.

Message #8 received at 11525 <at> debbugs.gnu.org (full text, mbox):

From: Ulf Jasper <ulf.jasper <at> web.de>
To: Leo <sdl.web <at> gmail.com>
Cc: 11525 <at> debbugs.gnu.org
Subject: Re: bug#11525: 24.0.97; Add icalendar-import-format-uid
Date: Mon, 21 May 2012 20:13:07 +0200
Leo <sdl.web <at> gmail.com> writes:

> Hello Ulf,
>
> I am teaching Gnus to add invitation/events to diary and so I have found
> UID in icalendar useful to identify events. Does it make sense to apply
> the following patch, which I have been using since may 2011? Thanks.

Makes perfect sense!  I shall apply the patch the next days.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11525; Package emacs. (Tue, 29 May 2012 19:49:02 GMT) Full text and rfc822 format available.

Message #11 received at 11525 <at> debbugs.gnu.org (full text, mbox):

From: Ulf Jasper <ulf.jasper <at> web.de>
To: Leo <sdl.web <at> gmail.com>
Cc: 11525 <at> debbugs.gnu.org
Subject: Re: bug#11525: 24.0.97; Add icalendar-import-format-uid
Date: Tue, 29 May 2012 21:44:20 +0200
Added/modified Unit Tests and applied to trunk.

Done




bug marked as fixed in version 24.2, send any further explanations to 11525 <at> debbugs.gnu.org and Leo <sdl.web <at> gmail.com> Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 30 May 2012 03:07:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 27 Jun 2012 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 13 years and 77 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.