Function: org-icalendar-export-agenda-files

org-icalendar-export-agenda-files is an autoloaded, interactive and byte-compiled function defined in ox-icalendar.el.gz.

Signature

(org-icalendar-export-agenda-files &optional ASYNC)

Documentation

Export all agenda files to iCalendar files.

When optional argument ASYNC is non-nil, export happens in an external process.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/org/ox-icalendar.el.gz
;;;###autoload
(defun org-icalendar-export-agenda-files (&optional async)
  "Export all agenda files to iCalendar files.
When optional argument ASYNC is non-nil, export happens in an
external process."
  (interactive)
  (if async
      ;; Asynchronous export is not interactive, so we will not call
      ;; `org-check-agenda-file'.  Instead we remove any non-existent
      ;; agenda file from the list.
      (let ((files (cl-remove-if-not #'file-exists-p (org-agenda-files t))))
	(org-export-async-start
	    (lambda (results)
	      (dolist (f results) (org-export-add-to-stack f 'icalendar)))
	  `(let (output-files)
	     (dolist (file ',files outputfiles)
	       (with-current-buffer (org-get-agenda-file-buffer file)
		 (push (expand-file-name (org-icalendar-export-to-ics))
		       output-files))))))
    (let ((files (org-agenda-files t)))
      (org-agenda-prepare-buffers files)
      (unwind-protect
	  (dolist (file files)
	    (catch 'nextfile
	      (org-check-agenda-file file)
	      (with-current-buffer (org-get-agenda-file-buffer file)
		(condition-case err
                    (org-icalendar-export-to-ics)
                  (error
                   (warn "Exporting %s to icalendar failed: %s"
                         file
                         (error-message-string err))
                   (signal (car err) (cdr err)))))))
	(org-release-buffers org-agenda-new-buffers)))))