Mercurial > emacs
comparison lisp/calendar/icalendar.el @ 99284:b39c4aef1848
icalendar: uid-creation improved
author | Ulf Jasper <ulf.jasper@web.de> |
---|---|
date | Fri, 31 Oct 2008 18:27:05 +0000 |
parents | 4d3975347028 |
children | a9dc0e7c3f2b |
comparison
equal
deleted
inserted
replaced
99283:563e71d339f2 | 99284:b39c4aef1848 |
---|---|
875 (icalendar-export-region (point-min) (point-max) ical-filename))) | 875 (icalendar-export-region (point-min) (point-max) ical-filename))) |
876 | 876 |
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. |
883 All diary entries in the region from MIN to MAX in the current buffer are | 898 All diary entries in the region from MIN to MAX in the current buffer are |
884 converted to iCalendar format. The result is appended to the file | 899 converted to iCalendar format. The result is appended to the file |
914 "^\\([^ \t\n&#].+\\)\\(\\(\n[ \t].*\\)*\\)") max t) | 929 "^\\([^ \t\n&#].+\\)\\(\\(\n[ \t].*\\)*\\)") max t) |
915 (setq entry-main (match-string 1)) | 930 (setq entry-main (match-string 1)) |
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 |
926 (icalendar--convert-to-ical nonmarker entry-main)) | 939 (icalendar--convert-to-ical nonmarker entry-main)) |
927 (setq other-elements (icalendar--parse-summary-and-rest | 940 (setq other-elements (icalendar--parse-summary-and-rest |