emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* how to change the set of agenda org files between custom agenda commands
@ 2008-09-23 15:37 Rainer Stengele
  2008-09-23 23:16 ` Dan Griswold
  0 siblings, 1 reply; 6+ messages in thread
From: Rainer Stengele @ 2008-09-23 15:37 UTC (permalink / raw)
  To: emacs-orgmode

I am struggling to switch the set of used agenda org files between different custom agenda commands.

I tried something like

(setq org-agenda-custom-commands
       '(
	("k" . "Kundenbezogene / Ketegoriebezogene TODOs ...")
         ("ka" tags-todo "CATEGORY=\"ADMIN\"")
         ("kP" tags-todo "CATEGORY=\"PRIVAT\""
	 ((org-agenda-files (quote ("~/org/PRIVAT/PRIVAT.org")))))
...


or


(setq org-agenda-custom-commands
       '(
	("k" . "Kundenbezogene / Ketegoriebezogene TODOs ...")
         ("ka" tags-todo "CATEGORY=\"ADMIN\"")
         ("kP" tags-todo "CATEGORY=\"PRIVAT\""
	 ((org-agenda-directory "~/org/PRIVAT")))
...


but am failing miserably. Can someone point me to a solution?


Motivation: in the middle of my worktime I want to be able to look into a completely different (private) set of org files.
I know I could write a elisp function and redefine the org-agenda-custom-commands but I would like to do this in one place.

Rainer

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: how to change the set of agenda org files between custom agenda commands
  2008-09-23 15:37 how to change the set of agenda org files between custom agenda commands Rainer Stengele
@ 2008-09-23 23:16 ` Dan Griswold
  2008-09-24 21:25   ` Rainer Stengele
  0 siblings, 1 reply; 6+ messages in thread
From: Dan Griswold @ 2008-09-23 23:16 UTC (permalink / raw)
  To: emacs-orgmode

Rainer Stengele <rainer.stengele@diplan.de> writes:

> I am struggling to switch the set of used agenda org files between
> different custom agenda commands.
>
> I tried something like
>
> (setq org-agenda-custom-commands
>       '(
> 	("k" . "Kundenbezogene / Ketegoriebezogene TODOs ...")
>         ("ka" tags-todo "CATEGORY=\"ADMIN\"")
>         ("kP" tags-todo "CATEGORY=\"PRIVAT\""
> 	 ((org-agenda-files (quote ("~/org/PRIVAT/PRIVAT.org")))))

Playing with customize I came up with this possibility:

(setq org-agenda-custom-commands
      '(
 	("k" . "Kundenbezogene / Ketegoriebezogene TODOs ...")
        ("ka" tags-todo "CATEGORY=\"ADMIN\"")
        ("kP" tags-todo "CATEGORY=\"PRIVAT\""
 	 ((org-agenda-files
	   '("~/org/PRIVAT/PRIVAT.org"))))))

Will that do it?

Dan

-- 
--------------
Dan Griswold
Rochester, NY
--------------

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: how to change the set of agenda org files between custom agenda commands
  2008-09-23 23:16 ` Dan Griswold
@ 2008-09-24 21:25   ` Rainer Stengele
  2008-09-25  2:54     ` Dan Griswold
  2008-09-25  3:32     ` Carsten Dominik
  0 siblings, 2 replies; 6+ messages in thread
From: Rainer Stengele @ 2008-09-24 21:25 UTC (permalink / raw)
  To: Dan Griswold; +Cc: emacs-orgmode

Dan Griswold wrote:
> Rainer Stengele <rainer.stengele@diplan.de> writes:
> 
>> I am struggling to switch the set of used agenda org files between
>> different custom agenda commands.
>>
>> I tried something like
>>
>> (setq org-agenda-custom-commands
>>       '(
>> 	("k" . "Kundenbezogene / Ketegoriebezogene TODOs ...")
>>         ("ka" tags-todo "CATEGORY=\"ADMIN\"")
>>         ("kP" tags-todo "CATEGORY=\"PRIVAT\""
>> 	 ((org-agenda-files (quote ("~/org/PRIVAT/PRIVAT.org")))))
> 
> Playing with customize I came up with this possibility:
> 
> (setq org-agenda-custom-commands
>       '(
>  	("k" . "Kundenbezogene / Ketegoriebezogene TODOs ...")
>         ("ka" tags-todo "CATEGORY=\"ADMIN\"")
>         ("kP" tags-todo "CATEGORY=\"PRIVAT\""
>  	 ((org-agenda-files
> 	   '("~/org/PRIVAT/PRIVAT.org"))))))
> 
> Will that do it?
> 
> Dan
> 

Dan, thank you. I somehow does and doesn't.
After using the command I get the "private" entries.
After using another command analogous to this it seems I cannot reset 
the org-agenda-files variable. Looks like it only adds files to it?
I played around a lot but could not get it to function as wanted.

Anyway, the syntax is quite complex.
I wonder if some more examples for changing agenda files when executing 
custom commands would be helpful.
Anyone else who wants to see Agenden at home from different sets of 
agenda files?

Rainer

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: how to change the set of agenda org files between custom agenda commands
  2008-09-24 21:25   ` Rainer Stengele
