[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] modeline clock string

From: Eric S Fraga
Subject: Re: [Orgmode] modeline clock string
Date: Wed, 14 Apr 2010 16:50:08 +0100
User-agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (Goj┼Ź) APEL/10.7 Emacs/23.1 (i486-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)

On Mon, 12 Apr 2010 09:38:15 +0400, Yuri Goncharov <address@hidden> wrote:
> > Yuri Goncharov schrieb:
> > > I use xmonad with xmobar at my desktop. I'd like to add clock
> > > string from mode line to xmobar. Is there  way to save it to
> > > file every time when update mode line?
> > > 
> > ---Zitatende---
> > 
> > You can find information on various subjects with M-x apropos but it's
> > sometimes hard to find the right keyword. I emacs, certain functions
> > are called when certain events occur, those functions are called
> > hooks. I found display-time-hook by doing M-x apropos<ret>hook<ret>
> > and then searching for status (no result) and update (which yielded
> > display-time-hook).
> > 
> > See documentation of variable display-time-hook
> Thanks to answer! I need some more help, because my knowledge of lisp
> too poor. I found two hooks like I need org-clock-in-hook and 
> org-clock-out-hook. Function  org-clock-get-clock-string returns string
> that is showing in mode line. I cant figure how to write it in file.
> Apologies to my english. 
> -- 
> Yuri Goncharov

Maybe this will help:

--8<---------------cut here---------------start------------->8---
;; ---------------------------------------------------------------------------- 
(defun esf/org-clocking-info-to-file ()
  (with-temp-file "~/tmp/clocking"
    ;; (message (org-clock-get-clock-string))
    (if (org-clock-is-active)
        (insert (format "org: %d/%d min" 
                        (- (org-clock-get-clocked-time) org-clock-total-time)
      ) ;;(org-clock-get-clock-string)
(add-hook 'display-time-hook 'esf/org-clocking-info-to-file)
--8<---------------cut here---------------end--------------->8---

I use this to place information on clocking at the top of my display
(using dzen2 with ratpoison).  I have minimal space so only include
the time information, not the full information which typically
includes the org-heading being clocked.

This doesn't work properly if you have two emacs instances but I can't
be bothered to improve it as I *never* have two or more emacs
running...  that's what emacsclient is for, after all... ;-)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]