[Top][All Lists]

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

Re: [O] How to trigger the clockcheck in an agenda view.

From: Carsten Dominik
Subject: Re: [O] How to trigger the clockcheck in an agenda view.
Date: Fri, 27 Sep 2013 15:00:04 +0200

On 10.9.2013, at 17:07, Nicolas Girard <address@hidden> wrote:

> 2013/8/5 Sebastien Vauban <address@hidden>:
>> Except the above, I definitely don't understand why it wouldn't work for you.
>> Can you reproduce the problem with a minimal Emacs config file (adding the
>> require of `org' and `org-agenda' before)?
> I think I understand why Rainer has a problem.
> According to the docstring from `org-agenda-custom-commands', there
> are two acceptable syntaxes for defining a command:
> - the "simple" one : (key desc type match settings files)
> - and the "complex" or "composite" one : (key desc (cmd1 cmd2 ...)
> general-settings-for-whole-set files).
> Now, the following code defines two commands, who are functionally
> identical, but syntactically different. The first one uses the "simple"
> syntax, and the second one, the "complex" syntax.
> If you evaluate the code and trigger the agenda, you'll see that the
> first command *doesn't* work as expected, while the second works.
> (I just borrowed your scissors to delimit my code, hope you don't mind ;-) )
> --8<---------------cut here---------------start------------->8---
>  (setq org-agenda-custom-commands nil)
>  (setq org-agenda-custom-commands
>        (append
>         org-agenda-custom-commands '(
>         ("G" "Good: Clock Review"
>          ((agenda ""
>                   ((org-agenda-show-log 'clockcheck)
>                    (org-agenda-clockreport-mode t)))))
>         ("B"  "Bad: Clock Review"
>          agenda ""
>          ((org-agenda-show-log 'clockcheck)
>           (org-agenda-clockreport-mode t))))))
> --8<---------------cut here---------------end--------------->8---

There are a couple of subtle issues here.

First of all, do not bind org-agenda-clockreport-mode or org-agenda-show-log in 
this way, these are internal variables and meant for a mode that is toggled 
interactively.  Use org-agenda-start-with-clockreport-mode and 
org-agenda-start-with-log-mode  instead.  These are the values chosen when a 
new agenda buffer is created, and at that time its value is copied into 
internal variables.

Second, because this happens when the agenda buffer is created, these need to 
be in the global list of variables, not the local ones for the agenda list, 
when you use a list of commands.  So the example below will work in both cases:

 (setq org-agenda-custom-commands
        org-agenda-custom-commands '(
        ("H" "Good: Clock Review"
         ((agenda ""))
         ((org-agenda-start-with-log-mode 'clockcheck)
          (org-agenda-start-with-clockreport-mode t)))
        ("C"  "Bad: Clock Review"
         agenda ""
         ((org-agenda-start-with-log-mode 'clockcheck)
          (org-agenda-start-with-clockreport-mode t))))))

Hope this helps.

- Carsten

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

reply via email to

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