emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Carsten Dominik <carsten.dominik@gmail.com>
To: Nicolas Girard <girard.nicolas@gmail.com>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: How to trigger the clockcheck in an agenda view.
Date: Fri, 27 Sep 2013 15:00:04 +0200	[thread overview]
Message-ID: <C2B9E4DB-138E-4E3E-83C6-57E7ADD2D5F7@gmail.com> (raw)
In-Reply-To: <CANMKmeezct+YjYnJL7Hs1N_X4S=oaTCoMG5rym3MRGS+nMPvFg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2882 bytes --]


On 10.9.2013, at 17:07, Nicolas Girard <girard.nicolas@gmail.com> wrote:

> 2013/8/5 Sebastien Vauban <sva-news@mygooglest.com>:
>> 
>> 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
       (append
        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 #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

  parent reply	other threads:[~2013-09-27 13:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-12  8:06 How to trigger the clockcheck in an agenda view Rainer Stengele
2013-07-17 12:07 ` Rainer Stengele
2013-07-29  7:21   ` Rainer Stengele
2013-07-29  8:48     ` Sebastien Vauban
2013-07-31  7:25       ` Rainer Stengele
2013-08-04 20:32         ` Mike McLean
2013-08-05 20:43         ` Sebastien Vauban
2013-09-10 15:07           ` Nicolas Girard
2013-09-11 10:24             ` [BUG] " Sebastien Vauban
2013-09-27 13:00             ` Carsten Dominik [this message]
2014-11-20 12:51               ` Rainer Stengele
2014-11-25 17:02                 ` Rainer Stengele
2014-12-06 15:29                   ` Bernt Hansen
2014-12-07 14:21                     ` Rainer Stengele

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=C2B9E4DB-138E-4E3E-83C6-57E7ADD2D5F7@gmail.com \
    --to=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=girard.nicolas@gmail.com \
    /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).