aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorGlenn Morris2007-03-21 07:15:44 +0000
committerGlenn Morris2007-03-21 07:15:44 +0000
commit76b0b55fd66b3dd0217244d2075add4e7eaccb06 (patch)
tree29b3efb356784feccdb902ac03e475c0c1d91fab /lisp
parent04171c28db1dc04d9f5438855215f13377c61f32 (diff)
downloademacs-76b0b55fd66b3dd0217244d2075add4e7eaccb06.tar.gz
emacs-76b0b55fd66b3dd0217244d2075add4e7eaccb06.zip
Ulf Jasper <ulf.jasper at web.de>:
(icalendar-version): Increase to 0.15. (icalendar--get-unfolded-buffer): Define actual arguments rather than just using &rest. Check replace-in-string is fbound. (icalendar-import-buffer): Doc fix. (icalendar--convert-ical-to-diary): Set diary-file. Check diary-file before inserting final newline. (icalendar--add-diary-entry): Return diary-file.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog10
-rw-r--r--lisp/calendar/icalendar.el50
2 files changed, 39 insertions, 21 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index f4633f517ef..9790bc8c0e9 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,13 @@
12007-03-21 Ulf Jasper <ulf.jasper@web.de>
2
3 * calendar/icalendar.el (icalendar-version): Increase to 0.15.
4 (icalendar--get-unfolded-buffer): Define actual arguments rather
5 than just using &rest. Check replace-in-string is fbound.
6 (icalendar-import-buffer): Doc fix.
7 (icalendar--convert-ical-to-diary): Set diary-file. Check
8 diary-file before inserting final newline.
9 (icalendar--add-diary-entry): Return diary-file.
10
12007-03-21 Glenn Morris <rgm@gnu.org> 112007-03-21 Glenn Morris <rgm@gnu.org>
2 12
3 * calendar/calendar.el (diary-set-maybe-redraw): Autoload it. 13 * calendar/calendar.el (diary-set-maybe-redraw): Autoload it.
diff --git a/lisp/calendar/icalendar.el b/lisp/calendar/icalendar.el
index cb9885fc125..7bbd12a436e 100644
--- a/lisp/calendar/icalendar.el
+++ b/lisp/calendar/icalendar.el
@@ -101,7 +101,7 @@
101 101
102;;; Code: 102;;; Code:
103 103
104(defconst icalendar-version "0.14" 104(defconst icalendar-version "0.15"
105 "Version number of icalendar.el.") 105 "Version number of icalendar.el.")
106 106
107;; ====================================================================== 107;; ======================================================================
@@ -226,16 +226,17 @@ buffer."
226 (replace-match "" nil nil))) 226 (replace-match "" nil nil)))
227 unfolded-buffer)) 227 unfolded-buffer))
228 228
229(defsubst icalendar--rris (&rest args) 229(defsubst icalendar--rris (regexp rep string &optional fixedcase literal)
230 "Replace regular expression in string. 230 "Replace regular expression in string.
231Pass ARGS to `replace-regexp-in-string' (Emacs) or to 231Pass arguments REGEXP REP STRING FIXEDCASE LITERAL to
232`replace-in-string' (XEmacs)." 232`replace-regexp-in-string' (Emacs) or to `replace-in-string' (XEmacs)."
233 (if (fboundp 'replace-regexp-in-string) 233 (cond ((fboundp 'replace-regexp-in-string)
234 ;; Emacs: 234 ;; Emacs:
235 (apply 'replace-regexp-in-string args) 235 (replace-regexp-in-string regexp rep string fixedcase literal))
236 ;; XEmacs: 236 ((fboundp 'replace-in-string)
237 (save-match-data ;; apparently XEmacs needs save-match-data 237 ;; XEmacs:
238 (apply 'replace-in-string args)))) 238 (save-match-data ;; apparently XEmacs needs save-match-data
239 (replace-in-string string regexp rep literal)))))
239 240
240(defun icalendar--read-element (invalue inparams) 241(defun icalendar--read-element (invalue inparams)
241 "Recursively read the next iCalendar element in the current buffer. 242 "Recursively read the next iCalendar element in the current buffer.
@@ -1472,8 +1473,8 @@ object, reads it and adds all VEVENT elements to the diary
1472DIARY-FILE. 1473DIARY-FILE.
1473 1474
1474It will ask for each appointment whether to add it to the diary 1475It will ask for each appointment whether to add it to the diary
1475when DO-NOT-ASK is non-nil. When called interactively, 1476unless DO-NOT-ASK is non-nil. When called interactively,
1476DO-NOT-ASK is set to t, so that you are asked fore each event. 1477DO-NOT-ASK is nil, so that you are asked for each event.
1477 1478
1478NON-MARKING determines whether diary events are created as 1479NON-MARKING determines whether diary events are created as
1479non-marking. 1480non-marking.
@@ -1669,8 +1670,11 @@ written into the buffer `*icalendar-errors*'."
1669 (concat diary-string " " 1670 (concat diary-string " "
1670 (icalendar--format-ical-event e))) 1671 (icalendar--format-ical-event e)))
1671 (if do-not-ask (setq summary nil)) 1672 (if do-not-ask (setq summary nil))
1672 (icalendar--add-diary-entry diary-string diary-file 1673 ;; add entry to diary and store actual name of diary
1673 non-marking summary)) 1674 ;; file (in case it was nil)
1675 (setq diary-file
1676 (icalendar--add-diary-entry diary-string diary-file
1677 non-marking summary)))
1674 ;; event was not ok 1678 ;; event was not ok
1675 (setq found-error t) 1679 (setq found-error t)
1676 (setq error-string 1680 (setq error-string
@@ -1684,13 +1688,15 @@ written into the buffer `*icalendar-errors*'."
1684 (setq error-string (format "%s\n%s\nCannot handle this event: %s" 1688 (setq error-string (format "%s\n%s\nCannot handle this event: %s"
1685 error-val error-string e)) 1689 error-val error-string e))
1686 (message "%s" error-string)))) 1690 (message "%s" error-string))))
1691
1687 ;; insert final newline 1692 ;; insert final newline
1688 (let ((b (find-buffer-visiting diary-file))) 1693 (if diary-file
1689 (when b 1694 (let ((b (find-buffer-visiting diary-file)))
1690 (save-current-buffer 1695 (when b
1691 (set-buffer b) 1696 (save-current-buffer
1692 (goto-char (point-max)) 1697 (set-buffer b)
1693 (insert "\n")))) 1698 (goto-char (point-max))
1699 (insert "\n")))))
1694 (if found-error 1700 (if found-error
1695 (save-current-buffer 1701 (save-current-buffer
1696 (set-buffer (get-buffer-create "*icalendar-errors*")) 1702 (set-buffer (get-buffer-create "*icalendar-errors*"))
@@ -1943,7 +1949,9 @@ the entry."
1943 (setq diary-file 1949 (setq diary-file
1944 (read-file-name "Add appointment to this diary file: "))) 1950 (read-file-name "Add appointment to this diary file: ")))
1945 ;; Note: make-diary-entry will add a trailing blank char.... :( 1951 ;; Note: make-diary-entry will add a trailing blank char.... :(
1946 (make-diary-entry string non-marking diary-file)))) 1952 (make-diary-entry string non-marking diary-file)))
1953 ;; return diary-file in case it has been changed interactively
1954 diary-file)
1947 1955
1948(provide 'icalendar) 1956(provide 'icalendar)
1949 1957