From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sebastian Rose Subject: [patch] Remove modeline if not org-clocking-p Date: Sat, 24 Apr 2010 01:44:11 +0200 Message-ID: <87vdbhpwdw.fsf@gmx.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O5SXm-0005Yj-VB for emacs-orgmode@gnu.org; Fri, 23 Apr 2010 19:44:22 -0400 Received: from [140.186.70.92] (port=40520 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O5SXk-0005Y0-N9 for emacs-orgmode@gnu.org; Fri, 23 Apr 2010 19:44:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O5SXj-0005UD-9w for emacs-orgmode@gnu.org; Fri, 23 Apr 2010 19:44:20 -0400 Received: from mail.gmx.net ([213.165.64.20]:42864) by eggs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1O5SXi-0005U2-S8 for emacs-orgmode@gnu.org; Fri, 23 Apr 2010 19:44:19 -0400 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: Emacs-orgmode mailing list --=-=-= Hi Carsten and the Orgers, I had this mode line entry now since I created that example file for lists two (?) days ago. As I accidentally removed the clocking information by hand, the clock was gone. Somehow, I was clocked out anyway (`C-c C-x C-o'), but the modeline string remained. No matter how hard I tried - I only got the error message. This patch removes the clock-entry from the modeline, if (not org-clocking-p). --=-=-= Content-Type: application/emacs-lisp Content-Disposition: inline Content-Transfer-Encoding: quoted-printable diff --git a/lisp/org-clock.el b/lisp/org-clock.el index c8bf6cc..dc20528 100755 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -1194,8 +1194,11 @@ line and position cursor in that line." If there is no running clock, throw an error, unless FAIL-QUIETLY is set." (interactive) (catch 'exit - (if (not (org-clocking-p)) - (if fail-quietly (throw 'exit t) (error "No active clock"))) + (when (not (org-clocking-p)) + (setq global-mode-string + (delq 'org-mode-line-string global-mode-string)) + (force-mode-line-update) + (if fail-quietly (throw 'exit t) (error "No active clock"))) (let (ts te s h m remove) (save-excursion ; Do not replace this with `with-current-buffer'. (with-no-warnings (set-buffer (org-clocking-buffer))) @@ -1263,8 +1266,11 @@ If there is no running clock, throw an error, unless= FAIL-QUIETLY is set." (defun org-clock-cancel () "Cancel the running clock be removing the start timestamp." (interactive) - (if (not (org-clocking-p)) - (error "No active clock")) + (when (not (org-clocking-p)) + (setq global-mode-string + (delq 'org-mode-line-string global-mode-string)) + (force-mode-line-update) + (error "No active clock")) (save-excursion ; Do not replace this with `with-current-buffer'. (with-no-warnings (set-buffer (org-clocking-buffer))) (goto-char org-clock-marker) --=-=-= Best wishes Sebastian --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --=-=-=--