Skip to content

chenyanming/anki.el

Repository files navigation

Anki.el

Table of Contents

Description

Yet another Anki Emacs Client.

Anki Search Mode:

img/anki.png

Anki Mode:

img/anki.gif

Features

Current status:

  • Anki Mode: Card Study Mode
  • Anki Search Mode: Anki Cards Browser
  • List and switch decks
  • Preview Card
  • Preview Card’s Front
  • Preview Card’s Back
  • (Re)Play audio
  • Support shrface

Installation

Clone to path

git clone [email protected]:chenyanming/anki.el.git ~/.emacs.d/lisp/anki/

require

(add-to-list 'load-path "~/.emacs.d/lisp/anki/")
(require 'anki)
(setq sql-sqlite-program "/usr/bin/sqlite3")
(setq anki-collection-dir "/Users/damonchan/Library/Application Support/Anki2/Android & Mac")
(setq anki-audio-player (or (executable-find "aplay") (executable-find "afplay")))
;; (require 'shrface) ; If you use shrface, require it here
(setq anki-shr-rendering-functions (append anki-shr-rendering-functions shr-external-rendering-functions))

use-package

(use-package anki
  :defer t
  :load-path "~/.emacs.d/lisp/anki/"
  :init
  (add-hook 'anki-mode-hook #'shrface-mode)
  (add-hook 'anki-card-mode-hook #'shrface-mode)
  (autoload 'anki "anki")
  (autoload 'anki-browser "anki")
  (autoload 'anki-list-decks "anki")
  :config
  ;; (require 'shrface) ; If you use shrface, require it here
  (setq anki-shr-rendering-functions (append anki-shr-rendering-functions shr-external-rendering-functions))
  (setq sql-sqlite-program "/usr/bin/sqlite3")
  ;; Set up the collection directory, which should contain a file - collection.anki2 and a folder - collection.media
  (setq anki-collection-dir "/Users/chandamon/Library/Application Support/Anki2/User 1"))

Usage

Enter anki mode:

M-x anki

Start from deck lists:

M-x anki-list-decks

Enter anki search mode:

M-x anki-browser
  • f Flip Card (Toggle between Question and Answer)
  • r (Re)play audio
  • l List and switch deck
  • n/p Next Card (Only works if the current card is Blue Card. For Red or Green cards, you have to answer Red or Green Cards before studying Blue cards.)
  • q Quit
  • 1 Answer with “Again” (Review again after 1 minute: Hard coded)
  • 2 Answer with “Hard” (Review again after 10 minutes: anki-learn-sm2-steps, default 10 minutes)
  • 3 Answer with “Good” (Graduating interval in days: anki-learn-sm2-graduating-interval, default 1 day)
  • 4 Answer with “Easy” (More Easy interval in days: anki-learn-sm2-more-easy-interval, default 4 days)

Notice:

  1. anki.el does not modify the original anki database (at this moment), therefore, the review feature uses its own database: anki-core-database-file.
  2. If you modify the anki database through the official anki app, you have to close the official app(Important), then M-x anki-search-update to re-read the anki database.
  3. If you want to insert/update/delete cards, please use official anki app (at this moment).
  4. M-x anki-db-current-deck-reschedule to reschedule the current deck (Delete all review logs of current deck).

Header

The header in anki-mode shows the current card status:

  • Blue: New Cards
  • Red: Due Cards to be reviewed again (< 1 day)
  • Green: Due Cards to be reviewed (>= 1 day)

Related Packages

  • shrface: Enable org features on shr-rendered buffers, without the heaviness of org.

News/Logs

2020-10-13

Version 0.3.0:

  • Add Review Feature using SM2 algorithm.

2020-09-19

Version 0.2.0:

  • New Features: anki

2020-09-14

Version 0.1.0:

  • New Features: anki-browser, anki-list-decks