icalendar: uid-creation improved
This commit is contained in:
parent
38df7d213a
commit
ca2d101f5e
2 changed files with 24 additions and 4 deletions
|
@ -1,3 +1,10 @@
|
|||
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.
|
||||
|
|
|
@ -877,6 +877,21 @@ Finto iCalendar file: ")
|
|||
(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.
|
||||
|
@ -916,10 +931,8 @@ FExport diary data into iCalendar file: ")
|
|||
(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
|
||||
|
|
Loading…
Add table
Reference in a new issue