[Orgmode] Use environment variable for location of templates?
Hello, I'm a beginner at lisp/emacs, and realize this is a basic question. I would like to use an environment variable WORKDIR to specify the directory where my remember templates are located. I would like to have a template located in WORKDIR/tasks.org Using the code below, when I invoke remember-mode and press t, I get the default remember template instead of the WORKDIR/tasks.org. ;; I can get the value of WORKDIR successfully (setq org-directory (getenv WORKDIR)) (setq org-remember-templates '( (Personal ?p * %U %?\n\n %i\n %a ~/Documents/personal/notes.org) (Work Tasks ?t * TODO %U %?\n\n %i\n %a (concat org-directory tasks.org)) )) Any help would be appreciated. Thanks, --Nate ___ 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
Re: [Orgmode] Use environment variable for location of templates?
I think the issue is that you need to supply a function to be invoked to create the file name. I tested your approach and found if you change the line to use a lambda function (Work Tasks ?t * TODO %U %?\n\n %i\n %a (lambda() (concat org-directory tasks.org))) seems to work. Make sure that your environment variable ends in a / so the path is constructed correctly. Jere On Fri, Jun 19, 2009 at 12:39 PM, Nathan Neff nathan.n...@gmail.com wrote: Hello, I'm a beginner at lisp/emacs, and realize this is a basic question. I would like to use an environment variable WORKDIR to specify the directory whereOh, I'm familiar with the file variables and all, thanks for the tip. Since the org-remember code is written to support files that are not in org-mode as targets of remember items, it just seemed to me it shouldn't then switch back to assuming it was an org mode file simply because the text being inserted resembles a particular type of regexp. my remember templates are located. I would like to have a template located in WORKDIR/tasks.org Using the code below, when I invoke remember-mode and press t, I get the default remember template instead of the WORKDIR/tasks.org. ;; I can get the value of WORKDIR successfully (setq org-directory (getenv WORKDIR)) (setq org-remember-templates '( (Personal ?p * %U %?\n\n %i\n %a ~/Documents/personal/ notes.org) (Work Tasks ?t * TODO %U %?\n\n %i\n %a (concat org-directory tasks.org)) )) Any help would be appreciated. Thanks, --Nate ___ 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 ___ 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
Re: [Orgmode] Use environment variable for location of templates?
Jere McDevitt jere.mcdev...@gmail.com wrote: I think the issue is that you need to supply a function to be invoked to create the file name. I tested your approach and found if you change the line to use a lambda function (Work Tasks ?t * TODO %U %?\n\n %i\n %a (lambda() (concat org-directory tasks.org))) seems to work. Make sure that your environment variable ends in a / so the path is constructed correctly. Jere On Fri, Jun 19, 2009 at 12:39 PM, Nathan Neff nathan.n...@gmail.com wrote: Hello, I'm a beginner at lisp/emacs, and realize this is a basic question. I would like to use an environment variable WORKDIR to specify the directory whereOh, I'm familiar with the file variables and all, thanks for the tip. Since the org-remember code is written to support files that are not in org-mode as targets of remember items, it just seemed to me it shouldn't then switch back to assuming it was an org mode file simply because the text being inserted resembles a particular type of regexp. my remember templates are located. I would like to have a template located in WORKDIR/tasks.org Using the code below, when I invoke remember-mode and press t, I get the default remember template instead of the WORKDIR/tasks.org. ;; I can get the value of WORKDIR successfully (setq org-directory (getenv WORKDIR)) (setq org-remember-templates '( (Personal ?p * %U %?\n\n %i\n %a ~/Documents/personal/notes.org) (Work Tasks ?t * TODO %U %?\n\n %i\n %a (concat org-directory tasks.org)) )) Any help would be appreciated. Jere is right in general, but for this particular case, the simpler solution is to use just the file name: org interprets that to mean a file relative to org-directory: (setq org-directory (getenv WORKDIR)) (setq org-remember-templates '( (Personal ?p * %U %?\n\n %i\n %a ~/Documents/personal/notes.org) (Work Tasks ?t * TODO %U %?\n\n %i\n %a tasks.org) )) Nick ___ 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