emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <ndokos@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: How to dynamically change org-clock-mode-line-total?
Date: Fri, 26 Jan 2018 13:41:33 -0500	[thread overview]
Message-ID: <87lggkfoo2.fsf@alphaville.usersys.redhat.com> (raw)
In-Reply-To: 87mv10oocd.fsf@mbork.pl

Marcin Borkowski <mbork@mbork.pl> 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	other threads:[~2018-01-26 18:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-26 11:23 How to dynamically change org-clock-mode-line-total? Marcin Borkowski
2018-01-26 18:41 ` Nick Dokos [this message]
2018-02-01 21:01   ` Marcin Borkowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lggkfoo2.fsf@alphaville.usersys.redhat.com \
    --to=ndokos@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).