4

I was trying to use the capture as is explained in org-manual p. 85. This is the relevant part of my .emacs file.

  (setq org-default-notes-file (concat org-directory "~/Notities/org-mode/Capture.org"))
    (define-key global-map "\C-cc" 'org-capture)

But I get this error.

Symbol's value as variable is void: org-directory

I tried the following solution, but it didn't work. The filepath is directed to an existing file. Why do I still get this error?

1 Answer 1

10

Make sure you have the line (require 'org) before you set the location. This will ensure that the package org where org-directory is defined is loaded before it is used.

Also, if you are adding concating a path to org-directory, I think that the path you provide should be relative to org-directory, not an absolute path. In your case you might want to set:

(setq org-default-notes-file "~/Notities/org-mode/Capture.org")

instead. By default, I think org-directory is set to ~/org, but if you don't want this as your default directory, you can change this as well. For example, in your case:

(setq org-directory "~/Notities/org-mode")

Combining these things, it should work to add:

(require 'org)
(setq org-directory "~/Notities/org-mode")
(setq org-default-notes-file (concat org-directory "/Capture.org"))
(define-key global-map "\C-cc" 'org-capture)

to your .emacs file.

2
  • How do I know where org-directory is?
    – user72805
    Commented Jan 9, 2016 at 14:34
  • 1
    @user72805 Try C-h v org-directory and it should show you what it is set to.
    – elethan
    Commented Jan 9, 2016 at 14:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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