[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [emacs-wiki-discuss] determine at a glance whether you're "clocked-i
From: |
Chris Parsons |
Subject: |
Re: [emacs-wiki-discuss] determine at a glance whether you're "clocked-in" to a task in planner-timeclock? |
Date: |
Mon, 08 Aug 2005 11:05:11 +0100 |
User-agent: |
Mozilla Thunderbird 1.0.6 (Windows/20050716) |
On 02/08/2005 20:59, Guy Berliner wrote:
> Is there a way to determine at a glance whether one is "clocked-in" to a
> task when using planner-timeclock, and if so, which one? Ideally, it
> would be something that would appear in the modeline, say.
I use this:
(add-hook 'timeclock-in-hook 'timeclock-update-modeline)
(add-hook 'timeclock-out-hook 'timeclock-update-modeline)
I also redefine timeclock-update-modeline as follows, to just give me
the plan page:
(defun timeclock-update-modeline ()
"Update the `timeclock-mode-string' displayed in the modeline to
include the current project and the current amount of time spent in
that project."
(interactive)
(let* ((time-string (timeclock-seconds-to-string
(timeclock-last-period)))
(job-string (nth 2 timeclock-last-event))
(match (when job-string (string-match "\\(.*?\\):" job-string)))
(project (when match (substring job-string
(match-beginning 1) (match-end 1)))))
(setq timeclock-mode-string
(if project
(concat " [" project ": " time-string "]")
(concat " [Clocked out]"))))
(force-mode-line-update))
HTH
Chris
--
Chris Parsons
address@hidden
signature.asc
Description: OpenPGP digital signature