소스 검색

Better compliance with `org-extend-today-until'.

Carsten Dominik 16 년 전
부모
커밋
d6cabfc6b2
2개의 변경된 파일17개의 추가작업 그리고 2개의 파일을 삭제
  1. 4 0
      lisp/ChangeLog
  2. 13 2
      lisp/org-agenda.el

+ 4 - 0
lisp/ChangeLog

@@ -1,5 +1,9 @@
 2008-09-13  Carsten Dominik  <dominik@science.uva.nl>
 
+	* org-agenda.el (org-agenda-todayp): New function.
+	(org-agenda-get-deadlines, org-agenda-get-scheduled): Use
+	`org-agenda-todayp'.
+
 	* org.el (org-insert-heading-respect-content)
 	(org-insert-todo-heading-respect-content): New commands.
 	(org-insert-heading-respect-content): New option.

+ 13 - 2
lisp/org-agenda.el

@@ -3379,7 +3379,7 @@ the documentation of `org-diary'."
 		      (format "mouse-2 or RET jump to org file %s"
 			      (abbreviate-file-name buffer-file-name))))
 	 (regexp org-deadline-time-regexp)
-	 (todayp (equal date (calendar-current-date))) ; DATE bound by calendar
+	 (todayp (org-agenda-todayp date)) ; DATE bound by calendar
 	 (d1 (calendar-absolute-from-gregorian date))  ; DATE bound by calendar
 	 d2 diff dfrac wdays pos pos1 category tags
 	 ee txt head face s upcomingp donep timestr)
@@ -3468,7 +3468,7 @@ FRACTION is what fraction of the head-warning time has passed."
 		      (format "mouse-2 or RET jump to org file %s"
 			      (abbreviate-file-name buffer-file-name))))
 	 (regexp org-scheduled-time-regexp)
-	 (todayp (equal date (calendar-current-date))) ; DATE bound by calendar
+	 (todayp (org-agenda-todayp date)) ; DATE bound by calendar
 	 (d1 (calendar-absolute-from-gregorian date))  ; DATE bound by calendar
 	 d2 diff pos pos1 category tags
 	 ee txt head pastschedp donep face timestr s)
@@ -5366,6 +5366,17 @@ belonging to the \"Work\" category."
 	(message "No event to add")
       (message "Added %d event%s for today" cnt (if (> cnt 1) "s" "")))))
 
+(defun org-agenda-todayp (date)
+  "Does DATE mean today, when considering `org-extend-today-until'?"
+  (let (today h)
+    (if (listp date) (setq date (calendar-absolute-from-gregorian date)))
+    (setq today (calendar-absolute-from-gregorian (calendar-current-date)))
+    (setq h (nth 2 (decode-time (current-time))))
+    (or (and (>= h org-extend-today-until)
+	     (= date today))
+	(and (< h org-extend-today-until)
+	     (= date (1- today))))))
+
 (provide 'org-agenda)
 
 ;; arch-tag: 77f7565d-7c4b-44af-a2df-9f6f7070cff1