我是 Emacs 新手,完成了 Emacs 和基本的 org-mode 教程。
现在我想安装 org-drill。以下是我在 Emacs 上安装 org-drill 的失败尝试。
来自 http://orgmode.org/worg/org-contrib/org-drill.html
Installation
The easiest way is to customise the variable 'org-modules' (M-x customize-variables RET org-modules) and make sure 'drill' is ticked.
我打开 spanish.org 文件并在 Emacs 中输入“Meta-x customize-variables”,回显区域显示:
M-x customize-variables [No match]
所以我尝试“Meta-x customize-variable”单数:
M-x customize-variable <RET> org-modules
自定义菜单对组织模块开放。
因此,“M-x customize-variables”末尾的“s”是说明中的错字,或者我做错了。
在自定义菜单中,我选中“钻取”并单击“应用并保存”按钮。
退出并重新启动 Emacs。
打开 spanish.org 文件。
在 Emacs 中输入“M-x org-drill”,回显区显示:
M-x org-drill-table-
为什么没有“org-drill”?
我输入:
M-x customize-variable <RET> org-modules
“钻头”仍处于选中状态。
所以我尝试了手动安装说明:
For manual installation, put the following in your .emacs. You will also need to make sure that Org's "contrib/lisp" directory is in the emacs load-path.
(require 'org-drill)
我从 http://orgmode.org/cgit.cgi/org-mode.git/tree/contrib/lisp/org-drill.el 下载了 org-drill.el
并将其复制到 ~/emacsLoad/org-drill.el,然后将这些行添加到我的 .emacs 文件中:
(add-to-list 'load-path "~/emacsLoad/")
(require 'org-drill)
重新启动 Emacs 和 *Warnings* 窗口显示:
Warning (initialization): An error occurred while loading `/home/wolfv/.emacs':
Symbol's function definition is void: copy-list
所以我用 `--debug-init' 选项启动 Emacs 来查看完整的错误回溯。
*Backtrace* 窗口显示:
Debugger entered--Lisp error: (void-function copy-list)
copy-list((1 (quote org-drill-visible-cloze-face) nil))
org-drill--compute-cloze-keywords()
(defvar org-drill-cloze-keywords (org-drill--compute-cloze-keywords) nil)
require(org-drill)
eval-buffer(#<buffer *load*> nil "/home/wolfv/.emacs" nil t) ; Reading at buffer position 1727
load-with-code-conversion("/home/wolfv/.emacs" "/home/wolfv/.emacs" t t)
load("~/.emacs" t t)
#[0 "\205\262
这是什么意思?我不知道 Lisp。
我输入:
M-x customize-variable <RET> org-modules
“钻头”不再被选中。
我难住了。如何在 Emacs 上安装 Drill-org?
我正在使用 GNU Emacs 24.5.1(x86_64-redhat-linux-gnu,GTK+ 版本 3.16.6)
2015 年 9 月 14 日在 buildvm-10.phx2.fedoraproject.org 上
这是我的 .emacs 文件:
;; load the built-in package manager
(require 'package)
;; add Emacs package repositories to the list of available repositories
(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/"))
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
(add-to-list 'package-archives '("melpa-stable" . "http://stable.melpa.org/packages/"))
(add-to-list 'load-path "~/emacsLoad/")
;; disable automatic package loading
(setq package-enable-at-startup nil)
;; from http://stackoverflow.com/a/10095853/580206 > RNA
(defun ensure-package-installed (&rest packages)
"Assure every package is installed, ask for installation if it’s not.
Return a list of installed packages or nil for every skipped package."
(mapcar
(lambda (package)
(if (package-installed-p package)
nil
(if (y-or-n-p (format "Package %s is missing. Install it? " package))
(package-install package)
package)))
packages))
;; make sure to have downloaded archive description
(or (file-exists-p package-user-dir)
(package-refresh-contents))
;; load installed packages
(package-initialize)
;; make sure these packages are installed
(ensure-package-installed 'evil)
;;(ensure-package-installed 'evil 'org-drill)
;; load the package into memory and call the main mode function
(require 'evil)
(evil-mode t)
(require 'org-drill)
;;(org-drill t)
;; display cursor's (row,col) position in mode line
(setq column-number-mode t)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(org-modules
(quote
(org-bbdb org-bibtex org-docview org-gnus org-info org-irc org-mhe org-rmail org-w3m org-drill))))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
最佳答案
我对 Emacs 或 Org Mode(或 Elisp)几乎一无所知,但这就是我让它工作的方式。
首先,当 Emacs 说 (void-function xxx)
在回溯中,这意味着 xxx
尚未定义。经过多次谷歌搜索,我发现 copy-list
在一个名为 cl
的模块中定义,需要加载。org-drill.el
实际上在顶部有这种依赖关系:
(eval-when-compile (require 'cl))
所以我不知道为什么这不起作用。不过值得庆幸的是,我们可以自己加载它。
Org Drill 有很多其他依赖项,因此您不想自己管理它们。添加组织模式的
elpa
repository ,然后安装org-plus-contrib
包,其中包括 Org Drill。在您的
.emacs
内/.emacs.d/init.el
,在顶部,添加(package-initialize)
这将加载您已安装的所有 elpa 软件包。通常,Emacs 会在
init.el
之后加载 elpa 包。但我们想从 org-plus-contrib
加载内容包裹。在此之后,您可以加载
cl
和 org-drill
:(require 'cl)
(require 'org-drill)
引用文献
关于emacs - 如何安装 org-drill?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34983106/