* Multiple capture templates in file
@ 2015-10-06 19:35 tenspd137 .
2015-10-06 20:38 ` Marco Wahl
0 siblings, 1 reply; 7+ messages in thread
From: tenspd137 . @ 2015-10-06 19:35 UTC (permalink / raw)
To: emacs-orgmode@gnu.org
Hi all,
I am trying to figure out how to store multiple capture templates in a
file, have several files of related templates, and then load all the
files stored in a directory. For example, lets say I have two
projects at work WorkProject1 and WorkProject2. Then I have two files
in a directory org-templates called WorkProj1Templates.el and
WorkTemplates2.el. How can I append the templates in these files to
or capture templates? In my main .emacs, I have:
(setq org-capture-templates
'(("t" "Todo" entry (file+headline (concat org-directory
"/default.org") "Tasks")
"* TODO %?")
("j" "Journal" entry (file+datetree (concat org-directory
"/journal.org"))
"* %?\nEntered on %U\n")))
I would like to then load the template files in org-templates. That
way, when a project ends, I can just yank the templates. I have
experimentally tried using add-to-list with org-capture-templates
without success. Either that can't be done or my syntax was wrong?
Does anyone have any ideas?
Another idea is that I could just have templates that take a
parameter. I have found how to do this out on the web.
Any suggestions on which would be easier?
Thanks!
-C
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Multiple capture templates in file
2015-10-06 19:35 Multiple capture templates in file tenspd137 .
@ 2015-10-06 20:38 ` Marco Wahl
2015-10-06 21:01 ` Subhan Michael Tindall
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Marco Wahl @ 2015-10-06 20:38 UTC (permalink / raw)
To: emacs-orgmode
Hi!
"tenspd137 ." <dcday137@gmail.com> writes:
> I am trying to figure out how to store multiple capture templates in a
> file, have several files of related templates, and then load all the
> files stored in a directory. For example, lets say I have two
> projects at work WorkProject1 and WorkProject2. Then I have two files
> in a directory org-templates called WorkProj1Templates.el and
> WorkTemplates2.el. How can I append the templates in these files to
> or capture templates? In my main .emacs, I have:
>
> (setq org-capture-templates
> '(("t" "Todo" entry (file+headline (concat org-directory
> "/default.org") "Tasks")
> "* TODO %?")
> ("j" "Journal" entry (file+datetree (concat org-directory
> "/journal.org"))
> "* %?\nEntered on %U\n")))
>
> I would like to then load the template files in org-templates. That
> way, when a project ends, I can just yank the templates. I have
> experimentally tried using add-to-list with org-capture-templates
> without success. Either that can't be done or my syntax was wrong?
How could anyone tell if you don't show your attempt?
> Does anyone have any ideas?
What about this?
WorkProj1Templates.el:
#v+
(push '("1" "Todo" entry
(file+headline
(concat org-directory "/WorkProj1.org")
"Tasks")
"* TODO %?")
org-capture-templates)
#v-
--
Marco Wahl
GPG: 0x49010A040A3AE6F2
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Multiple capture templates in file
2015-10-06 20:38 ` Marco Wahl
@ 2015-10-06 21:01 ` Subhan Michael Tindall
2015-10-06 21:15 ` tenspd137 .
2015-10-06 23:43 ` tenspd137 .
2 siblings, 0 replies; 7+ messages in thread
From: Subhan Michael Tindall @ 2015-10-06 21:01 UTC (permalink / raw)
To: Marco Wahl, emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 2090 bytes --]
add-to-list works fine for me, like this: (taken straight of my emacs.org
file)
#+BEGIN_SRC emacs-lisp
(add-to-list 'org-capture-templates '("J" "log job or activity to date
tree for UE application"
(file+datetree "~/Dropbox/orgzly/
jobs.org")
"* %^{Company or activity} %^{Job}
- Direct Contact:%^{y/n}
- Resume submitted:%^{y/n}
- Result:%^{[h]ired/[n]ot hired/[i]nterview}
%?"
:prepend t :immediate-finish)
)
#+END_SRC
On Tue, Oct 6, 2015 at 1:38 PM Marco Wahl <marcowahlsoft@gmail.com> wrote:
> Hi!
>
> "tenspd137 ." <dcday137@gmail.com> writes:
>
> > I am trying to figure out how to store multiple capture templates in a
> > file, have several files of related templates, and then load all the
> > files stored in a directory. For example, lets say I have two
> > projects at work WorkProject1 and WorkProject2. Then I have two files
> > in a directory org-templates called WorkProj1Templates.el and
> > WorkTemplates2.el. How can I append the templates in these files to
> > or capture templates? In my main .emacs, I have:
> >
> > (setq org-capture-templates
> > '(("t" "Todo" entry (file+headline (concat org-directory
> > "/default.org") "Tasks")
> > "* TODO %?")
> > ("j" "Journal" entry (file+datetree (concat org-directory
> > "/journal.org"))
> > "* %?\nEntered on %U\n")))
> >
> > I would like to then load the template files in org-templates. That
> > way, when a project ends, I can just yank the templates. I have
> > experimentally tried using add-to-list with org-capture-templates
> > without success. Either that can't be done or my syntax was wrong?
>
> How could anyone tell if you don't show your attempt?
>
> > Does anyone have any ideas?
>
> What about this?
>
> WorkProj1Templates.el:
>
> #v+
> (push '("1" "Todo" entry
> (file+headline
> (concat org-directory "/WorkProj1.org")
> "Tasks")
> "* TODO %?")
> org-capture-templates)
> #v-
>
> --
> Marco Wahl
> GPG: 0x49010A040A3AE6F2
>
>
>
[-- Attachment #2: Type: text/html, Size: 3231 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Multiple capture templates in file
2015-10-06 20:38 ` Marco Wahl
2015-10-06 21:01 ` Subhan Michael Tindall
@ 2015-10-06 21:15 ` tenspd137 .
2015-10-06 23:43 ` tenspd137 .
2 siblings, 0 replies; 7+ messages in thread
From: tenspd137 . @ 2015-10-06 21:15 UTC (permalink / raw)
To: Marco Wahl; +Cc: emacs-orgmode
Marco - Thanks for the reply.
"How could anyone tell if you don't show your attempt?" - Good point.
Wasn't thinking there. First I will try what you have suggested since
you were kind enough to create the code, and if I can't get that
working, I'll show what I tried and also go back and re-create what I
was trying with add-to-list. I am new to Lisp and Elisp, but I think
your function is saying push an association list (which is the
template) to the variable org-capture-templates. Please forgive my
apparent slowness :)
On Tue, Oct 6, 2015 at 2:38 PM, Marco Wahl <marcowahlsoft@gmail.com> wrote:
> Hi!
>
> "tenspd137 ." <dcday137@gmail.com> writes:
>
>> I am trying to figure out how to store multiple capture templates in a
>> file, have several files of related templates, and then load all the
>> files stored in a directory. For example, lets say I have two
>> projects at work WorkProject1 and WorkProject2. Then I have two files
>> in a directory org-templates called WorkProj1Templates.el and
>> WorkTemplates2.el. How can I append the templates in these files to
>> or capture templates? In my main .emacs, I have:
>>
>> (setq org-capture-templates
>> '(("t" "Todo" entry (file+headline (concat org-directory
>> "/default.org") "Tasks")
>> "* TODO %?")
>> ("j" "Journal" entry (file+datetree (concat org-directory
>> "/journal.org"))
>> "* %?\nEntered on %U\n")))
>>
>> I would like to then load the template files in org-templates. That
>> way, when a project ends, I can just yank the templates. I have
>> experimentally tried using add-to-list with org-capture-templates
>> without success. Either that can't be done or my syntax was wrong?
>
> How could anyone tell if you don't show your attempt?
>
>> Does anyone have any ideas?
>
> What about this?
>
> WorkProj1Templates.el:
>
> #v+
> (push '("1" "Todo" entry
> (file+headline
> (concat org-directory "/WorkProj1.org")
> "Tasks")
> "* TODO %?")
> org-capture-templates)
> #v-
>
> --
> Marco Wahl
> GPG: 0x49010A040A3AE6F2
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Multiple capture templates in file
2015-10-06 20:38 ` Marco Wahl
2015-10-06 21:01 ` Subhan Michael Tindall
2015-10-06 21:15 ` tenspd137 .
@ 2015-10-06 23:43 ` tenspd137 .
2015-10-07 0:45 ` tenspd137 .
2 siblings, 1 reply; 7+ messages in thread
From: tenspd137 . @ 2015-10-06 23:43 UTC (permalink / raw)
To: Marco Wahl; +Cc: emacs-orgmode
I can do the following in .emacs
(setq org-capture-templates
'(("t" "Todo" entry (file+headline (concat org-directory
"/default.org") "Tasks")
"* TODO %?")
("j" "Journal" entry (file+datetree (concat org-directory
"/journal.org"))
"* %?\nEntered on %U\n")
;;product or work specific stuff - I would like to move these
to files and have
;;them loaded - maybe in the future
("p" "product")
("pt" "Product Todo" entry (file+headline (concat org-directory
"/product.org") "Tasks") "* TODO %?")))
and it works as expected
but if I do this in .emacs:
(setq org-capture-templates
'(("t" "Todo" entry (file+headline (concat org-directory
"/default.org") "Tasks")
"* TODO %?")
("j" "Journal" entry (file+datetree (concat org-directory
"/journal.org"))
"* %?\nEntered on %U\n")))
;;product or work specific stuff - I would like to move these
to files and have
;;them loaded - maybe in the future
(load-file (concat org-directory "/capture-templates/product-templates.el"))
with product-templates containing:
(push '(("p" "product") ("pt" "Product - Todo" entry (file+headline
(concat org-directory "/product.org") "Tasks") "* TODO %?"))
org-capture-templates)
and then I use C-c n to go to capture mode, it just hangs with the
mouse cursor in a spinning wheel. Am I not translating the part to go
into submenus correctly, or can you not add sub-menus as I am doing.
Thanks!
-C
On Tue, Oct 6, 2015 at 2:38 PM, Marco Wahl <marcowahlsoft@gmail.com> wrote:
> Hi!
>
> "tenspd137 ." <dcday137@gmail.com> writes:
>
>> I am trying to figure out how to store multiple capture templates in a
>> file, have several files of related templates, and then load all the
>> files stored in a directory. For example, lets say I have two
>> projects at work WorkProject1 and WorkProject2. Then I have two files
>> in a directory org-templates called WorkProj1Templates.el and
>> WorkTemplates2.el. How can I append the templates in these files to
>> or capture templates? In my main .emacs, I have:
>>
>> (setq org-capture-templates
>> '(("t" "Todo" entry (file+headline (concat org-directory
>> "/default.org") "Tasks")
>> "* TODO %?")
>> ("j" "Journal" entry (file+datetree (concat org-directory
>> "/journal.org"))
>> "* %?\nEntered on %U\n")))
>>
>> I would like to then load the template files in org-templates. That
>> way, when a project ends, I can just yank the templates. I have
>> experimentally tried using add-to-list with org-capture-templates
>> without success. Either that can't be done or my syntax was wrong?
>
> How could anyone tell if you don't show your attempt?
>
>> Does anyone have any ideas?
>
> What about this?
>
> WorkProj1Templates.el:
>
> #v+
> (push '("1" "Todo" entry
> (file+headline
> (concat org-directory "/WorkProj1.org")
> "Tasks")
> "* TODO %?")
> org-capture-templates)
> #v-
>
> --
> Marco Wahl
> GPG: 0x49010A040A3AE6F2
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Multiple capture templates in file
2015-10-06 23:43 ` tenspd137 .
@ 2015-10-07 0:45 ` tenspd137 .
2015-10-07 6:45 ` tenspd137 .
0 siblings, 1 reply; 7+ messages in thread
From: tenspd137 . @ 2015-10-07 0:45 UTC (permalink / raw)
To: Marco Wahl; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 3491 bytes --]
One thought I need to try either pushing one item at a time or
concatenation the list of options. I'll try it when I get a chance.
Playtime is over for now. Thanks for all help and suggestions so far.
C
On Oct 6, 2015 5:43 PM, "tenspd137 ." <dcday137@gmail.com> wrote:
> I can do the following in .emacs
>
> (setq org-capture-templates
> '(("t" "Todo" entry (file+headline (concat org-directory
> "/default.org") "Tasks")
> "* TODO %?")
> ("j" "Journal" entry (file+datetree (concat org-directory
> "/journal.org"))
> "* %?\nEntered on %U\n")
> ;;product or work specific stuff - I would like to move these
> to files and have
> ;;them loaded - maybe in the future
> ("p" "product")
> ("pt" "Product Todo" entry (file+headline (concat org-directory
> "/product.org") "Tasks") "* TODO %?")))
>
> and it works as expected
>
> but if I do this in .emacs:
> (setq org-capture-templates
> '(("t" "Todo" entry (file+headline (concat org-directory
> "/default.org") "Tasks")
> "* TODO %?")
> ("j" "Journal" entry (file+datetree (concat org-directory
> "/journal.org"))
> "* %?\nEntered on %U\n")))
> ;;product or work specific stuff - I would like to move these
> to files and have
> ;;them loaded - maybe in the future
>
> (load-file (concat org-directory
> "/capture-templates/product-templates.el"))
>
> with product-templates containing:
>
> (push '(("p" "product") ("pt" "Product - Todo" entry (file+headline
> (concat org-directory "/product.org") "Tasks") "* TODO %?"))
> org-capture-templates)
>
> and then I use C-c n to go to capture mode, it just hangs with the
> mouse cursor in a spinning wheel. Am I not translating the part to go
> into submenus correctly, or can you not add sub-menus as I am doing.
>
> Thanks!
>
> -C
>
> On Tue, Oct 6, 2015 at 2:38 PM, Marco Wahl <marcowahlsoft@gmail.com>
> wrote:
> > Hi!
> >
> > "tenspd137 ." <dcday137@gmail.com> writes:
> >
> >> I am trying to figure out how to store multiple capture templates in a
> >> file, have several files of related templates, and then load all the
> >> files stored in a directory. For example, lets say I have two
> >> projects at work WorkProject1 and WorkProject2. Then I have two files
> >> in a directory org-templates called WorkProj1Templates.el and
> >> WorkTemplates2.el. How can I append the templates in these files to
> >> or capture templates? In my main .emacs, I have:
> >>
> >> (setq org-capture-templates
> >> '(("t" "Todo" entry (file+headline (concat org-directory
> >> "/default.org") "Tasks")
> >> "* TODO %?")
> >> ("j" "Journal" entry (file+datetree (concat org-directory
> >> "/journal.org"))
> >> "* %?\nEntered on %U\n")))
> >>
> >> I would like to then load the template files in org-templates. That
> >> way, when a project ends, I can just yank the templates. I have
> >> experimentally tried using add-to-list with org-capture-templates
> >> without success. Either that can't be done or my syntax was wrong?
> >
> > How could anyone tell if you don't show your attempt?
> >
> >> Does anyone have any ideas?
> >
> > What about this?
> >
> > WorkProj1Templates.el:
> >
> > #v+
> > (push '("1" "Todo" entry
> > (file+headline
> > (concat org-directory "/WorkProj1.org")
> > "Tasks")
> > "* TODO %?")
> > org-capture-templates)
> > #v-
> >
> > --
> > Marco Wahl
> > GPG: 0x49010A040A3AE6F2
> >
> >
>
[-- Attachment #2: Type: text/html, Size: 5491 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Multiple capture templates in file
2015-10-07 0:45 ` tenspd137 .
@ 2015-10-07 6:45 ` tenspd137 .
0 siblings, 0 replies; 7+ messages in thread
From: tenspd137 . @ 2015-10-07 6:45 UTC (permalink / raw)
To: Marco Wahl; +Cc: emacs-orgmode
So - I figured it out. I wanted to create a list that ultimatley had the form:
'(template template sub-menu-label sub-menu-template)
In the scratch buffer, I found I was creating
((("p" "product") ("pt" "Product - Todo" entry (file+headline ...
"Tasks") "* TODO %?")) ("t" "Todo" entry (file+headline (concat
org-directory "/default.org") "Tasks") "* TODO %?") ("j" "Journal"
entry (file+datetree (concat org-directory "/journal.org")) "* %?
Entered on %U
"))
and the same with
(add-to-list 'org-capture-templates '(("p" "product") ("pt" "Product -
Todo" entry (file+headline
(concat org-directory "/product.org") "Tasks") "* TODO %?"))
what I really wanted to do was add each element seperatley:
(add-to-list 'org-capture-templates '("p" "Product") 1)
(add-to-list 'org-capture-templates '("pt" "Product Todo" entry
(file+headline (concat org-directory "/product.org") "Tasks")
"* TODO %?") 1 )
with the ones to append to the end of the list instead of beginning.
and then I thought there must be a better way - and there was - I came up with:
(setq org-capture-templates (append org-capture-templates '(("p"
"product") ("pt" "Product - Todo" entry (file+headline
(concat org-directory "/product.org") "Tasks") "* TODO %?")) ))
and stuck it in a test.el file. I loaded it at the end of my org-mode
configuration in .emacs and I go the submenus I wanted. I think I
figured it out and have the recipie for what I want to do.
This is probably basic stuff for everyone here, but I hope putting it
in email may make it searchable for someone later. Thanks for all the
help, suggestions and ideas!
-C
On Tue, Oct 6, 2015 at 6:45 PM, tenspd137 . <dcday137@gmail.com> wrote:
> One thought I need to try either pushing one item at a time or
> concatenation the list of options. I'll try it when I get a chance.
> Playtime is over for now. Thanks for all help and suggestions so far.
>
> C
>
> On Oct 6, 2015 5:43 PM, "tenspd137 ." <dcday137@gmail.com> wrote:
>>
>> I can do the following in .emacs
>>
>> (setq org-capture-templates
>> '(("t" "Todo" entry (file+headline (concat org-directory
>> "/default.org") "Tasks")
>> "* TODO %?")
>> ("j" "Journal" entry (file+datetree (concat org-directory
>> "/journal.org"))
>> "* %?\nEntered on %U\n")
>> ;;product or work specific stuff - I would like to move these
>> to files and have
>> ;;them loaded - maybe in the future
>> ("p" "product")
>> ("pt" "Product Todo" entry (file+headline (concat org-directory
>> "/product.org") "Tasks") "* TODO %?")))
>>
>> and it works as expected
>>
>> but if I do this in .emacs:
>> (setq org-capture-templates
>> '(("t" "Todo" entry (file+headline (concat org-directory
>> "/default.org") "Tasks")
>> "* TODO %?")
>> ("j" "Journal" entry (file+datetree (concat org-directory
>> "/journal.org"))
>> "* %?\nEntered on %U\n")))
>> ;;product or work specific stuff - I would like to move these
>> to files and have
>> ;;them loaded - maybe in the future
>>
>> (load-file (concat org-directory
>> "/capture-templates/product-templates.el"))
>>
>> with product-templates containing:
>>
>> (push '(("p" "product") ("pt" "Product - Todo" entry (file+headline
>> (concat org-directory "/product.org") "Tasks") "* TODO %?"))
>> org-capture-templates)
>>
>> and then I use C-c n to go to capture mode, it just hangs with the
>> mouse cursor in a spinning wheel. Am I not translating the part to go
>> into submenus correctly, or can you not add sub-menus as I am doing.
>>
>> Thanks!
>>
>> -C
>>
>> On Tue, Oct 6, 2015 at 2:38 PM, Marco Wahl <marcowahlsoft@gmail.com>
>> wrote:
>> > Hi!
>> >
>> > "tenspd137 ." <dcday137@gmail.com> writes:
>> >
>> >> I am trying to figure out how to store multiple capture templates in a
>> >> file, have several files of related templates, and then load all the
>> >> files stored in a directory. For example, lets say I have two
>> >> projects at work WorkProject1 and WorkProject2. Then I have two files
>> >> in a directory org-templates called WorkProj1Templates.el and
>> >> WorkTemplates2.el. How can I append the templates in these files to
>> >> or capture templates? In my main .emacs, I have:
>> >>
>> >> (setq org-capture-templates
>> >> '(("t" "Todo" entry (file+headline (concat org-directory
>> >> "/default.org") "Tasks")
>> >> "* TODO %?")
>> >> ("j" "Journal" entry (file+datetree (concat org-directory
>> >> "/journal.org"))
>> >> "* %?\nEntered on %U\n")))
>> >>
>> >> I would like to then load the template files in org-templates. That
>> >> way, when a project ends, I can just yank the templates. I have
>> >> experimentally tried using add-to-list with org-capture-templates
>> >> without success. Either that can't be done or my syntax was wrong?
>> >
>> > How could anyone tell if you don't show your attempt?
>> >
>> >> Does anyone have any ideas?
>> >
>> > What about this?
>> >
>> > WorkProj1Templates.el:
>> >
>> > #v+
>> > (push '("1" "Todo" entry
>> > (file+headline
>> > (concat org-directory "/WorkProj1.org")
>> > "Tasks")
>> > "* TODO %?")
>> > org-capture-templates)
>> > #v-
>> >
>> > --
>> > Marco Wahl
>> > GPG: 0x49010A040A3AE6F2
>> >
>> >
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-10-07 6:45 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-06 19:35 Multiple capture templates in file tenspd137 .
2015-10-06 20:38 ` Marco Wahl
2015-10-06 21:01 ` Subhan Michael Tindall
2015-10-06 21:15 ` tenspd137 .
2015-10-06 23:43 ` tenspd137 .
2015-10-07 0:45 ` tenspd137 .
2015-10-07 6:45 ` tenspd137 .
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).