Function: diary-icalendar-import-file

diary-icalendar-import-file is an autoloaded, interactive and byte-compiled function defined in diary-icalendar.el.gz.

Signature

(diary-icalendar-import-file FILENAME &optional DIARY-FILENAME QUIETLY NONMARKING)

Documentation

Import iCalendar diary entries from FILENAME into DIARY-FILENAME.

This function parses the first iCalendar VCALENDAR in FILENAME and imports VEVENT, VJOURNAL, and VTODO components to the diary 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.

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.

View in manual

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/diary-icalendar.el.gz
;;;###autoload
(defun di:import-file (filename &optional diary-filename quietly nonmarking)
  "Import iCalendar diary entries from FILENAME into DIARY-FILENAME.

This function parses the first iCalendar VCALENDAR in FILENAME and
imports VEVENT, VJOURNAL, and VTODO components to the diary
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.

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 "iCalendar file: " nil nil 'confirm)
         (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 ((parse-buf (ical:find-unfolded-buffer-visiting filename)))
    (unless parse-buf
      (ical:condition-case err
        (setq parse-buf
              (ical:unfolded-buffer-from-file (expand-file-name filename)))))
    ;; Hand off to `di:import-buffer' for the actual import:
    (if parse-buf
        (with-current-buffer parse-buf
          (di:import-buffer diary-filename quietly nonmarking))
      ;; If we get here, we weren't able to open the file for parsing:
      (warn "Unable to open file %s; see %s"
            filename (buffer-name (ical:error-buffer))))))