Function: org-agenda-execute-calendar-command

org-agenda-execute-calendar-command is a byte-compiled function defined in org-agenda.el.gz.

Signature

(org-agenda-execute-calendar-command CMD)

Documentation

Execute a calendar command from the agenda with date from cursor.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-agenda.el.gz
(defun org-agenda-execute-calendar-command (cmd)
  "Execute a calendar command from the agenda with date from cursor."
  (org-agenda-check-type t 'agenda)
  (require 'diary-lib)
  (unless (get-text-property (min (1- (point-max)) (point)) 'day)
    (user-error "Don't know which date to use for the calendar command"))
  (let* ((oldf (symbol-function 'calendar-cursor-to-date))
	 (point (point))
	 (date (calendar-gregorian-from-absolute
		(get-text-property point 'day))))
    ;; the following 2 vars are needed in the calendar
    (org-dlet
	((displayed-month (car date))
	 (displayed-year (nth 2 date)))
      (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)))))