+2008-10-31 Ulf Jasper <ulf.jasper@web.de>
+
+ * calendar/icalendar.el (icalendar--uid-count): New.
+ (icalendar--create-uid): New. Extracted from
+ `icalendar-export-region' and add uid counter.
+ (icalendar-export-region): Use `icalendar--create-uid'.
+
2008-10-31 Juanma Barranquero <lekktu@gmail.com>
* tooltip.el (tooltip-frame-parameters): Doc fix.
(defalias 'icalendar-convert-diary-to-ical 'icalendar-export-file)
(make-obsolete 'icalendar-convert-diary-to-ical 'icalendar-export-file)
+(defvar icalendar--uid-count 0
+ "Auxiliary counter for creating unique ids.")
+
+(defun icalendar--create-uid ()
+ "Create a unique identifier.
+Use `current-time' and a counter to create unique ids. The
+counter is necessary for systems which do not provide resolution
+finer than a second."
+ (setq icalendar--uid-count (1+ icalendar--uid-count))
+ (format "emacs%d%d%d%d"
+ (car (current-time))
+ (cadr (current-time))
+ (car (cddr (current-time)))
+ icalendar--uid-count))
+
;;;###autoload
(defun icalendar-export-region (min max ical-filename)
"Export region in diary file to iCalendar format.
(if (match-beginning 2)
(setq entry-rest (match-string 2))
(setq entry-rest ""))
- (setq header (format "\nBEGIN:VEVENT\nUID:emacs%d%d%d"
- (car (current-time))
- (cadr (current-time))
- (car (cddr (current-time)))))
+ (setq header (format "\nBEGIN:VEVENT\nUID:%s"
+ (icalendar--create-uid)))
(condition-case error-val
(progn
(setq contents-n-summary