11

私は、emacs init.el ファイルの大部分を org ファイルに入れる方法を説明するorg-babel チュートリアルを試してきました。ただし、org-mode 8 (主に新しいエクスポーター用) を使用したいのですが、org-mode 7.9 が組み込まれている gnu emacs 24.3.1 (Windows 用) を使用しているため、org-mode がインストールされています。組み込みバージョンを使用する代わりに、 elpa パッケージ マネージャーから。

私の問題は、emacs が、elpa にインストールしたものではなく、emacs に付属の組織モードをロードすることです。elpa org-mode をロードする方法はありますか?

これが私の init.el で、org-babel チュートリアルから (私が思っていた) 私の org-mode ディストリビューションを指すように変更されています。

;;; 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
4

5 に答える 5

9

(package-initialize)またはその他の Org 関数の呼び出しの前に配置すると、 ELPAorg-babel-load-fileバージョンが取得されます。

于 2013-07-02T09:58:43.250 に答える
3

私は同じ種類の初期化を使用しており、最近 2 つの大きな変更を行いました。

これが私のinit.elの外観です。

https://github.com/d4gg4d/my-emacs/blob/master/init.el

また、

  • ubuntu に付属していた .deb パッケージ化された org-mode を削除しました
于 2013-07-02T11:41:55.073 に答える
3

すでに解決されており、多少関連しているだけですが、パッケージベースのソリューションを使用していないが、emacs を再起動せずに org や cedet/semantic などをアンロードする必要がある人にこれを提供すると思いました。

一般に、最初の名前の正規表現に基づいて一連の機能をアンロードするには、次のようなことを行います。これは、読み込まれたすべての組織機能をカバーしていないように見える Andreas の回答のハードコードされたバージョンよりも完全に見えます (少なくとも私の場合)。

load-historyファイルの膨大な関連リストです-> reqs、provides、defuns、...

(mapc
 #'(lambda (f) (and (featurep f) (unload-feature f t)))
 (loop for file-syms in load-history
       for prov = (assoc 'provide file-syms)
       with features
       if (and prov (string-match "^org" (symbol-name (cdr prov)))) 
       collect (cdr prov) into features
       finally return features))

"^org"あなたのニーズに合わせて正規表現を置き換えるか、ワイルドになってdefunにしてください。

これは、読み込まれたすべての組織機能を から取得してload-historyアンロードし、新しい読み込みパスを追加して、新しい場所から同じ機能を再読み込みするように変更することもできます。

于 2013-07-04T03:38:12.133 に答える
1

この方法で出荷された組織モードとインストール済みの開発バージョンをアンロード

(defun unload-org-mode ()
  (interactive)
  (and (featurep 'org-agenda)(unload-feature 'org-agenda t ))
  (and (featurep 'org-bbdb)(unload-feature 'org-bbdb t ))
  (and (featurep 'org-bibtex)(unload-feature 'org-bibtex t ))
  (and (featurep 'org-compat)(unload-feature 'org-compat t ))
  (and (featurep 'org-exp)(unload-feature 'org-exp t ))
  (and (featurep 'org-exp-blocks)(unload-feature 'org-exp-blocks t ))
  (and (featurep 'org-faces)(unload-feature 'org-faces t ))
  (and (featurep 'org-footnote)(unload-feature 'org-footnote t ))
  (and (featurep 'org-gnus)(unload-feature 'org-gnus t ))
  (and (featurep 'org-html)(unload-feature 'org-html t ))
  (and (featurep 'org-info)(unload-feature 'org-info t ))
  (and (featurep 'org-infojs)(unload-feature 'org-infojs t ))
  (and (featurep 'org-irc)(unload-feature 'org-irc t ))
  (and (featurep 'org-jsinfo)(unload-feature 'org-jsinfo t ))
  (and (featurep 'org-list)(unload-feature 'org-list t ))
  (and (featurep 'org-macs)(unload-feature 'org-macs t ))
  (and (featurep 'org-mew)(unload-feature 'org-mew t ))
  (and (featurep 'org-mhe)(unload-feature 'org-mhe t ))
  (and (featurep 'org-rmail)(unload-feature 'org-rmail t ))
  (and (featurep 'org-src)(unload-feature 'org-src t ))
  (and (featurep 'org-vm)(unload-feature 'org-vm t))
  (and (featurep 'org-w3m)(unload-feature 'org-w3m t))
  (and (featurep 'org-wl)(unload-feature 'org-wl t )))

(defun ar-load-PATH-TO-NEW-org-mode ()
  (interactive)
  (unload-org-mode)
  (find-file "~/PATH-TO-NEW-org-mode/lisp/ob-python.el")
  (add-to-list 'load-path "~/PATH-TO-NEW-org-mode")
  (add-to-list 'load-path "~/PATH-TO-NEW-org-mode/lisp")
  (load "~/PATH-TO-NEW-org-mode/lisp/ob-comint.el" nil t)
  (load "~/PATH-TO-NEW-org-mode/lisp/ob-emacs-lisp.el" nil t)
  (load "~/PATH-TO-NEW-org-mode/lisp/org.el" nil t)
  (load "~/PATH-TO-NEW-org-mode/lisp/ob-eval.el" nil t)
  (load "~/PATH-TO-NEW-org-mode/lisp/ob.el" nil t)
  (load "~/PATH-TO-NEW-org-mode/lisp/ob-python.el")
  ;; (load "~/PATH-TO-NEW-org-mode/testing/org-test-ob-consts.el" nil t)
  ;; (load "~/PATH-TO-NEW-org-mode/testing/org-test.el" nil t)
  (load-this-directory "~/PATH-TO-NEW-org-mode/lisp")
    (org-babel-do-load-languages
   'org-babel-load-languages
   '(
     (sh . t)
     (python . t)
     (emacs-lisp . t)
     (perl . t)
     (R . t)
     ))
)

(ar-load-PATH-TO-NEW-org-mode)

バージョンが存在するディレクトリに置き換えPATH-TO-NEW-org-modeます。

于 2013-07-02T06:01:17.870 に答える