diff options
| author | Ulf Jasper | 2008-10-31 18:28:16 +0000 |
|---|---|---|
| committer | Ulf Jasper | 2008-10-31 18:28:16 +0000 |
| commit | ca2d101f5e3d42ed40b690ba86f46fb32e80a820 (patch) | |
| tree | ebddb878420e5e8b1c242b8216bc36c97b61ef97 | |
| parent | 38df7d213a021c1c0780b35ee81ac9ab125730dc (diff) | |
| download | emacs-ca2d101f5e3d42ed40b690ba86f46fb32e80a820.tar.gz emacs-ca2d101f5e3d42ed40b690ba86f46fb32e80a820.zip | |
icalendar: uid-creation improved
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/calendar/icalendar.el | 21 |
2 files changed, 24 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 726872e880a..d7d6729bf49 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2008-10-31 Ulf Jasper <ulf.jasper@web.de> | ||
| 2 | |||
| 3 | * calendar/icalendar.el (icalendar--uid-count): New. | ||
| 4 | (icalendar--create-uid): New. Extracted from | ||
| 5 | `icalendar-export-region' and add uid counter. | ||
| 6 | (icalendar-export-region): Use `icalendar--create-uid'. | ||
| 7 | |||
| 1 | 2008-10-31 Juanma Barranquero <lekktu@gmail.com> | 8 | 2008-10-31 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 9 | ||
| 3 | * tooltip.el (tooltip-frame-parameters): Doc fix. | 10 | * tooltip.el (tooltip-frame-parameters): Doc fix. |
diff --git a/lisp/calendar/icalendar.el b/lisp/calendar/icalendar.el index 10ddb05820d..c74d60763f8 100644 --- a/lisp/calendar/icalendar.el +++ b/lisp/calendar/icalendar.el | |||
| @@ -877,6 +877,21 @@ Finto iCalendar file: ") | |||
| 877 | (defalias 'icalendar-convert-diary-to-ical 'icalendar-export-file) | 877 | (defalias 'icalendar-convert-diary-to-ical 'icalendar-export-file) |
| 878 | (make-obsolete 'icalendar-convert-diary-to-ical 'icalendar-export-file) | 878 | (make-obsolete 'icalendar-convert-diary-to-ical 'icalendar-export-file) |
| 879 | 879 | ||
| 880 | (defvar icalendar--uid-count 0 | ||
| 881 | "Auxiliary counter for creating unique ids.") | ||
| 882 | |||
| 883 | (defun icalendar--create-uid () | ||
| 884 | "Create a unique identifier. | ||
| 885 | Use `current-time' and a counter to create unique ids. The | ||
| 886 | counter is necessary for systems which do not provide resolution | ||
| 887 | finer than a second." | ||
| 888 | (setq icalendar--uid-count (1+ icalendar--uid-count)) | ||
| 889 | (format "emacs%d%d%d%d" | ||
| 890 | (car (current-time)) | ||
| 891 | (cadr (current-time)) | ||
| 892 | (car (cddr (current-time))) | ||
| 893 | icalendar--uid-count)) | ||
| 894 | |||
| 880 | ;;;###autoload | 895 | ;;;###autoload |
| 881 | (defun icalendar-export-region (min max ical-filename) | 896 | (defun icalendar-export-region (min max ical-filename) |
| 882 | "Export region in diary file to iCalendar format. | 897 | "Export region in diary file to iCalendar format. |
| @@ -916,10 +931,8 @@ FExport diary data into iCalendar file: ") | |||
| 916 | (if (match-beginning 2) | 931 | (if (match-beginning 2) |
| 917 | (setq entry-rest (match-string 2)) | 932 | (setq entry-rest (match-string 2)) |
| 918 | (setq entry-rest "")) | 933 | (setq entry-rest "")) |
| 919 | (setq header (format "\nBEGIN:VEVENT\nUID:emacs%d%d%d" | 934 | (setq header (format "\nBEGIN:VEVENT\nUID:%s" |
| 920 | (car (current-time)) | 935 | (icalendar--create-uid))) |
| 921 | (cadr (current-time)) | ||
| 922 | (car (cddr (current-time))))) | ||
| 923 | (condition-case error-val | 936 | (condition-case error-val |
| 924 | (progn | 937 | (progn |
| 925 | (setq contents-n-summary | 938 | (setq contents-n-summary |