简体   繁体   中英

org mode setup problem when trying to use capture

I was trying to use the capture as is explained in org-manual p 74. This is the .emacs file for org mode.

(require 'org-install)
(add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
(define-key global-map "\C-cl" 'org-store-link)
(define-key global-map "\C-ca" 'org-agenda)
(setq org-log-done t)

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

But I get this error. What might be wrong?

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

ADDED

After Dave's answer, I modified the code, and it seems to work fine. But the other problem that I found was Cc c gives me this error.

Symbol's function definition is void : org-capture

First of all, make sure you're using org-mode 6.36 or later. (Earlier versions use remember.el which has a different setup.)

You're using a symbol that's not defined, org-directory . Try using:

(setq org-default-notes-file (expand-file-name "~/notes.org"))

Followup : To load a recent org-mode package:

(add-to-list 'load-path "/my/home/emacs.d/org-7.01h/lisp")
(require 'org-install)
(require 'org) ;; maybe this line is redundant

Note that as packaged, the org-mode lisp files are in the lisp sub-directory.

I know this question has been answered, but I would like to leave a more thorough answer for those people who haven't been successful. I just went through the motions and I am going to make a list of each step below.

  1. http://orgmode.org/ and download tar.gz (at time of download it was Stable version 7.9.2 (sept. 2012)
  2. untar (tar -zxvf nameoffile.tar.gz OR just double click the file)
  3. edit the local.mk file to put files where you want them. I have a folder in my user directory called Scripts where I keep things orderly based on scripting language. I decided to keep my emacs stuff there too. Inside the scripts folder is a folder called "emacs". As a prefix, I used "Scripts", but I could have made the Prefix "/Users/Username/Scripts/emacs". I just had to make sure that the other directories started with "$(prefix)/emacs"—HINT: check the infodir.
     # Name of your emacs binary EMACS = emacs 


    # Where local software is found prefix = /Users/Username/Scripts
    # Where local lisp files go. lispdir= $(prefix)/emacs/lisp/org
    # Where local data files go. datadir = $(prefix)/emacs/etc/org
    # Where info files go. infodir = $(prefix)/emacs/info

  4. Edit your .emacs file and paste in there two new paths (if not already there). The first one is for the lisp folder for any .el files you may have and the second one is there because I contained the org files in an org folder, which is a subfolder of lisp. Unfortunately, the "load-path" is not smart enough to detect subfolders, therefore you must set each folder explicitly.

    • (setq load-path (cons "~/Scripts/emacs/lisp" load-path))
    • (setq load-path (cons "~/Scripts/emacs/lisp/org" load-path))
  5. Check version in Aquamacs or Emacs with Mx org-version (meta key + x and type "org-version")

HINT:

  • nano ~/.emacs
  • open -a Textedit ~/.emacs

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