From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: How to dynamically change org-clock-mode-line-total? Date: Fri, 26 Jan 2018 13:41:33 -0500 Message-ID: <87lggkfoo2.fsf@alphaville.usersys.redhat.com> References: <87mv10oocd.fsf@mbork.pl> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55353) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ef8wx-00085s-Fq for emacs-orgmode@gnu.org; Fri, 26 Jan 2018 13:42:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ef8wu-0000BE-Br for emacs-orgmode@gnu.org; Fri, 26 Jan 2018 13:42:07 -0500 Received: from [195.159.176.226] (port=60824 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ef8wu-0000AR-6C for emacs-orgmode@gnu.org; Fri, 26 Jan 2018 13:42:04 -0500 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1ef8uq-0004nP-LI for emacs-orgmode@gnu.org; Fri, 26 Jan 2018 19:39:56 +0100 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: emacs-orgmode@gnu.org Marcin Borkowski writes: > 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. > > (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)))) > > 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? > AFAICT, org-clock-mode-line-total is not used by org-clock-update-mode-line at all. It may be that the name of the variable is misleading. The only place I see it used is org-clock-get-sum-start. -- Nick