On Mon, 12 Apr 2010 09:38:15 +0400, Yuri Goncharov <g...@hl.ru> 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---
;; ---------------------------------------------------------------------------- 
DISPLAY-TIME
(display-time)
(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-clocked-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... ;-)

HTH,
eric


_______________________________________________
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

Reply via email to