Function: org-diary
org-diary is an autoloaded and byte-compiled function defined in
org-agenda.el.gz.
Signature
(org-diary &rest ARGS)
Documentation
Return diary information from org files.
This function can be used in a "sexp" diary entry in the Emacs calendar.
It accesses org files and extracts information from those files to be
listed in the diary. The function accepts arguments specifying what
items should be listed. For a list of arguments allowed here, see the
variable org-agenda-entry-types.
The call in the diary file should look like this:
&%%(org-diary) ~/path/to/some/orgfile.org
Use a separate line for each org file to check. Or, if you omit the file name,
all files listed in org-agenda-files(var)/org-agenda-files(fun) will be checked automatically:
&%%(org-diary)
If you don't give any arguments (as in the example above), the default value
of org-agenda-entry-types is used: (:deadline :scheduled :timestamp :sexp).
So the example above may also be written as
&%%(org-diary :deadline :timestamp :sexp :scheduled)
The function expects the lisp variables entry and date to be provided
by the caller, because this is how the calendar works. Don't use this
function from a program - use org-agenda-get-day-entries instead.
Source Code
;; Defined in /usr/src/emacs/lisp/org/org-agenda.el.gz
;;;###autoload
(defun org-diary (&rest args)
"Return diary information from org files.
This function can be used in a \"sexp\" diary entry in the Emacs calendar.
It accesses org files and extracts information from those files to be
listed in the diary. The function accepts arguments specifying what
items should be listed. For a list of arguments allowed here, see the
variable `org-agenda-entry-types'.
The call in the diary file should look like this:
&%%(org-diary) ~/path/to/some/orgfile.org
Use a separate line for each org file to check. Or, if you omit the file name,
all files listed in `org-agenda-files' will be checked automatically:
&%%(org-diary)
If you don't give any arguments (as in the example above), the default value
of `org-agenda-entry-types' is used: (:deadline :scheduled :timestamp :sexp).
So the example above may also be written as
&%%(org-diary :deadline :timestamp :sexp :scheduled)
The function expects the lisp variables `entry' and `date' to be provided
by the caller, because this is how the calendar works. Don't use this
function from a program - use `org-agenda-get-day-entries' instead."
(with-no-warnings (defvar date) (defvar entry))
(when (> (- (float-time)
org-agenda-last-marker-time)
5)
;; I am not sure if this works with sticky agendas, because the marker
;; list is then no longer a global variable.
(org-agenda-reset-markers))
(org-compile-prefix-format 'agenda)
(org-set-sorting-strategy 'agenda)
(setq args (or args org-agenda-entry-types))
(let* ((files (if (and entry (stringp entry) (string-match "\\S-" entry))
(list entry)
(org-agenda-files t)))
(time (float-time))
file rtn results)
(when (or (not org-diary-last-run-time)
(> (- time
org-diary-last-run-time)
3))
(org-agenda-prepare-buffers files))
(setq org-diary-last-run-time time)
;; If this is called during org-agenda, don't return any entries to
;; the calendar. Org Agenda will list these entries itself.
(when org-disable-agenda-to-diary (setq files nil))
(while (setq file (pop files))
(setq rtn (apply #'org-agenda-get-day-entries file date args))
(setq results (append results rtn)))
(when results
(setq results
(mapcar (lambda (i) (replace-regexp-in-string
org-link-bracket-re "\\2" i))
results))
(concat (org-agenda-finalize-entries results) "\n"))))