2

Very impressed with what I have seen in Org Mode so far. And who knows, may be, I will switch over to Emacs from vim. :)

Here is what is part of my .emacs:

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

(setq org-capture-templates
      '(("t" "Todo" entry (file+headline "~/Documents/organize/org-mode/todo.org" "Tasks")
         "* TODO %?\n %i\n %a")))

(setq org-agenda-files '("~/Documents/organize/org-mode/"))

There is a directory ~/Documents/organize/org-mode. It has todo.org and notes.org files.

Yet when I start emacs, it produces an error: Symbol's value as variable is void: org-directory and when I try C-c c (tied to org-capture), it produces a window asking me to select a capture template. Options are: Task, Customize and Abort. Customize leads to a complicated dialog. And Task leads to an error: Target buffer .notes for file+headline not in Org mode.

I am new to Emacs and did not even remotely get what is happening here.

What do I need to do to go beyond this?

  • 3
    The variable org-directory will not be defined until org is loaded, so if you want to use it you should write something like (with-eval-after-load 'org (setq org-default-notes-file (expand-file-name "notes.org" org-directory))). Is file+handling meant to read file+headline? Can you clarify what you have bound C-c C to (note that letter case matters)? Is it the command org-capture? You can check what command a key sequence is bound to by typing C-h k or M-x describe-key RET before typing out the key sequence. – Basil Oct 24 '17 at 12:35
  • @Basil Thanks. So, can I just ignore the warning and open my org files like there is no error? Yes. file+handling was meant to be file+headline. Emacs wont let me copy that text. So, had to key it in and the error crept in. And the key is C-c c and it is the command org-capture. I have edited the question to correct both the errors. – deshmukh Oct 24 '17 at 13:04
  • 1
    No, you shouldn't ignore the warning because it shouldn't be arising and its cause could be causing further trouble down the line. Have you tried replacing your org-default-notes-file-setting code with my suggestion? Alternatively you could just set org-default-notes-file to a hard-coded filename, as opposed to one constructed from the variable org-directory. – Basil Oct 24 '17 at 13:09
  • @Basil Your first suggestion did it. Thanks. Will you please post it as an answer? I will then accept it. – deshmukh Oct 24 '17 at 13:30
  • Glad it worked. I am not an experienced moderator, but my impression is that simple support issues like this can just be closed, as the answer may be of limited help to others. Having said that, I'll be happy to write up an aswer if you or anyone else asks again. – Basil Oct 24 '17 at 13:35

Your Answer

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

Browse other questions tagged or ask your own question.