From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: How to trigger the clockcheck in an agenda view. Date: Fri, 27 Sep 2013 15:00:04 +0200 Message-ID: References: <51E688F4.8090601@online.de> <51F617EF.4010600@online.de> <86siyx4uqm.fsf@somewhere.org> <51F8BBF6.2020803@online.de> <8661vjhnqy.fsf@somewhere.org> Mime-Version: 1.0 (Mac OS X Mail 6.6 \(1510\)) Content-Type: multipart/signed; boundary="Apple-Mail=_6EE1C932-385E-4E70-8CC3-B8944364F989"; protocol="application/pgp-signature"; micalg=pgp-sha1 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41443) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VPXeY-0002yH-CV for emacs-orgmode@gnu.org; Fri, 27 Sep 2013 09:00:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VPXeS-00068F-Ib for emacs-orgmode@gnu.org; Fri, 27 Sep 2013 09:00:14 -0400 Received: from mail-ea0-x235.google.com ([2a00:1450:4013:c01::235]:46122) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VPXeS-00067l-8V for emacs-orgmode@gnu.org; Fri, 27 Sep 2013 09:00:08 -0400 Received: by mail-ea0-f181.google.com with SMTP id d10so1224426eaj.12 for ; Fri, 27 Sep 2013 06:00:07 -0700 (PDT) In-Reply-To: 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Nicolas Girard Cc: emacs-orgmode --Apple-Mail=_6EE1C932-385E-4E70-8CC3-B8944364F989 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=iso-8859-1 On 10.9.2013, at 17:07, Nicolas Girard wrote: > 2013/8/5 Sebastien Vauban : >>=20 >> 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)? >>=20 >=20 > I think I understand why Rainer has a problem. >=20 > 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). >=20 > 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. >=20 > 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. >=20 > (I just borrowed your scissors to delimit my code, hope you don't mind = ;-) ) >=20 > --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 --Apple-Mail=_6EE1C932-385E-4E70-8CC3-B8944364F989 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJSRYFUAAoJEO+gg/nAZuwMpCcIAIYce4m2R1gkuq6WQvP5wq/S m4rWIhklsj5QmhR7UC68gFTHN7yDK8kMQ6GXYuTQ/jtfI2nWyHmzJgQZUQlRxw8w n33T1+8v5i1Px1de8G76KxlAtFtfJyd8dzBXJUM7Y18+FFwDsbKzjgeLeVT8qdFD BbE4UN0c31d5tblE1mv2MiE418oEi8rlzgql3LWtYzcH7842jIpFMbKoTifMtPu5 5Fzy/o93zC3O0wQPzicS5W3+Jty8x7Bm+Grpc9QeUptHAbTfBQYajydbdbLJQ7Ea Ekil8QBuK99eDMyteHYYnEU53Nxc2I6AX7XBLuuzYzsj1KkTULbJLn7Vzs8oiWk= =LHYc -----END PGP SIGNATURE----- --Apple-Mail=_6EE1C932-385E-4E70-8CC3-B8944364F989--