@ 2008-09-25  2:54     ` Dan Griswold
  2008-09-25  3:32     ` Carsten Dominik
  1 sibling, 0 replies; 6+ messages in thread
From: Dan Griswold @ 2008-09-25  2:54 UTC (permalink / raw)
  To: emacs-orgmode

Rainer Stengele <rainer.stengele@diplan.de> writes:

> Dan, thank you. I somehow does and doesn't.
> After using the command I get the "private" entries.
> After using another command analogous to this it seems I cannot reset
> the org-agenda-files variable. Looks like it only adds files to it?
> I played around a lot but could not get it to function as wanted.
>
> Anyway, the syntax is quite complex.
> I wonder if some more examples for changing agenda files when
> executing custom commands would be helpful.
> Anyone else who wants to see Agenden at home from different sets of
> agenda files?
>
> Rainer

Rainer,

I came across the variable org-finalize-agenda-hook, which is "run
just before displaying an agenda buffer."

So, maybe something like this in your configuration will work:

(defun rs-reset-agenda-files ()
  "Set org-agenda-files to my default values"
  (interactive)
  (setq org-agenda-files ; the following are examples, of course
	(quote
	 ("~/org/PUBLIK/work1.org"
	  "~/org/PUBLIK/work2.org"
	  "~/org/PUBLIK/work3.org"))))

(add-hook 'org-finalize-agenda-hook 'rs-reset-agenda-files)


What I think might then happen is that, after you run agenda custom
command kP, the variable org-agenda-files will be reset to the default
value.

Maybe?

Dan


-- 
--------------
Dan Griswold
Rochester, NY
--------------

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Re: how to change the set of agenda org files between custom agenda commands
  2008-09-24 21:25   ` Rainer Stengele
  2008-09-25  2:54     ` Dan Griswold
@ 2008-09-25  3:32     ` Carsten Dominik
  2008-09-25 12:00       ` Rainer Stengele
  1 sibling, 1 reply; 6+ messages in thread
From: Carsten Dominik @ 2008-09-25  3:32 UTC (permalink / raw)
  To: Rainer Stengele; +Cc: Dan Griswold, emacs-orgmode

On Sep 24, 2008, at 11:25 PM, Rainer Stengele wrote:

