From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcin Borkowski Subject: How to dynamically change org-clock-mode-line-total? Date: Fri, 26 Jan 2018 12:23:56 +0100 Message-ID: <87mv10oocd.fsf@mbork.pl> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:60772) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ef6ZB-0007xZ-7o for emacs-orgmode@gnu.org; Fri, 26 Jan 2018 11:09:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ef6Z8-0005sm-1g for emacs-orgmode@gnu.org; Fri, 26 Jan 2018 11:09:25 -0500 Received: from mail.mojserwer.eu ([195.110.48.8]:54251) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ef6Yw-0005mI-Vs for emacs-orgmode@gnu.org; Fri, 26 Jan 2018 11:09:21 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.mojserwer.eu (Postfix) with ESMTP id AB3A3E6C7F for ; Fri, 26 Jan 2018 12:24:05 +0100 (CET) Received: from mail.mojserwer.eu ([127.0.0.1]) by localhost (mail.mojserwer.eu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eV2QWUZkOHaI for ; Fri, 26 Jan 2018 12:24:03 +0100 (CET) Received: from localhost (unknown [83.13.149.242]) by mail.mojserwer.eu (Postfix) with ESMTPSA id AF386E6C40 for ; Fri, 26 Jan 2018 12:24:02 +0100 (CET) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Org-Mode mailing list Hi all, I want to be able to dynamically switch between various settings of org-clock-mode-line-total. To this end, I wrote the following code. --8<---------------cut here---------------start------------->8--- (setq org-clock-mode-line-total-settings '((current . "time spent in this chunk on the current task") (today . "time spent today on the current task") (all . "total time spent on the current task"))) (setq org-clock-mode-line-total-setting-number 0) (defun toggle-org-clock-mode-line-total-setting (setting-number) "Toggle between org-clock-mode-line-total settings. With a numeric argument, use setting SETTING-NUMBER." (interactive "P") (if (numberp setting-number) (setq org-clock-mode-line-total-setting-number (mod setting-number (length org-clock-mode-line-total-settings))) (setq org-clock-mode-line-total-setting-number (mod (1+ org-clock-mode-line-total-setting-number) (length org-clock-mode-line-total-settings)))) (let ((org-clock-mode-line-total-setting (nth org-clock-mode-line-total-setting-number org-clock-mode-line-total-settings))) (setq org-clock-mode-line-total (car org-clock-mode-line-total-setting)) (org-clock-update-mode-line) (message "Modeline shows %s." (cdr org-clock-mode-line-total-setting)))) --8<---------------cut here---------------end--------------->8--- Unfortunately, it doesn't work. I checked that the variable org-clock-mode-line-total is modified correctly, but even after saying (org-clock-update-mode-line), nothing gets updated. Am I doing something wrong? TIA, -- Marcin Borkowski