Permalink
Browse files

Make the command used to read the date in `cfw:navi-goto-date-command…

…' customizable and provide two possible functions
  • Loading branch information...
1 parent 2375195 commit 81bbea8ef0e344ce4dce74985be85fdd79f14ab8 Philipp Haselwarter committed Dec 8, 2011
Showing with 19 additions and 3 deletions.
  1. +5 −0 calfw-org.el
  2. +14 −3 calfw.el
View
@@ -217,6 +217,11 @@ TEXT1 < TEXT2. This function makes no-time items in front of timed-items."
;; exec org-remember here?
))
+(defun cfw:org-read-date-command ()
+ "Move the cursor to the specified date."
+ (interactive)
+ (cfw:emacs-to-calendar (org-read-date nil 'to-time)))
+
;; (progn (eval-current-buffer) (cfw:open-org-calendar))
;; (setq org-agenda-files '("./org-samples/complex.org"))
View
@@ -110,6 +110,12 @@
:group 'cfw
:type 'character)
+(defcustom cfw:read-date-command 'cfw:read-date-command-simple
+ "The command used to read the date in `cfw:navi-goto-date-command',
+for example `cfw:read-date-command-simple' or `cfw:org-read-date-command'."
+ :group 'cfw
+ :type 'function)
+
;;; Faces
(defface cfw:face-title
@@ -347,6 +353,11 @@ ones of DATE2. Otherwise is `nil'."
"Transform the string format YYYY/MM/DD to a calendar date value."
(cfw:emacs-to-calendar (cfw:parsetime-emacs str)))
+(defun cfw:read-date-command-simple (string-date)
+ "Move the cursor to the specified date."
+ (interactive "sInput Date (YYYY/MM/DD): ")
+ (cfw:parsetime string-date))
+
(defun cfw:enumerate-days (begin end)
"Enumerate date objects between BEGIN and END."
(when (> (calendar-absolute-from-gregorian begin)
@@ -2288,10 +2299,10 @@ With prefix arg NO-RESIZE, don't fit calendar to window size."
(cfw:week-end-date
(cfw:cp-get-selected-date (cfw:cp-get-component))))))
-(defun cfw:navi-goto-date-command (string-date)
+(defun cfw:navi-goto-date-command ()
"Move the cursor to the specified date."
- (interactive "sInput Date (YYYY/MM/DD): ")
- (cfw:navi-goto-date (cfw:parsetime string-date)))
+ (interactive)
+ (cfw:navi-goto-date (call-interactively cfw:read-date-command)))
(defun cfw:navi-goto-today-command ()
"Move the cursor to today."

0 comments on commit 81bbea8

Please sign in to comment.