From f6ec07f64617f1f493a7ec41d7fc72d89100abb9 Mon Sep 17 00:00:00 2001 From: Tibo De Peuter Date: Sat, 20 Jun 2026 19:58:49 +0200 Subject: [PATCH] feat(notetaking): anki integration --- notetaking/.gitignore | 59 ++++++++++++++++++++++++++++++++ notetaking/flake.nix | 65 ++++++++++++++++++++++-------------- notetaking/init.el | 19 +---------- notetaking/modules/my-org.el | 32 +++++++++++++++++- 4 files changed, 131 insertions(+), 44 deletions(-) create mode 100644 notetaking/.gitignore diff --git a/notetaking/.gitignore b/notetaking/.gitignore new file mode 100644 index 0000000..5069bc7 --- /dev/null +++ b/notetaking/.gitignore @@ -0,0 +1,59 @@ +# -*- mode: gitignore; -*- +*~ +\#*\# +/.emacs.desktop +/.emacs.desktop.lock +*.elc +auto-save-list +tramp +.\#* + +# Org-mode +.org-id-locations +*_archive + +# flymake-mode +*_flymake.* + +# eshell files +/eshell/history +/eshell/lastdir + +# elpa packages +/elpa/ + +# reftex files +*.rel + +# AUCTeX auto folder +/auto/ + +# cask packages +.cask/ +dist/ + +# Flycheck +flycheck_*.el + +# server auth directory +/server/ + +# projectiles files +.projectile + +# directory configuration +.dir-locals.el + +# network security +/network-security.data + +# undo-tree +*.~undo-tree~ + +# org-roam +bookmarks +eln-cache/ +history +org-roam.db +places +request/ diff --git a/notetaking/flake.nix b/notetaking/flake.nix index 8cd3d2b..9705ed2 100644 --- a/notetaking/flake.nix +++ b/notetaking/flake.nix @@ -19,6 +19,32 @@ plugins = with pkgs.emacsPackages; [ ]; + + emacsDependencies = with pkgs; [ + hunspell + hunspellDicts.nl_NL + hunspellDicts.en_GB-large + ghostscript + graphviz + imagemagickBig + poppler-utils + ripgrep + + wl-clipboard + + # Any less than medium isn't guaranteed to work + (texlive.withPackages (ps: with ps; [ + scheme-medium + latexmk + # File '*.sty' not found + capt-of + preview + standalone + wrapfig + ])) + # required by +jupyter + (python314.withPackages (ps: with ps; [ jupyter ])) + ]; in { devShells.default = pkgs.mkShell { packages = [ @@ -28,38 +54,27 @@ package = pkgs.emacs; # pkgs.emacs-git extraEmacsPackages = epkgs: [ - epkgs.unicode-fonts - epkgs.pdf-tools + epkgs.org-anki epkgs.org-pdftools + epkgs.pdf-tools + epkgs.unicode-fonts pkgs.shellcheck ]; }) - pkgs.hunspell - pkgs.hunspellDicts.nl_NL - pkgs.hunspellDicts.en_GB-large - pkgs.ghostscript - pkgs.graphviz - pkgs.imagemagickBig - pkgs.poppler-utils - pkgs.ripgrep + (pkgs.anki.withAddons [ + #(pkgs.ankiAddons.passfail2.withConfig { + # config = { + # again_button_name = "Incorrect"; + # good_button_name = "Correct"; + # }; + #}) - pkgs.wl-clipboard - - # Any less than medium isn't guaranteed to work - (pkgs.texlive.withPackages (ps: with ps; [ - scheme-medium - latexmk - # File '*.sty' not found - capt-of - preview - standalone - wrapfig - ])) - # required by +jupyter - (pkgs.python314.withPackages (ps: with ps; [ jupyter ])) - ]; + pkgs.ankiAddons.anki-connect + pkgs.pandoc + ]) + ] ++ emacsDependencies; }; }); } diff --git a/notetaking/init.el b/notetaking/init.el index ccee2ab..cca0d16 100644 --- a/notetaking/init.el +++ b/notetaking/init.el @@ -114,22 +114,7 @@ (pdf-loader-install) ) -(use-package org-preview-html ;; https://github.com/jakebox/org-preview-html - :ensure t - :bind (:map org-mode-map ("C-c p" . org-preview-html-mode)) - :custom - (org-preview-html-viewer 'eww) ;; Use built-in EWW browser - (org-preview-html-refresh-configuration 'save) - (add-hook 'eww-mode-hook (lambda () (display-line-numbers-mode -1))) - ;; Pin the preview window layout to the right - (add-to-list 'display-buffer-alist - '("\\*eww\\*" - (display-buffer-in-direction) - (direction . right) - (window-width . 0.5) - ) - ) - ) +;; Theming (use-package olivetti :ensure t @@ -169,8 +154,6 @@ ;; TODO Automatically save buffer when going to other file -- maybe interactively? ;; TODO Spellchecking (UK & Dutch) -;; TODO Some automation to create anki cards intext without having to write the boilerplate - ;; TODO Finally, compare experience to organice https://organice.200ok.ch/ ;; TODO org-compile-file: File "/tmp/nix-shell.UEk6Ye/orgtexcJso3E.dvi" wasn’t produced Please adjust ‘dvipng’ part of ‘org-preview-latex-process-alist’. diff --git a/notetaking/modules/my-org.el b/notetaking/modules/my-org.el index a71632e..4786547 100644 --- a/notetaking/modules/my-org.el +++ b/notetaking/modules/my-org.el @@ -65,7 +65,7 @@ (org-roam-dailies-directory "dailies/") (org-roam-completion-everywhere t) :bind ( - ("C-c r f" . org-roam-node-find) + ("C-c r f" . org-roam-node-find) ;; TODO This is case sensitive, make it insensitive ("C-c r j" . org-roam-dailies-capture-today) ("C-c r t" . org-roam-dailies-goto-today) ) @@ -110,3 +110,33 @@ ("C-c i" . org-download-clipboard) ) +(use-package org-preview-html ;; https://github.com/jakebox/org-preview-html + :ensure t + :bind (:map org-mode-map ("C-c p" . org-preview-html-mode)) + :custom + (org-preview-html-viewer 'eww) ;; Use built-in EWW browser + (org-preview-html-refresh-configuration 'save) + (add-hook 'eww-mode-hook (lambda () (display-line-numbers-mode -1))) + ;; Pin the preview window layout to the right + (add-to-list 'display-buffer-alist + '("\\*eww\\*" + (display-buffer-in-direction) + (direction . right) + (window-width . 0.5) + ) + ) + ) + +;; Integrations + +(use-package org-anki ;; https://github.com/eyeinsky/org-anki + :ensure t + :bind (:map org-mode-map + ("C-c a c" . org-anki-cloze-dwim) ;; Insert cloze on cursor + ("C-c a d" . org-anki-delete-entry) ;; Delete cards from Anki + ("C-c a i" . org-anki-sync-entry) ;; Create card from current header + ("C-c a s" . org-anki-sync-all) ;; Sync all cards in buffer + ("C-c a u" . org-anki-update-all) ;; Update existing cards in buffer + ) + ) +