emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] How to dynamically change org-clock-mode-line-total?


From: Nick Dokos
Subject: Re: [O] How to dynamically change org-clock-mode-line-total?
Date: Fri, 26 Jan 2018 13:41:33 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Marcin Borkowski <address@hidden> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]