> Dan Griswold wrote:
>> Rainer Stengele <rainer.stengele@diplan.de> writes:
>>> I am struggling to switch the set of used agenda org files between
>>> different custom agenda commands.
>>>
>>> I tried something like
>>>
>>> (setq org-agenda-custom-commands
>>>      '(
>>> 	("k" . "Kundenbezogene / Ketegoriebezogene TODOs ...")
>>>        ("ka" tags-todo "CATEGORY=\"ADMIN\"")
>>>        ("kP" tags-todo "CATEGORY=\"PRIVAT\""
>>> 	 ((org-agenda-files (quote ("~/org/PRIVAT/PRIVAT.org")))))
>> Playing with customize I came up with this possibility:
>> (setq org-agenda-custom-commands
>>      '(
>> 	("k" . "Kundenbezogene / Ketegoriebezogene TODOs ...")
>>        ("ka" tags-todo "CATEGORY=\"ADMIN\"")
>>        ("kP" tags-todo "CATEGORY=\"PRIVAT\""
>> 	 ((org-agenda-files
>> 	   '("~/org/PRIVAT/PRIVAT.org"))))))
>> Will that do it?
>> Dan
>
> Dan, thank you. I somehow does and doesn't.
> After using the command I get the "private" entries.
> After using another command analogous to this it seems I cannot  
> reset the org-agenda-files variable. Looks like it only adds files  
> to it?
> I played around a lot but could not get it to function as wanted.

Hi Rainer, Dan

I just tested this, with

(setq org-agenda-custom-commands
       '(("ka" "aaa" alltodo ""
	 ((org-agenda-files
	   '("~/lib/emacs/work/org-mode/test/a.org"))))
	("kb" "bbb" alltodo ""
	 ((org-agenda-files
	   '("~/lib/emacs/work/org-mode/test/b.org"))))))

with small files a.org and b.org containing just one TODO entry, and  
of course my full suite of TODO entries available with `C-c a t'.

And then I do

C-c a t
C-c a a
C-c a b
C-c a t

and it all works just fine, going back end forth between these in any  
sequence.....

> Anyway, the syntax is quite complex.
> I wonder if some more examples for changing agenda files when  
> executing custom commands would be helpful.
> Anyone else who wants to see Agenden at home from different sets of  
> agenda files?

I think a good way is also to keep the list of agenda files in a file,  
like
~/.agenda_files_home and ~/.agenda_files_work.

The you can have different sets of files, and switch by making org- 
agenda-files

(defun org-my-toggle-agenda-file-set ()
  (interactive)
  (if (equal org-agenda-files "~/.agenda_files_work")
      (setq org-agenda-files "~/.agenda_files_home")
    (setq org-agenda-files "~/.agenda_files_work"))
  (message "Using %s" org-agenda-files))

- Carsten

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: how to change the set of agenda org files between custom agenda commands
  2008-09-25  3:32     ` Carsten Dominik
@ 2008-09-25 12:00       ` Rainer Stengele
  0 siblings, 0 replies; 6+ messages in thread
From: Rainer Stengele @ 2008-09-25 12:00 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Dan Griswold, emacs-orgmode

Carsten Dominik wrote:
> On Sep 24, 2008, at 11:25 PM, Rainer Stengele wrote:
> 
>> Dan Griswold wrote:
>>> Rainer Stengele <rainer.stengele@diplan.de> writes:
>>>> I am struggling to switch the set of used agenda org files between
>>>> different custom agenda commands.
>>>>
>>>> I tried something like
>>>>
>>>> (setq org-agenda-custom-commands
>>>>      '(
>>>>     ("k" . "Kundenbezogene / Ketegoriebezogene TODOs ...")
>>>>        ("ka" tags-todo "CATEGORY=\"ADMIN\"")
>>>>        ("kP" tags-todo "CATEGORY=\"PRIVAT\""
>>>>      ((org-agenda-files (quote ("~/org/PRIVAT/PRIVAT.org")))))
>>> Playing with customize I came up with this possibility:
>>> (setq org-agenda-custom-commands
>>>      '(
>>>     ("k" . "Kundenbezogene / Ketegoriebezogene TODOs ...")
>>>        ("ka" tags-todo "CATEGORY=\"ADMIN\"")
>>>        ("kP" tags-todo "CATEGORY=\"PRIVAT\""
>>>      ((org-agenda-files
>>>        '("~/org/PRIVAT/PRIVAT.org"))))))
>>> Will that do it?
>>> Dan
>>
>> Dan, thank you. I somehow does and doesn't.
>> After using the command I get the "private" entries.
>> After using another command analogous to this it seems I cannot reset 
>> the org-agenda-files variable. Looks like it only adds files to it?
>> I played around a lot but could not get it to function as wanted.
> 
> Hi Rainer, Dan
> 
> I just tested this, with
> 
> (setq org-agenda-custom-commands
>       '(("ka" "aaa" alltodo ""
>      ((org-agenda-files
>        '("~/lib/emacs/work/org-mode/test/a.org"))))
>     ("kb" "bbb" alltodo ""
>      ((org-agenda-files
>        '("~/lib/emacs/work/org-mode/test/b.org"))))))
> 
> with small files a.org and b.org containing just one TODO entry, and of 
> course my full suite of TODO entries available with `C-c a t'.
> 
> And then I do
> 
> C-c a t
> C-c a a
> C-c a b
> C-c a t
> 
> and it all works just fine, going back end forth between these in any 
> sequence.....
> 
>> Anyway, the syntax is quite complex.
>> I wonder if some more examples for changing agenda files when 
>> executing custom commands would be helpful.
>> Anyone else who wants to see Agenden at home from different sets of 
>> agenda files?
> 
> I think a good way is also to keep the list of agenda files in a file, like
> ~/.agenda_files_home and ~/.agenda_files_work.
> 
> The you can have different sets of files, and switch by making 
> org-agenda-files
> 
> (defun org-my-toggle-agenda-file-set ()
>  (interactive)
>  (if (equal org-agenda-files "~/.agenda_files_work")
>      (setq org-agenda-files "~/.agenda_files_home")
>    (setq org-agenda-files "~/.agenda_files_work"))
>  (message "Using %s" org-agenda-files))
> 
> - Carsten
> 
> 
> 
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
> 

Hi all,

I found the problem. I used "org-agenda-directory" instead of org-agenda-files.
Not recognising that this variable doesn't seem to exist (did it ever exist?)
I assumed I can use it to indicate the org files folder.

With org-agenda-files everything works perfectly.

I now have about 48 custom commands (partly of course hierarchical) and with
dynamically changing the set of org files I really feel I have control over my todos!


I am very happy with org!


Thank you both!

Rainer

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-09-25 12:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-23 15:37 how to change the set of agenda org files between custom agenda commands Rainer Stengele
2008-09-23 23:16 ` Dan Griswold
2008-09-24 21:25   ` Rainer Stengele
2008-09-25  2:54     ` Dan Griswold
2008-09-25  3:32     ` Carsten Dominik
2008-09-25 12:00       ` Rainer Stengele

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).