Emacs initialization as org file: how can I get the right version of org
I've been experimenting with the org-babel tutorial that describes how to put the bulk of your emacs init.el file into an org file. However, I would like to use org-mode 8 (mainly for the new exporter) and I'm on gnu emacs 24.3.1 (for windows) which comes with org-mode 7.9 built-in, so I have org-mode installed from the elpa package manager instead of using the built-in version.
My problem is that emacs loads the org-mode that comes with emacs rather than the one I have installed in elpa. Is there a way to load the elpa org-mode?
Here is my init.el, modified from the org-babel tutorial to point (I thought) to my org-mode distribution - but my emacs-lisp knowledge is minimal so I don't really know what it is doing.
;;; From http://orgmode.org/worg/org-contrib/babel/intro.html#literate-programming
;;; init.el --- Where all the magic begins
;;
;; This file loads Org-mode and then loads the rest of our Emacs initialization from Emacs lisp
;; embedded in literate Org-mode files.
;; Load up Org Mode and (now included) Org Babel for elisp embedded in Org Mode files
(setq dotfiles-dir (file-name-directory (or (buffer-file-name) load-file-name)))
(let* ((org-dir (expand-file-name
"elpa" (expand-file-name
"org-plus-contrib-20130624" )))
(org-contrib-dir (expand-file-name
"lisp" (expand-file-name
"contrib" (expand-file-name
".." org-dir))))
(load-path (append (list org-dir org-contrib-dir)
(or load-path nil))))
;; load up Org-mode and Org-babel
(require 'org-install)
(require 'ob-tangle))
;; load up all literate org-mode files in this directory
(mapc #'org-babel-load-file (directory-files dotfiles-dir t ".org$"))
;;; init.el ends here
在任何对org-babel-load-file
或任何其他组织函数的调用之前放置(package-initialize)
,您将获得ELPA版本。
I use same kind of initialization and recently did two major changes:
Here's how my init.el looks now,
https://github.com/d4gg4d/my-emacs/blob/master/init.el
Also,
我也在一个基于组织的配置文件中配置了软件包仓库,因此,在加载org之前,我在init.el中调整了加载路径:
;; remove org-mode shipped with emacs from the load-path
(setq custom-org-path (car (file-expand-wildcards
(concat my-init-dir "elpa/org-plus-contrib-20*"))))
(when custom-org-path
(setq load-path (remove-if (lambda (x) (string-match-p "org$" x)) load-path))
(add-to-list 'load-path custom-org-path))
链接地址: http://www.djcxy.com/p/30640.html
上一篇: 在Emacs组织中设置个人维基