如何安装org-drill?

wol*_*lfv 5 emacs org-mode org-drill

我是 Emacs 新手,并完成了 Emacs 和基本 org-mode 教程。\n现在我想安装 org-drill。以下是我在 Emacs 上安装 org-drill 的失败尝试。

\n\n

http://orgmode.org/worg/org-contrib/org-drill.html

\n\n
\n

安装

\n\n

最简单的方法是自定义变量“org-modules”(Mxcustomize-variables RET org-modules)并确保勾选“drill”。

\n
\n\n

我打开 spanish.org 文件并在 Emacs 中输入“Meta-xcustomize-variables”,回显区域显示:

\n\n
M-x customize-variables [No match]\n
Run Code Online (Sandbox Code Playgroud)\n\n

所以我尝试“Meta-x custom-variable”单数:

\n\n
M-x customize-variable <RET> org-modules\n
Run Code Online (Sandbox Code Playgroud)\n\n

自定义菜单对组织模块开放。\n因此“Mxcustomize-variables”末尾的“\'s\”是说明中的拼写错误,或者是我做错了。

\n\n

在“自定义”菜单中,我选中“钻取”并单击“应用并保存”按钮。

\n\n

退出并重新启动 Emacs。

\n\n

打开 spanish.org 文件。

\n\n

在 Emacs 中输入“Mx org-drill”,回显区域显示:

\n\n
M-x org-drill-table-\n
Run Code Online (Sandbox Code Playgroud)\n\n

为什么没有“org-drill”?\n我输入:

\n\n
M-x customize-variable <RET> org-modules\n
Run Code Online (Sandbox Code Playgroud)\n\n

“钻”仍然被选中。

\n\n

然后我尝试了手动安装说明:

\n\n
\n

对于手动安装,请将以下内容放入 .emacs 中。您还需要确保 Org\ 的“contrib/lisp”目录位于 emacs 加载路径中。

\n\n

(需要\'org-drill)

\n
\n\n

我从http://orgmode.org/cgit.cgi/org-mode.git/tree/contrib/lisp/org-drill.el下载了 org-drill.el并将其复制到 ~/emacsLoad/org-drill。 el,然后将这些行添加到我的 .emacs 文件中:

\n\n
(add-to-list \'load-path "~/emacsLoad/")\n(require \'org-drill)\n
Run Code Online (Sandbox Code Playgroud)\n\n

重新启动 Emacs,*警告* 窗口显示:

\n\n
Warning (initialization): An error occurred while loading `/home/wolfv/.emacs\':\n\nSymbol\'s function definition is void: copy-list\n
Run Code Online (Sandbox Code Playgroud)\n\n

因此,我使用“--debug-init\”选项启动 Emacs 来查看完整的错误回溯。\n*Backtrace* 窗口显示:

\n\n
Debugger entered--Lisp error: (void-function copy-list)\n  copy-list((1 (quote org-drill-visible-cloze-face) nil))\n  org-drill--compute-cloze-keywords()\n  (defvar org-drill-cloze-keywords (org-drill--compute-cloze-keywords) nil)\n  require(org-drill)\n  eval-buffer(#<buffer  *load*> nil "/home/wolfv/.emacs" nil t)  ; Reading at buffer position 1727\n  load-with-code-conversion("/home/wolfv/.emacs" "/home/wolfv/.emacs" t t)\n  load("~/.emacs" t t)\n  #[0 "\\205\\262\n
Run Code Online (Sandbox Code Playgroud)\n\n

这是什么意思?我不懂 Lisp。

\n\n

我输入:

\n\n
M-x customize-variable <RET> org-modules\n
Run Code Online (Sandbox Code Playgroud)\n\n

不再检查“钻”。

\n\n

我很困惑。如何在Emacs上安装drill-org?

\n\n

我在 buildvm-10.phx2.fedoraproject.org 上使用 2015-09-14 的 GNU Emacs 24.5.1 (x86_64-redhat-linux-gnu, GTK+ Version 3.16.6)\n

\n\n

这是我的 .emacs 文件:

\n\n
;; load the built-in package manager\n(require \'package)\n\n;; add Emacs package repositories to the list of available repositories\n(add-to-list \'package-archives \'("org" . "http://orgmode.org/elpa/"))\n(add-to-list \'package-archives \'("melpa" . "http://melpa.org/packages/"))\n(add-to-list \'package-archives \'("melpa-stable" . "http://stable.melpa.org/packages/"))\n\n(add-to-list \'load-path "~/emacsLoad/")\n\n;; disable automatic package loading\n(setq package-enable-at-startup nil)\n\n;; from http://stackoverflow.com/a/10095853/580206 > RNA\n(defun ensure-package-installed (&rest packages)\n  "Assure every package is installed, ask for installation if it\xe2\x80\x99s not.\n\nReturn a list of installed packages or nil for every skipped package."\n  (mapcar\n   (lambda (package)\n     (if (package-installed-p package)\n     nil\n       (if (y-or-n-p (format "Package %s is missing. Install it? " package))\n       (package-install package)\n     package)))\n   packages))\n\n;; make sure to have downloaded archive description\n(or (file-exists-p package-user-dir)\n    (package-refresh-contents))\n\n;; load installed packages\n(package-initialize)\n\n;; make sure these packages are installed\n(ensure-package-installed \'evil)\n;;(ensure-package-installed \'evil \'org-drill)\n\n;; load the package into memory and call the main mode function\n(require \'evil)\n(evil-mode t)\n\n(require \'org-drill)\n;;(org-drill t)\n\n;; display cursor\'s (row,col) position in mode line\n(setq column-number-mode t)\n\n(custom-set-variables\n ;; custom-set-variables was added by Custom.\n ;; If you edit it by hand, you could mess it up, so be careful.\n ;; Your init file should contain only one such instance.\n ;; If there is more than one, they won\'t work right.\n \'(org-modules\n   (quote\n    (org-bbdb org-bibtex org-docview org-gnus org-info org-irc org-mhe org-rmail org-w3m org-drill))))\n(custom-set-faces\n ;; custom-set-faces was added by Custom.\n ;; If you edit it by hand, you could mess it up, so be careful.\n ;; Your init file should contain only one such instance.\n ;; If there is more than one, they won\'t work right.\n )\n
Run Code Online (Sandbox Code Playgroud)\n

Tah*_*san 3

我对 Emacs 或 Org Mode(或 Elisp)几乎一无所知,但这就是我让它工作的方式。

首先,当 Emacs(void-function xxx)在回溯中显示时,这意味着xxx尚未定义。经过多次谷歌搜索,我发现它copy-list是在一个名为 的模块中定义的cl,需要加载该模块。

org-drill.el事实上,这种依赖关系已在顶部注明:

(eval-when-compile (require 'cl))
Run Code Online (Sandbox Code Playgroud)

所以我不知道为什么这不起作用。不过值得庆幸的是,我们可以自己加载它。

Org Drill 有大量其他依赖项,因此您不想自己管理它们。添加 Org Mode 的elpa存储库,然后安装org-plus-contrib包含 Org Drill 的软件包。

.emacs/的.emacs.d/init.el顶部添加

(package-initialize)
Run Code Online (Sandbox Code Playgroud)

这将加载您已安装的所有 elpa 软件包。通常,Emacs 会在之后加载 elpa 包init.el,但我们想从org-plus-contrib包中加载内容。

之后,您可以加载clorg-drill

(require 'cl)
(require 'org-drill)
Run Code Online (Sandbox Code Playgroud)

参考