summaryrefslogtreecommitdiff
path: root/lisp/calendar
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2007-03-21 07:15:44 +0000
committerGlenn Morris <rgm@gnu.org>2007-03-21 07:15:44 +0000
commit76b0b55fd66b3dd0217244d2075add4e7eaccb06 (patch)
tree29b3efb356784feccdb902ac03e475c0c1d91fab /lisp/calendar
parent04171c28db1dc04d9f5438855215f13377c61f32 (diff)
downloademacs-76b0b55fd66b3dd0217244d2075add4e7eaccb06.tar.gz
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/calendar')
-rw-r--r--lisp/calendar/icalendar.el50
1 files changed, 29 insertions, 21 deletions
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 @@
;;; Code:
-(defconst icalendar-version "0.14"
+(defconst icalendar-version "0.15"
"Version number of icalendar.el.")
;; ======================================================================
@@ -226,16 +226,17 @@ buffer."
(replace-match "" nil nil)))
unfolded-buffer))
-(defsubst icalendar--rris (&rest args)
+(defsubst icalendar--rris (regexp rep string &optional fixedcase literal)
"Replace regular expression in string.
-Pass ARGS to `replace-regexp-in-string' (Emacs) or to
-`replace-in-string' (XEmacs)."
- (if (fboundp 'replace-regexp-in-string)
- ;; Emacs:
- (apply 'replace-regexp-in-string args)
- ;; XEmacs:
- (save-match-data ;; apparently XEmacs needs save-match-data
- (apply 'replace-in-string args))))
+Pass arguments REGEXP REP STRING FIXEDCASE LITERAL to
+`replace-regexp-in-string' (Emacs) or to `replace-in-string' (XEmacs)."
+ (cond ((fboundp 'replace-regexp-in-string)
+ ;; Emacs:
+ (replace-regexp-in-string regexp rep string fixedcase literal))
+ ((fboundp 'replace-in-string)
+ ;; XEmacs:
+ (save-match-data ;; apparently XEmacs needs save-match-data
+ (replace-in-string string regexp rep literal)))))
(defun icalendar--read-element (invalue inparams)
"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
DIARY-FILE.
It will ask for each appointment whether to add it to the diary
-when DO-NOT-ASK is non-nil. When called interactively,
-DO-NOT-ASK is set to t, so that you are asked fore each event.
+unless DO-NOT-ASK is non-nil. When called interactively,
+DO-NOT-ASK is nil, so that you are asked for each event.
NON-MARKING determines whether diary events are created as
non-marking.
@@ -1669,8 +1670,11 @@ written into the buffer `*icalendar-errors*'."
(concat diary-string " "
(icalendar--format-ical-event e)))
(if do-not-ask (setq summary nil))
- (icalendar--add-diary-entry diary-string diary-file
- non-marking summary))
+ ;; add entry to diary and store actual name of diary
+ ;; file (in case it was nil)
+ (setq diary-file
+ (icalendar--add-diary-entry diary-string diary-file
+ non-marking summary)))
;; event was not ok
(setq found-error t)
(setq error-string
@@ -1684,13 +1688,15 @@ written into the buffer `*icalendar-errors*'."
(setq error-string (format "%s\n%s\nCannot handle this event: %s"
error-val error-string e))
(message "%s" error-string))))
+
;; insert final newline
- (let ((b (find-buffer-visiting diary-file)))
- (when b
- (save-current-buffer
- (set-buffer b)
- (goto-char (point-max))
- (insert "\n"))))
+ (if diary-file
+ (let ((b (find-buffer-visiting diary-file)))
+ (when b
+ (save-current-buffer
+ (set-buffer b)
+ (goto-char (point-max))
+ (insert "\n")))))
(if found-error
(save-current-buffer
(set-buffer (get-buffer-create "*icalendar-errors*"))
@@ -1943,7 +1949,9 @@ the entry."
(setq diary-file
(read-file-name "Add appointment to this diary file: ")))
;; Note: make-diary-entry will add a trailing blank char.... :(
- (make-diary-entry string non-marking diary-file))))
+ (make-diary-entry string non-marking diary-file)))
+ ;; return diary-file in case it has been changed interactively
+ diary-file)
(provide 'icalendar)