emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] added a new modeline face for tasks which have overrun their effort estimate
@ 2010-01-20  2:15 Richard Riley
  2010-01-20  5:22 ` Richard Riley
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Riley @ 2010-01-20  2:15 UTC (permalink / raw)
  To: Emacs-orgmode mailing list


This small patch (be gentle, its my first) adds a new
face,org-mode-line-clock-overrun, for the modeline task clock when a
task has overrun its allotted Estimate.

I will try to set up the remote repo thing described here
http://orgmode.org/worg/org-contribute.php#sec-3 but I'm not 100% sure
of what it is I'm supposed to set up there. Should it be a mirror of the
master git repo?

Comments on elisp ineptitude welcome.

Subject: [PATCH] added a new modeline face for tasks which have overrun
their effort estimate


---
 lisp/org-clock.el |    8 +++++---
 lisp/org-faces.el |    2 ++
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 07f5e81..03df5b6 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -388,6 +388,8 @@ pointing to it."
 	(insert (format "[%c] %-15s %s\n" i cat task))
 	(cons i marker)))))
 
+(defvar org-task-overrun nil)
+
 (defun org-clock-get-clock-string ()
   "Form a clock-string, that will be show in the mode line.
 If an effort estimate was defined for current item, use
@@ -406,6 +408,7 @@ If not, show simply the clocked time like 01:50."
 	      h m org-clock-heading))))
 
 (defun org-clock-update-mode-line ()
+  (if org-clock-effort (org-clock-notify-once-if-expired))
   (setq org-mode-line-string
 	(org-propertize
 	 (let ((clock-string (org-clock-get-clock-string))
@@ -417,8 +420,7 @@ If not, show simply the clocked time like 01:50."
 	     (org-propertize clock-string 'help-echo help-text)))
 	 'local-map org-clock-mode-line-map
 	 'mouse-face (if (featurep 'xemacs) 'highlight 'mode-line-highlight)
-	 'face 'org-mode-line-clock))
-  (if org-clock-effort (org-clock-notify-once-if-expired))
+	 'face (if  org-task-overrun 'org-mode-line-clock-overrun 'org-mode-line-clock)))
   (force-mode-line-update))
 
 (defun org-clock-get-clocked-time ()
@@ -473,7 +475,7 @@ Notification is shown only once."
   (when (marker-buffer org-clock-marker)
     (let ((effort-in-minutes (org-hh:mm-string-to-minutes org-clock-effort))
 	  (clocked-time (org-clock-get-clocked-time)))
-      (if (>= clocked-time effort-in-minutes)
+      (if (setq org-task-overrun (>= clocked-time effort-in-minutes ))
 	  (unless org-clock-notification-was-shown
 	    (setq org-clock-notification-was-shown t)
 	    (org-notify
diff --git a/lisp/org-faces.el b/lisp/org-faces.el
index e3294eb..dad2b5e 100644
--- a/lisp/org-faces.el
+++ b/lisp/org-faces.el
@@ -641,6 +641,8 @@ If it is less than 8, the level-1 face gets re-used for level N+1 etc."
 
 (org-copy-face 'modeline 'org-mode-line-clock
 	       "Face used for clock display in mode line.")
+(org-copy-face 'modeline 'org-mode-line-clock-overrun
+	       "Face used for clock display for overrun tasks in mode line.")
 
 (provide 'org-faces)
 
-- 
1.6.5


-- 
Google Talk : rileyrgdev@googlemail.com  http://www.google.com/talk

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

* Re: [PATCH] added a new modeline face for tasks which have overrun their effort estimate
  2010-01-20  2:15 [PATCH] added a new modeline face for tasks which have overrun their effort estimate Richard Riley
@ 2010-01-20  5:22 ` Richard Riley
  2010-01-20  6:19   ` Jan Böcker
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Riley @ 2010-01-20  5:22 UTC (permalink / raw)
  To: emacs-orgmode


I believe I now have a repo set up that can be pulled from. Not sure if
its done the correct way since I didnt clone org-mode. Rather I pushed
my clone master and then the overrun branch. I *think* that should be
ok.

Anyway, the URL is

http://repo.or.cz/w/rgr-org-mode.git

and the branch with patch is called "overrun". Sorry about the octopus
at the head of overrun - you will note that I didnt set my email
properly and all hell broke loose as I tried to reset the head and ....

Any comments on usage to put me further onto the right track, if I have
strayed, most welcome!

regards

r.


Richard Riley <rileyrgdev@googlemail.com> writes:

> This small patch (be gentle, its my first) adds a new
> face,org-mode-line-clock-overrun, for the modeline task clock when a
> task has overrun its allotted Estimate.
>
> I will try to set up the remote repo thing described here
> http://orgmode.org/worg/org-contribute.php#sec-3 but I'm not 100% sure
> of what it is I'm supposed to set up there. Should it be a mirror of the
> master git repo?
>
> Comments on elisp ineptitude welcome.
>
> Subject: [PATCH] added a new modeline face for tasks which have overrun
> their effort estimate
>
> ---
>  lisp/org-clock.el |    8 +++++---
>  lisp/org-faces.el |    2 ++
>  2 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/lisp/org-clock.el b/lisp/org-clock.el
> index 07f5e81..03df5b6 100644
> --- a/lisp/org-clock.el
> +++ b/lisp/org-clock.el
> @@ -388,6 +388,8 @@ pointing to it."
>  	(insert (format "[%c] %-15s %s\n" i cat task))
>  	(cons i marker)))))
>
> +(defvar org-task-overrun nil)
> +
>  (defun org-clock-get-clock-string ()
>    "Form a clock-string, that will be show in the mode line.
>  If an effort estimate was defined for current item, use
> @@ -406,6 +408,7 @@ If not, show simply the clocked time like 01:50."
>  	      h m org-clock-heading))))
>
>  (defun org-clock-update-mode-line ()
> +  (if org-clock-effort (org-clock-notify-once-if-expired))
>    (setq org-mode-line-string
>  	(org-propertize
>  	 (let ((clock-string (org-clock-get-clock-string))
> @@ -417,8 +420,7 @@ If not, show simply the clocked time like 01:50."
>  	     (org-propertize clock-string 'help-echo help-text)))
>  	 'local-map org-clock-mode-line-map
>  	 'mouse-face (if (featurep 'xemacs) 'highlight 'mode-line-highlight)
> -	 'face 'org-mode-line-clock))
> -  (if org-clock-effort (org-clock-notify-once-if-expired))
> +	 'face (if  org-task-overrun 'org-mode-line-clock-overrun 'org-mode-line-clock)))
>    (force-mode-line-update))
>
>  (defun org-clock-get-clocked-time ()
> @@ -473,7 +475,7 @@ Notification is shown only once."
>    (when (marker-buffer org-clock-marker)
>      (let ((effort-in-minutes (org-hh:mm-string-to-minutes org-clock-effort))
>  	  (clocked-time (org-clock-get-clocked-time)))
> -      (if (>= clocked-time effort-in-minutes)
> +      (if (setq org-task-overrun (>= clocked-time effort-in-minutes ))
>  	  (unless org-clock-notification-was-shown
>  	    (setq org-clock-notification-was-shown t)
>  	    (org-notify
> diff --git a/lisp/org-faces.el b/lisp/org-faces.el
> index e3294eb..dad2b5e 100644
> --- a/lisp/org-faces.el
> +++ b/lisp/org-faces.el
> @@ -641,6 +641,8 @@ If it is less than 8, the level-1 face gets re-used for level N+1 etc."
>
>  (org-copy-face 'modeline 'org-mode-line-clock
>  	       "Face used for clock display in mode line.")
> +(org-copy-face 'modeline 'org-mode-line-clock-overrun
> +	       "Face used for clock display for overrun tasks in mode line.")
>
>  (provide 'org-faces)
>
> -- 
> 1.6.5

-- 
Google Talk : rileyrgdev@googlemail.com  http://www.google.com/talk

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

* Re: Re: [PATCH] added a new modeline face for tasks which have overrun their effort estimate
  2010-01-20  5:22 ` Richard Riley
