Function: org-icalendar-export-current-agenda

org-icalendar-export-current-agenda is a byte-compiled function defined in ox-icalendar.el.gz.

Signature

(org-icalendar-export-current-agenda FILE)

Documentation

Export current agenda view to an iCalendar FILE.

This function assumes major mode for current buffer is org-agenda-mode.

Source Code

;; Defined in /usr/src/emacs/lisp/org/ox-icalendar.el.gz
(defun org-icalendar-export-current-agenda (file)
  "Export current agenda view to an iCalendar FILE.
This function assumes major mode for current buffer is
`org-agenda-mode'."
  (let* ((org-export-use-babel)		;don't evaluate Babel blocks
	 (contents
	  (org-export-string-as
	   (with-output-to-string
	     (save-excursion
	       (let ((p (point-min))
		     (seen nil))	;prevent duplicates
		 (while (setq p (next-single-property-change p 'org-hd-marker))
		   (let ((m (get-text-property p 'org-hd-marker)))
		     (when (and m (not (member m seen)))
		       (push m seen)
		       (with-current-buffer (marker-buffer m)
			 (org-with-wide-buffer
			  (goto-char (marker-position m))
			  (princ
			   (org-element-normalize-string
			    (buffer-substring (point)
					      (org-entry-end-position))))))))
		   (forward-line)))))
	   'icalendar t
	   '(:ascii-charset utf-8 :ascii-links-to-notes nil
			    :icalendar-include-todo all))))
    (with-temp-file file
      (insert
       (org-icalendar--vcalendar
	org-icalendar-combined-name
	user-full-name
	(or (org-string-nw-p org-icalendar-timezone) (format-time-string "%Z"))
	org-icalendar-combined-description
	contents)))
    (run-hook-with-args 'org-icalendar-after-save-hook file)))