From 1495bc6b080b8188421a68504001b9c4fac9b93f Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Sun, 12 Dec 2010 09:25:03 +0100 Subject: [PATCH] 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. --- lisp/org-agenda.el | 21 +++++++++++++++++++++ lisp/org-faces.el | 3 +++ 2 files changed, 24 insertions(+) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 0240b1773..fb26ee9d3 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 3f8245758..4f4af9cd2 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)