@ 2010-01-20  6:19   ` Jan Böcker
  2010-01-20  6:43     ` Richard Riley
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Böcker @ 2010-01-20  6:19 UTC (permalink / raw)
  To: Richard Riley; +Cc: emacs-orgmode

On 20.01.2010 06:22, Richard Riley wrote:
> 
> I believe I now have a repo set up that can be pulled from. Not sure if
> its done the correct way since I didnt clone org-mode. Rather I pushed
> my clone master and then the overrun branch. I *think* that should be
> ok.
> 
> Anyway, the URL is
> 
> http://repo.or.cz/w/rgr-org-mode.git
> 
> and the branch with patch is called "overrun".

That is the URL to the web interface, which cannot be pulled from.
The correct URL to clone/pull from is:

git://repo.or.cz/rgr-org-mode.git

> Sorry about the octopus
> at the head of overrun - you will note that I didnt set my email
> properly and all hell broke loose as I tried to reset the head and ....

The cool thing about git is that it lets you fix this :)
I see that you have committed the same patch three times with a
different email address and/or commit message. What you want to do is to
delete two of these commits.

Enter git rebase --interactive, which allows you to rewrite history.
Let's do this on a new branch, because rewriting history that others
have already pulled can break things for them:

$ git checkout overrun
$ git checkout -b overrun-fixed

