简体   繁体   中英

Org-mode: org-agenda-files defvar directory “evaluation”?

I have the following setup in my .emacs ...

(defvar org-dir "/home/mash/read/org/")

And use it around such as ...

(setq org-directory org-dir)
(setq org-default-notes-file (concat org-dir "mash.org"))

Now I understand that you can specify a directory such as ...

(setq org-agenda-files '("/home/mash/read/org/"))

But how would I do this with the variable?

(setq org-agenda-files '(org-dir))
(setq org-agenda-files '(,(org-dir))

Any ideas as I would like to use it in my capture templates too ...

(setq org-capture-templates
  '(("t" "Test" entry (file+headline (concat org-dir "test.org" "test")
      "* %?")))

The '(foo bar) syntax is equivalent to writing (list 'foo 'bar) . So you can set org-agenda-files like this:

(setq org-agenda-files (list org-dir))

Alternatively, you can replace the apostrophe ' with a backtick ` to create a list and then use comma to evaluate a part of that list

(setq org-capture-templates
  `(("t" "Test" entry (file+headline ,(concat org-dir "test.org" "test")
      "* %?")))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM