I am keeping a common init.el for work and private on separate machines. So dependent on my machine I have common settings and machine dependent settings.

How do I get to add an element to the org-refile-targets variable?

This works well:

(setq org-refile-targets '(("~/sync/common.org"  :maxlevel . 2)
                           ("~/org/machine1.org" :maxlevel . 2)))

How can I separate this variable definition?

Not working:

 (add-to-list 'org-refile-targets ("~/sync/common.org"  :maxlevel . 2))
 (add-to-list 'org-refile-targets ("~/org/machine1.org" :maxlevel . 2))

Testing results in an error of:

*** Eval error *** Invalid function: "~/org/machine1.org"


If you try to add a list such way it will be evaluated and interpreted as function. Quote it.

(add-to-list 'org-refile-targets '("~/sync/common.org"  :maxlevel . 2))
  • Thanks! I swear i tried that before, but must have had another error in my statement. – Benjamin Jun 1 '20 at 10:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.