diff options
Diffstat (limited to 'modules/org-drill-config.el')
| -rw-r--r-- | modules/org-drill-config.el | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/modules/org-drill-config.el b/modules/org-drill-config.el index 296b0550a..29f6130a2 100644 --- a/modules/org-drill-config.el +++ b/modules/org-drill-config.el @@ -8,7 +8,7 @@ ;; Eager reason: none; optional flashcard workflow, a command-loaded deferral ;; candidate for Phase 4. ;; Top-level side effects: defines a drill keymap, registers it under cj/custom-keymap. -;; Runtime requires: user-constants, keybindings. +;; Runtime requires: user-constants, keybindings, system-lib. ;; Direct test load: yes (requires keybindings explicitly). ;; ;; Notes: Org-Drill @@ -29,6 +29,7 @@ (require 'user-constants) ;; `drill-dir' (require 'keybindings) ;; provides `cj/custom-keymap' +(require 'system-lib) ;; completion table + file annotator (declare-function org-drill "org-drill" (&optional scope drill-match resume-p)) (declare-function org-drill-resume "org-drill" ()) (declare-function org-capture "org-capture" (&optional goto keys)) @@ -57,7 +58,13 @@ drill commands and the drill capture templates share." (defun cj/--drill-pick-file (dir) "Prompt for one of the drill Org files in DIR; return its absolute path." (expand-file-name - (completing-read "Choose flashcard file: " (cj/--drill-files-or-error dir) nil t) + (completing-read "Choose flashcard file: " + (cj/completion-table-annotated + 'cj-drill-file + (cj/completion-file-annotator + (lambda (c) (expand-file-name c dir))) + (cj/--drill-files-or-error dir)) + nil t) dir)) (defun cj/--drill-pick-dir (other-dir) @@ -95,9 +102,12 @@ With a prefix arg OTHER-DIR, prompt for the directory instead of `drill-dir'." (defun cj/drill-refile () "Refile to a drill file." (interactive) - (setq org-refile-targets '((nil :maxlevel . 1) - (drill-dir :maxlevel . 1))) - (call-interactively 'org-refile)) + (let ((org-refile-targets + `((nil :maxlevel . 1) + (,(mapcar (lambda (f) (expand-file-name f drill-dir)) + (cj/--drill-files-or-error drill-dir)) + :maxlevel . 1)))) + (call-interactively 'org-refile))) ;; ------------------------------- Drill Keymap -------------------------------- |
