emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] (org-habit-build-graph): Help-echo date when mouse is over stars.
@ 2010-05-04 10:35 Mikael Fornius
  2010-05-13  5:45 ` Carsten Dominik
  0 siblings, 1 reply; 2+ messages in thread
From: Mikael Fornius @ 2010-05-04 10:35 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Mikael Fornius, johnw

Hi John, Carsten and fellow orgs.
 
This patch introduces a small new feature in org-habit I have wanted
for a while:

When mouse is over a done-star in the habit-graph I get a help-echo
with the date.

This is useful because I use many preceeding days and there is no easy
way (that I know of) to find the done-dates when viewing the graph.
Often I ask myself 'hmm when did I do this habit lately' when I am
visually evaluating the habit graph and I get stuck, annoying :)

I think this is a small and tasty feature so feel free to use it in
org-habit if you like it.

---
 lisp/ChangeLog    |    5 +++++
 lisp/org-habit.el |    4 +++-
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 7f1a507..a168d73 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2010-05-04  Mikael Fornius  <mfo@abc.se>
+
+	* org-habit.el (org-habit-build-graph): Help-echo date when
+	mouse is over stars.
+
 2010-05-02  Dan Davison  <davison@stats.ox.ac.uk>
 
 	* org-src.el (org-edit-src-code): allow-write-back-p had
diff --git a/lisp/org-habit.el b/lisp/org-habit.el
index bb8773e..a3a4d19 100644
--- a/lisp/org-habit.el
+++ b/lisp/org-habit.el
@@ -280,9 +280,11 @@ current time."
 		       donep)))
 	     markedp face)
 	(if donep
-	    (progn
+	    (let ((done-time (time-add starting (days-to-time (- start (time-to-days starting))))))
 	      (aset graph index ?*)
 	      (setq markedp t)
+	      (put-text-property index (1+ index) 'help-echo
+				 (format-time-string (org-time-stamp-format) done-time) graph)
 	      (while (and done-dates
 			  (= start (car done-dates)))
 		(setq last-done-date (car done-dates)
-- 
1.7.1

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

* Re: [PATCH] (org-habit-build-graph): Help-echo date when mouse is over stars.
  2010-05-04 10:35 [PATCH] (org-habit-build-graph): Help-echo date when mouse is over stars Mikael Fornius
@ 2010-05-13  5:45 ` Carsten Dominik
  0 siblings, 0 replies; 2+ messages in thread
From: Carsten Dominik @ 2010-05-13  5:45 UTC (permalink / raw)
  To: Mikael Fornius; +Cc: johnw, emacs-orgmode

Applied, thanks - sorry this took so long.

- Carsten

On May 4, 2010, at 12:35 PM, Mikael Fornius wrote:

> Hi John, Carsten and fellow orgs.
>
> This patch introduces a small new feature in org-habit I have wanted
> for a while:
>
> When mouse is over a done-star in the habit-graph I get a help-echo
> with the date.
>
> This is useful because I use many preceeding days and there is no easy
> way (that I know of) to find the done-dates when viewing the graph.
> Often I ask myself 'hmm when did I do this habit lately' when I am
> visually evaluating the habit graph and I get stuck, annoying :)
>
> I think this is a small and tasty feature so feel free to use it in
> org-habit if you like it.
>
> ---
> lisp/ChangeLog    |    5 +++++
> lisp/org-habit.el |    4 +++-
> 2 files changed, 8 insertions(+), 1 deletions(-)
>
> diff --git a/lisp/ChangeLog b/lisp/ChangeLog
> index 7f1a507..a168d73 100644
> --- a/lisp/ChangeLog
> +++ b/lisp/ChangeLog
> @@ -1,3 +1,8 @@
> +2010-05-04  Mikael Fornius  <mfo@abc.se>
> +
> +	* org-habit.el (org-habit-build-graph): Help-echo date when
> +	mouse is over stars.
> +
> 2010-05-02  Dan Davison  <davison@stats.ox.ac.uk>
>
> 	* org-src.el (org-edit-src-code): allow-write-back-p had
> diff --git a/lisp/org-habit.el b/lisp/org-habit.el
> index bb8773e..a3a4d19 100644
> --- a/lisp/org-habit.el
> +++ b/lisp/org-habit.el
> @@ -280,9 +280,11 @@ current time."
> 		       donep)))
> 	     markedp face)
> 	(if donep
> -	    (progn
> +	    (let ((done-time (time-add starting (days-to-time (- start  
> (time-to-days starting))))))
> 	      (aset graph index ?*)
> 	      (setq markedp t)
> +	      (put-text-property index (1+ index) 'help-echo
> +				 (format-time-string (org-time-stamp-format) done-time) graph)
> 	      (while (and done-dates
> 			  (= start (car done-dates)))
> 		(setq last-done-date (car done-dates)
> -- 
> 1.7.1
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten

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

end of thread, other threads:[~2010-05-13  5:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-04 10:35 [PATCH] (org-habit-build-graph): Help-echo date when mouse is over stars Mikael Fornius
2010-05-13  5:45 ` Carsten Dominik

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