emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John Wiegley <jwiegley@gmail.com>
To: emacs-org list <emacs-orgmode@gnu.org>
Cc: Carsten Dominik <carsten.dominik@gmail.com>
Subject: Subtly hightling task backgrounds
Date: Thu, 30 Jun 2011 11:28:09 -0500	[thread overview]
Message-ID: <5A411870-F03C-4DC0-A133-FE01920A4BD1@gmail.com> (raw)

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

Here is a screenshot of the effect, from my today's agenda:



(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

To achieve this, I have the following in my todo file:

  * Work
    :CATEGORY: Work
    :OVERLAY:  (face (:background \"#fdfdeb\"))
  ** TODO Task
  * Family
    :CATEGORY: Personal
    :OVERLAY:  (face (:background \"#e8f9e8\"))
  ** TODO Task
  * Personal
    :CATEGORY: Personal
    :OVERLAY:  (face (:background \"#e8eff9\"))
  ** 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)))
      (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)
                      (proplist (read overlays)))
                  (while proplist
                    (overlay-put ol (car proplist) (cadr proplist))
                    (setq proplist (cddr proplist))))))))

(add-hook 'org-finalize-agenda-hook 'org-agenda-add-overlays)

             reply	other threads:[~2011-06-30 16:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-30 16:28 John Wiegley [this message]
2011-06-30 21:12 ` Subtly hightling task backgrounds Eric S Fraga
2011-06-30 21:13   ` John Wiegley
2011-06-30 21:19     ` Eric S Fraga
2011-07-01  8:53 ` Bastien
2011-07-02 21:07   ` John Wiegley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5A411870-F03C-4DC0-A133-FE01920A4BD1@gmail.com \
    --to=jwiegley@gmail.com \
    --cc=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).