Function: gnus-icalendar-find-org-event-file

gnus-icalendar-find-org-event-file is a byte-compiled function defined in gnus-icalendar.el.gz.

Signature

(gnus-icalendar-find-org-event-file EVENT &optional ORG-FILE)

Documentation

Return the name of the file containing EVENT org entry.

Return nil when not found.

All org agenda files are searched for the EVENT entry. When the optional ORG-FILE argument is specified, only that one file is searched.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-icalendar.el.gz
(defun gnus-icalendar-find-org-event-file (event &optional org-file)
  "Return the name of the file containing EVENT org entry.
Return nil when not found.

All org agenda files are searched for the EVENT entry.  When
the optional ORG-FILE argument is specified, only that one file
is searched."
  (let ((uid (gnus-icalendar-event:uid event))
        (files (or org-file (org-agenda-files t 'ifmode))))
    (cl-labels
        ((find-event-in
	  (file)
	  (org-check-agenda-file file)
	  (with-current-buffer (find-file-noselect file)
	    (let ((event-pos (org-find-entry-with-id uid)))
	      (when (and event-pos
			 (string= (cdr (assoc "ICAL_EVENT"
					      (org-entry-properties event-pos)))
				  "t"))
		(throw 'found file))))))
      (gnus-icalendar-find-if #'find-event-in files))))