emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Subtly hightling task backgrounds
@ 2011-06-30 16:28 John Wiegley
  2011-06-30 21:12 ` Eric S Fraga
  2011-07-01  8:53 ` Bastien
  0 siblings, 2 replies; 6+ messages in thread
From: John Wiegley @ 2011-06-30 16:28 UTC (permalink / raw)
  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)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Subtly hightling task backgrounds
  2011-06-30 16:28 Subtly hightling task backgrounds John Wiegley
@ 2011-06-30 21:12 ` Eric S Fraga
  2011-06-30 21:13   ` John Wiegley
  2011-07-01  8:53 ` Bastien
  1 sibling, 1 reply; 6+ messages in thread
From: Eric S Fraga @ 2011-06-30 21:12 UTC (permalink / raw)
  To: John Wiegley; +Cc: emacs-org list

John Wiegley <jwiegley@gmail.com> writes:

> 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

I am intrigued: what is the multi-coloured bit at the bottom right of your
agenda view?

-- 
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1
: using Org-mode version 7.5 (release_7.5.511.g2b7d)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Subtly hightling task backgrounds
  2011-06-30 21:12 ` Eric S Fraga
@ 2011-06-30 21:13   ` John Wiegley
  2011-06-30 21:19     ` Eric S Fraga
  0 siblings, 1 reply; 6+ messages in thread
From: John Wiegley @ 2011-06-30 21:13 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: emacs-org list

On Jun 30, 2011, at 4:12 PM, Eric S Fraga wrote:

> I am intrigued: what is the multi-coloured bit at the bottom right of your
> agenda view?

That is my Habits graph.  See the Info manual:

  (org)Tracking your habits

John

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Subtly hightling task backgrounds
  2011-06-30 21:13   ` John Wiegley
@ 2011-06-30 21:19     ` Eric S Fraga
  0 siblings, 0 replies; 6+ messages in thread
From: Eric S Fraga @ 2011-06-30 21:19 UTC (permalink / raw)
  To: John Wiegley; +Cc: emacs-org list

John Wiegley <jwiegley@gmail.com> writes:

> On Jun 30, 2011, at 4:12 PM, Eric S Fraga wrote:
>
>> I am intrigued: what is the multi-coloured bit at the bottom right of your
>> agenda view?
>
> That is my Habits graph.  See the Info manual:
>
>   (org)Tracking your habits
>
> John

Ah, yes, yet another feature of org that I have not yet managed to try!
Only so many hours in a day, even with org helping. ;-)

Thanks.

-- 
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1
: using Org-mode version 7.5 (release_7.5.511.g2b7d)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Subtly hightling task backgrounds
  2011-06-30 16:28 Subtly hightling task backgrounds John Wiegley
  2011-06-30 21:12 ` Eric S Fraga
@ 2011-07-01  8:53 ` Bastien
  2011-07-02 21:07   ` John Wiegley
  1 sibling, 1 reply; 6+ messages in thread
From: Bastien @ 2011-07-01  8:53 UTC (permalink / raw)
  To: John Wiegley; +Cc: emacs-org list, Carsten Dominik

Hi John,

John Wiegley <jwiegley@gmail.com> writes:

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

Nice -- maybe a more general implementation would be to let
users assign a color to a category, which is really one defcustom
away from your code.  Would you be willing to submit a patch in
that direction?

Thanks!

-- 
 Bastien

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Subtly hightling task backgrounds
  2011-07-01  8:53 ` Bastien
@ 2011-07-02 21:07   ` John Wiegley
  0 siblings, 0 replies; 6+ messages in thread
From: John Wiegley @ 2011-07-02 21:07 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-org list, Carsten Dominik

On Jul 1, 2011, at 3:53 AM, Bastien wrote:

> John Wiegley <jwiegley@gmail.com> writes:
> 
>> To achieve this, I have the following in my todo file:
> 
> Nice -- maybe a more general implementation would be to let
> users assign a color to a category, which is really one defcustom
> away from your code.  Would you be willing to submit a patch in
> that direction?

I would love to, but I'm just too overtaxed at work now.  I invite anyone
else to hack my patch to death, though. :)

John

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-07-02 21:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-30 16:28 Subtly hightling task backgrounds John Wiegley
2011-06-30 21:12 ` 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

Code repositories for project(s) associated with this inbox:

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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).