4
votes

EDIT I've also asked this question on emacs.stackexchange

I'm a relative emacs newbie and have set up my emacs (24.4.1) to work with clojure as described here.

The gist of it is that I am now using the latest org-mode from git and loading it in my init.el (I am using prelude btw) as below:

   (add-to-list 'load-path "~/repos/org-mode/lisp")
   (require 'org)
   (require 'ob-clojure)

I am trying to use org to write a literate clojure program that I can export to markdown. Clojure and babel now work well, evaluation works etc, but when I try to export my org file I get an error.

    load-with-code-conversion: Symbol's value as variable is void: p

The stack trace when I set toggle-debug-on-error is:

    Debugger entered--Lisp error: (void-variable p)
        eval-buffer(#<buffer  *load*> nil
             "/Users/krisfoster/repos/org-mode/lisp/ox.el" nil t)
             ; Reading at buffer position 229233
        load-with-code-conversion("/Users/krisfoster/repos/org-mode/lisp/ox.el"
             "/Users/krisfoster/repos/org-mode/lisp/ox.el" nil t)
        autoload-do-load((autoload "ox" "Export dispatcher for Org mode.\n
            \nIt provides an access to common export related tasks in a         
            buffer.\nIts interface comes in two flavors: standard and 
            expert.\n\nWhile both share the same set of bindings, only the 
            former\ndisplays the valid keys associations in a dedicated 
            buffer.\nScrolling (resp. line-wise motion) in this buffer is done 
            with\nSPC and DEL (resp. C-n and C-p) keys.\n\nSet variable `org-
            export-dispatch-use-expert-ui' to switch to one\nflavor or the 
            other.\n\nWhen ARG is \\[universal-argument], repeat the last 
            export action, with the same set\nof options used back then, on 
            the current buffer.\n\nWhen ARG is \\[universal-argument] \\
            [universal-argument], display the asynchronous export 
            stack.\n\n(fn &optional ARG)" t nil) org-export-dispatch)
        command-execute(org-export-dispatch)

I tried to resolve this by (require-ing the various org export packages, the ones in the clone of the org git repo that is, from within my init.el. But no dice - in fact that generated yet more issues. I have tried debugging but can't figure out what is wrong. I am suspecting I need to be requiring something but don't know what.

I have my init.el here - init.el gist

Any-one have any ideas what I am doing wrong?

Thanks in advance.

1
you could consider posting this question on emacs.stackexchange.com lot more emacs eyes would look at it :)Shlomi
doh! what a good idea. Will do.Kris
have posted on emacs.stackexchange. But if any one sees this and knows the answer please feel free to let me know. Thanks.Kris

1 Answers

1
votes

There was a bug in org-mode around the time you made this post, so the problem may be resolved. However, I noticed a few issues with your init file. Some things which might help

  • Use the lisp package manager to install your packages (ELPA). This will make your life much easier. The org guys maintain an ELPA repository which is updated regularly and will likely be a little more stable than just pulling in the repo. They have a version called org-plus-contrib which I use and find quite good. Just add

    (add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/"))

  • You state that your running prelude, but I can't see anything in your init which is loading prelude (only a call to a function which turns off the guru-mode). Prelude is pretty good and quite popular, but if your going to use it, you need to 'drink the cool aid' that is, do things in the prelude way. For example, prelude comes with org-mode and uses ELPA to install it. You need to be careful your not get a blend of org versions. Another alternative to prelude which I found very good is Steve Purcell's emacs.d. I found it a little easier to work with YMMV, but it may be worth checking out as it has good support for the mac. See emacs.d

  • It is a really good idea to break up your emacs init script into separate files. This makes it easy to comment out lots of stuff when your trying to track down a problem and allows you to just focus on the key bits your trying to get working. I maintain my init.el file as an org file and use babel to generate all the lisp code. You can have a look at it on github. I originally started with Purcell's emacs.d and then borrowed with pride (stole) much of it to go into my own config. It isn't a fine example of how to configure emacs, but might help with your setup

  • I notice your attempting to use cider as the backend 'evaluator' for clojure code. Note that you only need to do this if you want to have blocks of clojure in your org file which you want to evaluate and then use the result. You don't need to do this if all you want to do is generate *.clj files from your org code. Instead, you just want to 'tangle' your org file, which will generate the updated clj source files, which you can then work on. This keeps things a lot simpler and avoids problems arising when you try to do things with your org file that attempt to evaluate the clojure code and fail. Note also that I expect you would need to do a bit more than just set cider as the backend evaluator - cide is just an interface to a repl. You would need a repl as well.