summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Dominik <carsten.dominik@gmail.com>2010-12-12 09:25:03 +0100
committerCarsten Dominik <carsten.dominik@gmail.com>2010-12-12 09:26:01 +0100
commit1495bc6b080b8188421a68504001b9c4fac9b93f (patch)
tree89c27571c0d1d589b68f101ebd05f81cc5985e88
parentad006dea13fcc4a5d6c6eba4639aac72efac61d7 (diff)
downloadorg-mode-1495bc6b080b8188421a68504001b9c4fac9b93f.tar.gz
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.
-rw-r--r--lisp/org-agenda.el21
-rw-r--r--lisp/org-faces.el3
2 files changed, 24 insertions, 0 deletions
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 0240b17..fb26ee9 100644
--- a/lisp/org-agenda.el
+++ b/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)))))
diff --git a/lisp/org-faces.el b/lisp/org-faces.el
index 3f82457..4f4af9c 100644
--- a/lisp/org-faces.el
+++ b/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)