Function: diary-icalendar-import-buffer
diary-icalendar-import-buffer is an autoloaded, interactive and
byte-compiled function defined in diary-icalendar.el.gz.
Signature
(diary-icalendar-import-buffer &optional DIARY-FILENAME QUIETLY ALL-NONMARKING)
Documentation
Import iCalendar events from current buffer into diary.
This function parses the first iCalendar VCALENDAR in the current buffer
and imports VEVENT, VJOURNAL, and VTODO components to the diary file
DIARY-FILENAME (default: diary-file).
For each entry, you are asked whether to add it to the diary unless QUIETLY is non-nil. After all entries are imported, you are also asked if you want to save the diary file unless QUIETLY is non-nil. When called interactively, you are asked if you want to confirm each entry individually; answer No to make QUIETLY non-nil.
ALL-NONMARKING determines whether all diary events are created as non-marking entries. When called interactively, you are asked whether you want to make all entries non-marking.
The formatting of imported entries in the diary depends on a number of
user-customizable variables. Before running this command for the first
time, you may especially wish to check the values of:
diary-file
diary-date-forms
diary-date-insertion-form
calendar-date-style
calendar-date-display-form
as well as variables in the customization group diary-icalendar-import.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/calendar/diary-icalendar.el.gz
;;;###autoload
(defun di:import-buffer (&optional diary-filename quietly all-nonmarking)
"Import iCalendar events from current buffer into diary.
This function parses the first iCalendar VCALENDAR in the current buffer
and imports VEVENT, VJOURNAL, and VTODO components to the diary file
DIARY-FILENAME (default: `diary-file').
For each entry, you are asked whether to add it to the diary unless
QUIETLY is non-nil. After all entries are imported, you are also asked
if you want to save the diary file unless QUIETLY is non-nil. When
called interactively, you are asked if you want to confirm each entry
individually; answer No to make QUIETLY non-nil.
ALL-NONMARKING determines whether all diary events are created as
non-marking entries. When called interactively, you are asked whether
you want to make all entries non-marking.
The formatting of imported entries in the diary depends on a number of
user-customizable variables. Before running this command for the first
time, you may especially wish to check the values of:
`diary-file'
`diary-date-forms'
`diary-date-insertion-form'
`calendar-date-style'
`calendar-date-display-form'
as well as variables in the customization group `diary-icalendar-import'."
(interactive
(list (read-file-name "Diary file: "
(when diary-file (file-name-directory diary-file))
(cons diary-file diary-included-files))
(or di:always-import-quietly
(not (y-or-n-p "Confirm entries individually?")))
(y-or-n-p "Make all entries non-marking?")))
(let* ((diary-file diary-filename) ; dynamically bound for `di:-entry-import',
(di:-entry-count 0) ; see above
(di:-no-queries quietly) ;
(di:post-entry-format-hook
(append di:post-entry-format-hook (list #'di:-entry-import)))
(diary-buffer (or (find-buffer-visiting diary-filename)
(find-file-noselect diary-filename)))
import-buffer)
(unwind-protect
(setq import-buffer (di:import-buffer-to-buffer all-nonmarking))
(when (bufferp import-buffer)
(kill-buffer import-buffer)))
(display-buffer diary-buffer)
(when (or quietly
(y-or-n-p (format "%d entries imported. Save diary file?"
di:-entry-count)))
(with-current-buffer diary-buffer
(goto-char (point-max))
(save-buffer)))))