Function: todo-set-date-from-calendar

todo-set-date-from-calendar is a byte-compiled function defined in todo-mode.el.gz.

Signature

(todo-set-date-from-calendar)

Documentation

Return string of date chosen from Calendar.

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/todo-mode.el.gz
(defun todo-set-date-from-calendar ()
  "Return string of date chosen from Calendar."
  (cond ((and (stringp todo-date-from-calendar)
	      (string-match todo-date-pattern todo-date-from-calendar))
	 todo-date-from-calendar)
	(todo-date-from-calendar
	 (let (calendar-view-diary-initially-flag)
	   (calendar))                  ; *Calendar* is now current buffer.
	 (define-key calendar-mode-map [remap newline] 'exit-recursive-edit)
	 ;; If user exits Calendar before choosing a date, clean up properly.
	 (define-key calendar-mode-map
	   [remap calendar-exit] (lambda ()
				    (interactive)
				    (progn
				      (calendar-exit)
				      (exit-recursive-edit))))
	 (message "Put cursor on a date and type <return> to set it.")
	 (recursive-edit)
	 (unwind-protect
	     (when (equal (buffer-name) calendar-buffer)
	       (setq todo-date-from-calendar
		     (calendar-date-string (calendar-cursor-to-date t) t t))
	       (calendar-exit)
	       todo-date-from-calendar)
	   (define-key calendar-mode-map [remap newline] nil)
	   (define-key calendar-mode-map [remap calendar-exit] nil)
	   (unless (zerop (recursion-depth)) (exit-recursive-edit))
	   (when (stringp todo-date-from-calendar)
	     todo-date-from-calendar)))))