Browse Source

Add current time to time grid in agenda

* lisp/org-faces.el (org-agenda-current-time): New face.
* lisp/org-agenda.el (org-agenda-show-current-time-in-grid):
(org-agenda-current-time-string): New options.
(org-agenda-add-time-grid-maybe): Add current time to time grid.
Carsten Dominik 14 years ago
parent
commit
1495bc6b08
2 changed files with 24 additions and 0 deletions
  1. 21 0
      lisp/org-agenda.el
  2. 3 0
      lisp/org-faces.el

+ 21 - 0
lisp/org-agenda.el

@@ -1183,6 +1183,17 @@ a grid line."
     (string :tag "Grid String")
     (repeat :tag "Grid Times" (integer :tag "Time"))))
 
+(defcustom org-agenda-show-current-time-in-grid t
+  "Non-nil means show the current time in the time grid."
+  :group 'org-agenda-time-grid
+  :type 'boolean)
+
+(defcustom org-agenda-current-time-string
+  "now - - - - - - - - - - - - - - - - - - - - - - - - -"
+  "The string for the current time marker in the agenda."
+  :group 'org-agenda-time-grid
+  :type 'string)
+
 (defgroup org-agenda-sorting nil
   "Options concerning sorting in the Org-mode Agenda."
   :tag "Org Agenda Sorting"
@@ -5342,6 +5353,16 @@ The modified list may contain inherited tags, and tags matched by
 		new)
 	  (put-text-property
 	   2 (length (car new)) 'face 'org-time-grid (car new))))
+      (when org-agenda-show-current-time-in-grid
+	(push (org-format-agenda-item
+	       nil 
+	       org-agenda-current-time-string
+	       "" nil
+	       (format-time-string "%H:%M "))
+	      new)
+	(put-text-property
+	 2 (length (car new)) 'face 'org-agenda-current-time (car new)))
+
       (if (member 'time-up org-agenda-sorting-strategy-selected)
 	  (append new list)
 	(append list new)))))

+ 3 - 0
lisp/org-faces.el

@@ -667,6 +667,9 @@ month and 365.24 days for a year)."
   "Face used for time grids."
   :group 'org-faces)
 
+(org-copy-face 'org-time-grid 'org-agenda-current-time
+  "Face used to show the current time in the time grid.")
+
 (defface org-agenda-diary
   (org-compatible-face 'default
     nil)