Function: org-agenda-diary-entry
org-agenda-diary-entry is an interactive and byte-compiled function
defined in org-agenda.el.gz.
Signature
(org-agenda-diary-entry)
Documentation
Make a diary entry, like the i command from the calendar.
All the standard commands work: block, weekly etc.
When org-agenda-diary-file points to a file,
org-agenda-diary-entry-in-org-file is called instead to create
entries in that Org file.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/org/org-agenda.el.gz
(defun org-agenda-diary-entry ()
"Make a diary entry, like the `i' command from the calendar.
All the standard commands work: block, weekly etc.
When `org-agenda-diary-file' points to a file,
`org-agenda-diary-entry-in-org-file' is called instead to create
entries in that Org file."
(interactive)
(if (not (eq org-agenda-diary-file 'diary-file))
(org-agenda-diary-entry-in-org-file)
(require 'diary-lib)
(let* ((char (read-char-exclusive
"Diary entry: [d]ay [w]eekly [m]onthly [y]early\
[a]nniversary [b]lock [c]yclic"))
(cmd (cdr (assoc char
'((?d . diary-insert-entry)
(?w . diary-insert-weekly-entry)
(?m . diary-insert-monthly-entry)
(?y . diary-insert-yearly-entry)
(?a . diary-insert-anniversary-entry)
(?b . diary-insert-block-entry)
(?c . diary-insert-cyclic-entry)))))
(oldf (symbol-function 'calendar-cursor-to-date))
;; (buf (get-file-buffer (substitute-in-file-name diary-file)))
(point (point))
(mark (or (mark t) (point))))
(unless cmd
(user-error "No command associated with <%c>" char))
(unless (and (get-text-property point 'day)
(or (not (equal ?b char))
(get-text-property mark 'day)))
(user-error "Don't know which date to use for diary entry"))
;; We implement this by hacking the `calendar-cursor-to-date' function
;; and the `calendar-mark-ring' variable. Saves a lot of code.
(let ((calendar-mark-ring
(list (calendar-gregorian-from-absolute
(or (get-text-property mark 'day)
(get-text-property point 'day))))))
(unwind-protect
(progn
(fset 'calendar-cursor-to-date
(lambda (&optional _error _dummy)
(calendar-gregorian-from-absolute
(get-text-property point 'day))))
(call-interactively cmd))
(fset 'calendar-cursor-to-date oldf))))))