emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* PATCH: Habit consistency always show DONE days green option
@ 2013-05-06 14:47 Max Mikhanosha
  2013-05-06 20:10 ` Viktor Rosenfeld
  2013-05-07 10:30 ` Bastien
  0 siblings, 2 replies; 3+ messages in thread
From: Max Mikhanosha @ 2013-05-06 14:47 UTC (permalink / raw)
  To: emacs-orgmode

I had always disliked how if you miss a habit deadline and then go on
a several day streak, first day still show up red. Makes it hard to
visually see "green streaks"

Following patch adds a new variable `org-habit-show-done-always-green'
to fix that. It defaults to off, if enough people like it we can
make it new default.

To illustrate the difference in display, try to count number of two
day streaks in below screen-shots.

Current display:

   http://i.imgur.com/HlyXE2o.png

With new option:

   http://i.imgur.com/3ZmImkP.png

Note that no information is lost, you can still figure out if streak
started after missing a deadline, by color of the previous day.

Regards,
  Max

From 5c7f9b63b6021631b19b883760340a18024e6344 Mon Sep 17 00:00:00 2001
From: Max Mikhanosha <max@openchat.com>
Date: Mon, 6 May 2013 09:26:10 -0400
Subject: [PATCH] Add option to always show DONE days as green on consistency
 graph. It can be enabled by setting
 `org-habit-show-done-alwyays-green' variable to t.

* lisp/org-habit.el (org-habit-get-faces): Add show done days green option
---
 lisp/org-habit.el | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/lisp/org-habit.el b/lisp/org-habit.el
index 8465ba4..0899f45 100644
--- a/lisp/org-habit.el
+++ b/lisp/org-habit.el
@@ -85,6 +85,12 @@ (defcustom org-habit-completed-glyph ?*
   :version "24.1"
   :type 'character)
 
+(defcustom org-habit-show-done-always-green nil
+  "If non-nil, a DONE day will always be green in consistency
+graph, even if it was done after deadline"
+  :group 'org-habit
+  :type 'boolean)
+
 (defface org-habit-clear-face
   '((((background light)) (:background "#8270f9"))
     (((background dark)) (:background "blue")))
@@ -272,8 +278,9 @@ (defun org-habit-get-faces (habit &optional now-days scheduled-days donep)
       (if donep
 	  '(org-habit-ready-face . org-habit-ready-future-face)
 	'(org-habit-alert-face . org-habit-alert-future-face)))
-     (t
-      '(org-habit-overdue-face . org-habit-overdue-future-face)))))
+     ((and org-habit-show-done-always-green donep)
+      '(org-habit-ready-face . org-habit-ready-future-face))
+     (t '(org-habit-overdue-face . org-habit-overdue-future-face)))))
 
 (defun org-habit-build-graph (habit starting current ending)
   "Build a graph for the given HABIT, from STARTING to ENDING.
-- 
1.7.11.rc0.100.g5498c5f

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

* Re: PATCH: Habit consistency always show DONE days green option
  2013-05-06 14:47 PATCH: Habit consistency always show DONE days green option Max Mikhanosha
@ 2013-05-06 20:10 ` Viktor Rosenfeld
  2013-05-07 10:30 ` Bastien
  1 sibling, 0 replies; 3+ messages in thread
From: Viktor Rosenfeld @ 2013-05-06 20:10 UTC (permalink / raw)
  To: Max Mikhanosha; +Cc: emacs-orgmode

Love this patch!

Much more pleasing to the eye.

Cheers,
Viktor

Max Mikhanosha wrote:

> I had always disliked how if you miss a habit deadline and then go on
> a several day streak, first day still show up red. Makes it hard to
> visually see "green streaks"
> 
> Following patch adds a new variable `org-habit-show-done-always-green'
> to fix that. It defaults to off, if enough people like it we can
> make it new default.
> 
> To illustrate the difference in display, try to count number of two
> day streaks in below screen-shots.
> 
> Current display:
> 
>    http://i.imgur.com/HlyXE2o.png
> 
> With new option:
> 
>    http://i.imgur.com/3ZmImkP.png
> 
> Note that no information is lost, you can still figure out if streak
> started after missing a deadline, by color of the previous day.
> 
> Regards,
>   Max
> 
> From 5c7f9b63b6021631b19b883760340a18024e6344 Mon Sep 17 00:00:00 2001
> From: Max Mikhanosha <max@openchat.com>
> Date: Mon, 6 May 2013 09:26:10 -0400
> Subject: [PATCH] Add option to always show DONE days as green on consistency
>  graph. It can be enabled by setting
>  `org-habit-show-done-alwyays-green' variable to t.
> 
> * lisp/org-habit.el (org-habit-get-faces): Add show done days green option
> ---
>  lisp/org-habit.el | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/lisp/org-habit.el b/lisp/org-habit.el
> index 8465ba4..0899f45 100644
> --- a/lisp/org-habit.el
> +++ b/lisp/org-habit.el
> @@ -85,6 +85,12 @@ (defcustom org-habit-completed-glyph ?*
>    :version "24.1"
>    :type 'character)
>  
> +(defcustom org-habit-show-done-always-green nil
> +  "If non-nil, a DONE day will always be green in consistency
> +graph, even if it was done after deadline"
> +  :group 'org-habit
> +  :type 'boolean)
> +
>  (defface org-habit-clear-face
>    '((((background light)) (:background "#8270f9"))
>      (((background dark)) (:background "blue")))
> @@ -272,8 +278,9 @@ (defun org-habit-get-faces (habit &optional now-days scheduled-days donep)
>        (if donep
>  	  '(org-habit-ready-face . org-habit-ready-future-face)
>  	'(org-habit-alert-face . org-habit-alert-future-face)))
> -     (t
> -      '(org-habit-overdue-face . org-habit-overdue-future-face)))))
> +     ((and org-habit-show-done-always-green donep)
> +      '(org-habit-ready-face . org-habit-ready-future-face))
> +     (t '(org-habit-overdue-face . org-habit-overdue-future-face)))))
>  
>  (defun org-habit-build-graph (habit starting current ending)
>    "Build a graph for the given HABIT, from STARTING to ENDING.
> -- 
> 1.7.11.rc0.100.g5498c5f
> 
> 
> 

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

* Re: PATCH: Habit consistency always show DONE days green option
  2013-05-06 14:47 PATCH: Habit consistency always show DONE days green option Max Mikhanosha
  2013-05-06 20:10 ` Viktor Rosenfeld
@ 2013-05-07 10:30 ` Bastien
  1 sibling, 0 replies; 3+ messages in thread
From: Bastien @ 2013-05-07 10:30 UTC (permalink / raw)
  To: Max Mikhanosha; +Cc: emacs-orgmode

Hi Max,

Max Mikhanosha <max@openchat.com> writes:

> Following patch adds a new variable `org-habit-show-done-always-green'
> to fix that. It defaults to off, if enough people like it we can
> make it new default.

Applied in master, thanks!

-- 
 Bastien

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

end of thread, other threads:[~2013-05-07 10:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-06 14:47 PATCH: Habit consistency always show DONE days green option Max Mikhanosha
2013-05-06 20:10 ` Viktor Rosenfeld
2013-05-07 10:30 ` Bastien

Code repositories for project(s) associated with this public 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).