From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric S Fraga Subject: Re: modeline clock string Date: Wed, 14 Apr 2010 16:50:08 +0100 Message-ID: <87aat6ghjj.wl%ucecesf@ucl.ac.uk> References: <20100409133036.49e89b46@n14> <20100409101801.GA22973@taupan.ath.cx> <20100412093815.207451b1@n14> Reply-To: e.fraga@ucl.ac.uk Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O25fc-0002Re-6W for emacs-orgmode@gnu.org; Wed, 14 Apr 2010 12:42:32 -0400 Received: from [140.186.70.92] (port=59502 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O25fW-0000Po-DA for emacs-orgmode@gnu.org; Wed, 14 Apr 2010 12:42:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O25dR-0005PJ-3h for emacs-orgmode@gnu.org; Wed, 14 Apr 2010 12:40:19 -0400 Received: from vscane-b.ucl.ac.uk ([144.82.108.141]:59757) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O25dQ-0005Oo-UL for emacs-orgmode@gnu.org; Wed, 14 Apr 2010 12:40:17 -0400 In-Reply-To: <20100412093815.207451b1@n14> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Yuri Goncharov Cc: emacs-orgmode@gnu.org On Mon, 12 Apr 2010 09:38:15 +0400, Yuri Goncharov 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 aproposhook > > 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