We want to modify HEAD and the two commits before that:

$ git rebase -i HEAD~2

You are now dropped into a text editor. Each line in the file you edit
represents one commit. To drop a commit, simply delete the line (or
comment it out). I assume that you want to keep commit 34b13cb... with
the gmail address, so you would comment out the other two lines:

# pick 09f2e0e added a new modeline face for tasks which have...
pick 34b13cb added new face for task modeline clock for when...
# pick da65d04 added a new modeline face for tasks which have...

Then save the file and exit the editor.
If everything succeeded, git rebase should say:
Successfully rebased and updated refs/heads/overrun-fixed.

Start gitk and take a look at your new, tidy overrun-fixed branch.

If something goes wrong, you can abort the rebase with:
$ git rebase --abort


I cannot comment on the patch itself, as I am new to elisp myself and
have never done anything with faces or mode-lines.

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

* Re: [PATCH] added a new modeline face for tasks which have overrun their effort estimate
  2010-01-20  6:19   ` Jan Böcker
@ 2010-01-20  6:43     ` Richard Riley
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Riley @ 2010-01-20  6:43 UTC (permalink / raw)
  To: emacs-orgmode

Jan Böcker <jan.boecker@jboecker.de> writes:

> On 20.01.2010 06:22, Richard Riley wrote:
>> 
>> I believe I now have a repo set up that can be pulled from. Not sure if
>> its done the correct way since I didnt clone org-mode. Rather I pushed
>> my clone master and then the overrun branch. I *think* that should be
>> ok.
>> 
>> Anyway, the URL is
>> 
>> http://repo.or.cz/w/rgr-org-mode.git
>> 
>> and the branch with patch is called "overrun".
>
> That is the URL to the web interface, which cannot be pulled from.
> The correct URL to clone/pull from is:
>
> git://repo.or.cz/rgr-org-mode.git

Yes, I realised that - it is listed on the web page - I kind of figured
people would want to see the (now defunct) "octopus" graphically before
adding this as a remote ;)

>
>> Sorry about the octopus
>> at the head of overrun - you will note that I didnt set my email
>> properly and all hell broke loose as I tried to reset the head and ....
>
> The cool thing about git is that it lets you fix this :)
> I see that you have committed the same patch three times with a
> different email address and/or commit message. What you want to do is to
> delete two of these commits.

Yes, I had thought my git repo clone would inherit my top level git user
settings but it didnt seem to. Possibly global not set. On my list to
now check.

>
> Enter git rebase --interactive, which allows you to rewrite history.
> Let's do this on a new branch, because rewriting history that others
> have already pulled can break things for them:
>
> $ git checkout overrun
> $ git checkout -b overrun-fixed
>
> We want to modify HEAD and the two commits before that:
>
> $ git rebase -i HEAD~2

What I did (before I saw this) was to reset to HEAD~2, the do a commit
and a force push. Worked well.

Git rebase is now on my list to review! There are so many ways to do the
same thing.


>
> You are now dropped into a text editor. Each line in the file you edit
> represents one commit. To drop a commit, simply delete the line (or
> comment it out). I assume that you want to keep commit 34b13cb... with
> the gmail address, so you would comment out the other two lines:
>
> # pick 09f2e0e added a new modeline face for tasks which have...
> pick 34b13cb added new face for task modeline clock for when...
> # pick da65d04 added a new modeline face for tasks which have...
>
> Then save the file and exit the editor.
> If everything succeeded, git rebase should say:
> Successfully rebased and updated refs/heads/overrun-fixed.
>
> Start gitk and take a look at your new, tidy overrun-fixed branch.
>
> If something goes wrong, you can abort the rebase with:
> $ git rebase --abort
>
> I cannot comment on the patch itself, as I am new to elisp myself and
> have never done anything with faces or mode-lines.

Many thanks for the feedback.  Was quite hairy for a while. For some
reason my new repo wouldnt acept a push for about half an hour after I
created it. At least I dont think I did anything to suddenly make it
work. But seems fine now.

>
> _______________________________________________
> 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
>

-- 
Google Talk : rileyrgdev@googlemail.com  http://www.google.com/talk

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

end of thread, other threads:[~2010-01-20  6:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-20  2:15 [PATCH] added a new modeline face for tasks which have overrun their effort estimate Richard Riley
2010-01-20  5:22 ` Richard Riley
2010-01-20  6:19   ` Jan Böcker
2010-01-20  6:43     ` Richard Riley

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