From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Wiegley Subject: Subtly hightling task backgrounds Date: Thu, 30 Jun 2011 11:28:09 -0500 Message-ID: <5A411870-F03C-4DC0-A133-FE01920A4BD1@gmail.com> Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([140.186.70.92]:50190) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QcK6B-0000gW-0W for emacs-orgmode@gnu.org; Thu, 30 Jun 2011 12:28:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QcK68-0005cX-PU for emacs-orgmode@gnu.org; Thu, 30 Jun 2011 12:28:14 -0400 Received: from mail-gy0-f169.google.com ([209.85.160.169]:47154) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QcK68-0005cM-Bw for emacs-orgmode@gnu.org; Thu, 30 Jun 2011 12:28:12 -0400 Received: by gyg13 with SMTP id 13so1188577gyg.0 for ; Thu, 30 Jun 2011 09:28:11 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-org list Cc: Carsten Dominik I've been using the following code snippet for many weeks now to great effect. It helps me to "grok" my daily taskload better without increasing the mental burden. See the function's docstring for more info. Here is a screenshot of the effect, from my today's agenda: http://ftp.newartisans.com/pub/highlighting.png John (defun org-agenda-add-overlays (&optional line) "Add overlays found in OVERLAY properties to agenda items. Note that habitual items are excluded, as they already extensively use text properties to draw the habits graph. For example, for work tasks I like to use a subtle, yellow background color; for tasks involving other people, green; and for tasks concerning only myself, blue. This way I know at a glance how different responsibilities are divided for any given day. To achieve this, I have the following in my todo file: * Work :PROPERTIES: :CATEGORY: Work :OVERLAY: (face (:background \"#fdfdeb\")) :END: ** TODO Task * Family :PROPERTIES: :CATEGORY: Personal :OVERLAY: (face (:background \"#e8f9e8\")) :END: ** TODO Task * Personal :PROPERTIES: :CATEGORY: Personal :OVERLAY: (face (:background \"#e8eff9\")) :END: ** TODO Task The colors (which only work well for white backgrounds) are: Yellow: #fdfdeb Green: #e8f9e8 Blue: #e8eff9 To use this function, add it to `org-agenda-finalize-hook': (add-hook 'org-finalize-agenda-hook 'org-agenda-add-overlays)" (let ((inhibit-read-only t) l c (buffer-invisibility-spec '(org-link))) (save-excursion (goto-char (if line (point-at-bol) (point-min))) (while (not (eobp)) (let ((org-marker (get-text-property (point) 'org-marker))) (when (and org-marker (null (overlays-at (point))) (not (get-text-property (point) 'org-habit-p)) (string-match "\\(sched\\|dead\\|todo\\)" (get-text-property (point) 'type))) (let ((overlays (org-entry-get org-marker "OVERLAY" t))) (when overlays (goto-char (line-end-position)) (let ((rest (- (window-width) (current-column)))) (if (> rest 0) (insert (make-string rest ? )))) (let ((ol (make-overlay (line-beginning-position) (line-end-position))) (proplist (read overlays))) (while proplist (overlay-put ol (car proplist) (cadr proplist)) (setq proplist (cddr proplist)))))))) (forward-line))))) (add-hook 'org-finalize-agenda-hook 'org-agenda-add-overlays)