4
votes

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.
 )
5
Presumably the instructions meant customize-variable and not customize-variables.Drew
Thanks @Drew. That got me a little further, but still "not match": M-x customize-variable RET Customize variable: org-modules [No match]wolfv
@Drew. I open an .org file and try again, this time the Customize Option opened. Apparently the Org Module has to be running in order to customize it.wolfv
Just as a test, I placed (tahir) into my .emacs file and started emacs using the --debug-init option, and it said (void-function tahir) in the backtrace.Tahir Hassan

5 Answers

3
votes

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

2
votes

org-mode worked with this init.el file:

(require 'package)
(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t)
(add-to-list 'load-path "~/emacsLoad/")
(package-initialize) ;; load all elpa packages before require 'org-drill

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

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,

Start Emacs.

Open the file spanish.org.

Type: M-x org-drill

Follow the prompts at the bottom of the screen.

1
votes

What I did (after spending hours on this) was:

mkdir --parents ~/.emacs.d/pkgs
cd !$
git clone git://orgmode.org/org-mode.git

And then I added this to ~/.emacs:

(add-to-list 'load-path "~/.emacs.d/pkgs/org-mode/contrib/lisp/")       
(require 'org-drill)

After this, it just works.

It seems the default emacs on *nix distros don't provide the contrib packages for org-mode, whereas the one from the git repo comes with “everything” bundled.

1
votes

Org-drill in official org-mode repository is out-of-date (2015), and seems that might be the best decision to install the top-notch version from BitBucket.

Prerequsites:

First of all please check Emacs load path by typing:

C-h v load-path <RET>

Emacs should output a list of all paths on your localhost where it habitually seeking for packages to load from. Feel free to choose any of them to allocate the optional packages to extend Emacs.

In my particular case the most pertinent is /usr/local/share/emacs/site-lisp/ By default it has a limited access, hence ensure your capability to write there:

$ ls -la /usr/local/share/emacs-lisp/

and perhaps add this capability:

$ sudo chmod 777 /usr/local/share/emacs-lisp/

Installation:

Suppose that container for your additional packages is ready to use. Thus:

  1. Download the necessary packages there:

    $ cd /usr/local/share/emacs/site-lisp/

    $ wget https://bitbucket.org/eeeickythump/org-drill/raw/01b05cd7561ad69e5ec9c1200414d4fa128c9a17/org-drill.el

    $ wget http://orgmode.org/cgit.cgi/org-mode.git/plain/contrib/lisp/org-learn.el # org-learn requred to org-drill

  2. Add (require 'org-drill) into your Emacs config file

  3. Restart your Emacs

  4. Open spanish.org

  5. Please enjoy!

1
votes

Here's how you can autoload org-drill with use-package to avoid increasing your startup time:

(require 'package)
(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t)
(package-initialize)

(use-package org-drill
  :defer t
  :ensure org-plus-contrib
  :commands (org-drill)
  :config
  ;; Config options
  )

The :ensure org-plus-contrib will make sure Emacs downloads org-plus-contrib, which is where org-drill is bundled.

The :commands (org-drill) creates an autoload for the org-drill command.