dengste / org-caldav

Caldav sync for Emacs orgmode
GNU General Public License v3.0
717 stars 105 forks source link

Handle variable org-directory setting #194

Closed chuckf closed 4 years ago

chuckf commented 4 years ago

I'm not sure if I'm doing something wrong or this is an unsupported feature. If the former, please provide guidance on the proper configuration. If the latter, please consider this an enhancement request. If more information is required, please let me know.

I sync my org files between different machines using Nextcloud. My config files are sync'd using a ~/dotfiles directory in git. Due to different configs on the machines the path to my org directory changes between two paths. I use the following code to handle the changes in my config file:

(if (file-directory-p "~/Nextcloud/orgmode_notes") (setq org-directory "~/Nextcloud/orgmode_notes") (setq org-directory "~/home_nextcloud/orgmode_notes"))

To handle the location of my calendar files, I use the following code. The first two :files and :inbox settings work and they are using the the appropriate path on each machine with the changes made manually. However, I would like to use something like a set of the commented out lines that incorporates the concat org-directory setting so I don't have to manually change the config file on each machine to use the feature.

`(setq org-caldav-calendars

  '((:calendar-id "orgcal"

                 :files ("~/Nextcloud/orgmode_notes/orgmode_demo.org")

                 :inbox "~/Nextcloud/orgmode_notes/caldav_inbox.org")))

;; (setq org-caldav-files '(concat org-directory "/orgmode_demo.org"))

;; (setq org-caldav-inbox '(concat org-directory "/caldav_inbox.org")))))

;; :files ((concat org-directory "/orgmode_demo.org"))

;; :inbox (concat org-directory "/caldav_inbox.org")))) `

dengste commented 4 years ago

If you want to evaluate ELISP in a list, you need to quote this list with a backquote ("`"). Example:

(setq org-caldav-files `( ,(concat "foo" "bar") ,(concat "foo" "baz")))

(setq org-caldav-calendars
  `((:calendar-id "work@whatever" :files (,(concat "foo" "bar") ,(concat "foo" "baz"))
     :inbox ,(concat "bar" "baz"))))

Hope this helps.

chuckf commented 4 years ago

Thanks for the clarification. These changes did indeed make the difference and fixed the issue.