emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <nicholas.dokos@hp.com>
To: nicholas.dokos@hp.com
Cc: Bernt Hansen <bernt@norang.ca>,
	Christopher DeMarco <demarco@maya.com>,
	emacs-orgmode@gnu.org,
	Carsten Dominik <carsten.dominik@gmail.com>
Subject: Re: Re: Trouble setting variables in custom agenda command
Date: Wed, 03 Jun 2009 18:59:30 -0400	[thread overview]
Message-ID: <11277.1244069970@alphaville.usa.hp.com> (raw)
In-Reply-To: Message from Nick Dokos <nicholas.dokos@hp.com> of "Wed, 03 Jun 2009 18:26:21 EDT." <11098.1244067981@alphaville.usa.hp.com>

Nick Dokos <nicholas.dokos@hp.com> wrote:

> [Bernt, thanks very much for taking the time to do the set-up: it makes
> things so much easier!]
> 
> I've made a little progress debugging this in the case of the
> org-agenda-start-with-log-mode variable: the doc for it says
> 
> ,----
> | org-agenda-start-with-log-mode is a variable defined in `org-agenda.el'.
> | Its value is nil
> | 
> | Documentation:
> | The initial value of log-mode in a newly created agenda window.
> | 
> | You can customize this variable.
> `----
> 
> Note that *initial*: it is only used once, in org-agenda-mode, to
> initialize org-agenda-show-log.  So setting it in the definition of an
> agenda custom command (effectively in a (let ...) form) will not work:
> org-agenda-mode has been called already by the time the custom command
> is executed, and the global value of org-agenda-start-with-log-mode has
> been used to set org-agenda-show-log. Any local binding later on has no
> effect at all.
> 
> So the workaround for this variable is to set org-agenda-show-log in the
> definition of the custom command. The following works as far as the log
> goes:
> 
> (setq org-agenda-custom-commands
>       '(("c" "The Cycle"
>          ((agenda ""
>                   (
>                    (org-agenda-overriding-columns-format "%75ITEM %7Effort{:} %7CLOCKSUM{Total} %15TAGS %SCHEDULED")  ;; no
>                    (org-agenda-view-columns-initially t)   ;; no
>                    (org-agenda-show-log t) ;;yes
>                    (org-agenda-ndays 1)    ;; yes
>                    (org-agenda-skip-function  ;; yes
>                     '(org-agenda-skip-entry-if 'notregexp "\\* TODO")))))
>          nil nil)))
> 
> I presume that a similar problem afflicts the column view variables,
> but I have not gone there yet.
> 

The problem with the column variables is similar but not quite the same:
column view is set in org-finalize, and org-finalize is called *twice*:

The custom commands are executed by org-run-agenda-series, which first
calls org-agenda-list with the (let ...) settings from the definition of
the custom command and which eventually calls org-finalize with the
proper values of the column view variables. But once org-agenda-list
returns to org-run-agenda-series, the latter continues on and calls
org-finalize again with no (let ...) bindings.  The last call wins and
column view loses.

Thanks,
Nick

  reply	other threads:[~2009-06-03 23:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-27  2:05 Trouble setting variables in custom agenda command Christopher DeMarco
2009-06-03 15:17 ` Carsten Dominik
2009-06-03 18:45   ` Matthew Lundin
2009-06-03 19:18     ` Sebastian Rose
2009-06-03 19:42       ` Eric S Fraga, Eric S Fraga
2009-06-03 19:10   ` Bernt Hansen
2009-06-03 22:26     ` Nick Dokos
2009-06-03 22:59       ` Nick Dokos [this message]
2009-06-04  7:49         ` Carsten Dominik
2009-06-04 15:06           ` Christopher DeMarco
2009-06-05  1:48             ` Matthew Lundin

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=11277.1244069970@alphaville.usa.hp.com \
    --to=nicholas.dokos@hp.com \
    --cc=bernt@norang.ca \
    --cc=carsten.dominik@gmail.com \
    --cc=demarco@maya.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).