Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install org-drill?

I am new to Emacs and completed the Emacs and basic org-mode tutorials. Now I want to install org-drill. The following is my failed attempts at installing org-drill on Emacs.

From 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.

I open spanish.org file and type "Meta-x customize-variables" in Emacs and the echo area says:

M-x customize-variables [No match]

So I try "Meta-x customize-variable" singular:

M-x customize-variable <RET> org-modules

Customize Menu is open to Org Modules. So either 's' at the end of "M-x customize-variables" is a typo in the instructions, or I am doing it wrong.

In the Customize Menu, I check "drill" and click "Apply and Save" button.

Quit and restart Emacs.

Open spanish.org file.

Type "M-x org-drill " in Emacs and the echo area says:

M-x org-drill-table-

Why is there no "org-drill"? I type:

M-x customize-variable <RET> org-modules

"Drill" is still checked.

So then I tried the manual install instructions:

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)

I downloaded org-drill.el from http://orgmode.org/cgit.cgi/org-mode.git/tree/contrib/lisp/org-drill.el and copied it to ~/emacsLoad/org-drill.el, then added these lines to my .emacs file:

(add-to-list 'load-path "~/emacsLoad/")
(require 'org-drill)

Restarted Emacs and the *Warnings* window says:

Warning (initialization): An error occurred while loading `/home/wolfv/.emacs':

Symbol's function definition is void: copy-list

So I start Emacs with the `--debug-init' option to view a complete error backtrace. The *Backtrace* window says:

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

What does it mean? I don't know Lisp.

I type:

M-x customize-variable <RET> org-modules

"Drill" is no longer checked.

I am stumped. How to install drill-org on Emacs?

I am using GNU Emacs 24.5.1 (x86_64-redhat-linux-gnu, GTK+ Version 3.16.6) of 2015-09-14 on buildvm-10.phx2.fedoraproject.org

Here is my .emacs file:

;; 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.
 )
like image 349
wolfv Avatar asked Feb 08 '23 22:02

wolfv


1 Answers

I hardly know anything anything about Emacs or Org Mode (or Elisp), but this is how I got it to work.

Firstly, when Emacs says (void-function xxx) in the backtrace, it means that xxx has not been defined. After much googling, I found out that copy-list is defined in a module called cl, which needs to be loaded.

org-drill.el in fact has this dependency noted at the top:

(eval-when-compile (require 'cl))

So I don't know why this doesn't work. Thankfully though, we can load it ourselves.

Org Drill has loads of other dependencies, therefore you don't want to manage them yourself. Add Org Mode's elpa repository, then install org-plus-contrib package which includes Org Drill.

Within your .emacs / .emacs.d/init.el, right at the top, add

(package-initialize)

This will load all the elpa packages you have installed. Normally, Emacs loads the elpa packages AFTER init.el but we want to load stuff from org-plus-contrib package.

After this, you can load cl and org-drill:

(require 'cl)
(require 'org-drill)

References

  • Loading all elpa packages
like image 160
Tahir Hassan Avatar answered Feb 22 '23 20:02

Tahir Hassan