summaryrefslogtreecommitdiff
path: root/modules/org-drill-config.el
diff options
context:
space:
mode:
authorCraig Jennings <craigmartinjennings@gmail.com>2024-04-11 01:39:11 -0500
committerCraig Jennings <craigmartinjennings@gmail.com>2024-04-11 01:39:11 -0500
commit07fd4f1a6930dc62880b0fd7a0496270f4c2efd6 (patch)
tree31c37427859b391dd8dcad9abc2f4f3515f072b5 /modules/org-drill-config.el
parenta55a5248bd2dae5f849476d0f7b5dcd8d91cf929 (diff)
more fit and finish work
User Constants - move all file and directory constants into it's own file - create the directories and files if they don't exist - warn the user when not found/created General - remove duplicate dirvish go menu entry - remove xterm color in test code (it's already in eshell) - fixed org-drill not starting - fixing issue with auto-complete not working in eshell - adding playlists location for dirvish - moved all org-drill config into the use-package declaration - added drill-dir to user-constants - default ledger-file location changed; updated tasks - git ignore the persist folder - added more point values in fontaine menu - fix for gptel early key grab in authinfo.gpg - removed localrepo from reset script - remove magit-forge package - don't wait too long to bury-buffers - add setting native compile warnings to 'silent - fixed sdcv errors when looking up a word normally and in nov
Diffstat (limited to 'modules/org-drill-config.el')
-rw-r--r--modules/org-drill-config.el95
1 files changed, 44 insertions, 51 deletions
diff --git a/modules/org-drill-config.el b/modules/org-drill-config.el
index 127a94f7..be0256d3 100644
--- a/modules/org-drill-config.el
+++ b/modules/org-drill-config.el
@@ -4,7 +4,7 @@
;; Notes: Org-Drill
;; Start out your org-drill with C-d s, then select your file.
-;; the javascript bookmark I use to capture information from the web is below:
+;; the javascript bookmark I use to capture information from the web for org-drill files:
;; javascript:location.href='org-protocol://capture?template=d&url=%27+encodeURIComponent(location.href)+%27&title=%27+encodeURIComponent(document.title)+%27&body=%27+encodeURIComponent(window.getSelection())
;; create a new bookmark and add "Drill Entry" to the name field and the above
@@ -12,60 +12,11 @@
;; ----------------------------------- Tasks -----------------------------------
-
;;; Code:
-(require 'custom-functions) ;; for cj/merge-list-to-list
-
-(defvar org-drill-files (directory-files (concat sync-dir "drill/")
- t directory-files-no-dot-files-regexp))
-
-(with-eval-after-load 'org
- (cj/merge-list-to-list
- 'org-capture-templates
- '(("d" "Drill Question - Web"
- entry
- (file (lambda () (completing-read "Choose file: " org-drill-files)))
- "* Item :drill:\n%?\n** Answer\n%i\nSource: [[%:link][%:description]]\nCaptured On: %U" :prepend t)
- ("b" "Drill Question - EPUB"
- entry
- (file (lambda () (completing-read "Choose file: " org-drill-files)))
- "* Item :drill:\n%?\n** Answer\n%i\nSource: [[%:link][%(buffer-name (org-capture-get :original-buffer))]]\nCaptured On: %U" :prepend t)
- ("f" "Drill Question - PDF"
- entry
- (file (lambda () (completing-read "Choose file: " org-drill-files)))
- "* Item :drill:\n%?\n** Answer\n%(org-capture-pdf-active-region)\nSource:[[%L][%(buffer-name (org-capture-get :original-buffer))]]\nCaptured On: %U" :prepend t))))
-
(use-package org-drill
:after org
:preface
- (defun cj/drill-start ()
- "Prompt user to pick a drill org file, then starts an org-drill session."
- (interactive)
- (let ((choices org-drill-files))
- (setq chosen-drill-file (completing-read "Choose Flashcard File:" choices ))
- (find-file chosen-drill-file)
- (org-drill)))
-
- (defun cj/drill-edit ()
- "Prompts the user to pick a drill org file, then opens it for editing."
- (interactive)
- (let* ((choices org-drill-files)
- (chosen-drill-file (completing-read "Choose Flashcards to Edit:" choices)))
- (find-file chosen-drill-file)))
-
- (defun cj/drill-capture ()
- "Quickly capture a drill question."
- (interactive)
- (org-capture nil "d"))
-
- (defun cj/drill-refile ()
- "Refile to a drill file."
- (interactive)
- (setq org-refile-targets '((nil :maxlevel . 1)
- (org-drill-files :maxlevel . 1)))
- (call-interactively 'org-refile))
-
;; create an org-drill-map so you can use C-d as prefix
(define-prefix-command 'org-drill-map)
(global-set-key (kbd "C-d") 'org-drill-map)
@@ -83,7 +34,49 @@
(setq org-drill-hide-item-headings-p t) ;; don't show heading text
(setq org-drill-maximum-items-per-session 1000) ;; drill sessions end after 1000 cards
(setq org-drill-maximum-duration 60) ;; each drill session can last up to a an hour
- (setq org-drill-add-random-noise-to-intervals-p t)) ;; slightly vary number of days to repetition
+ (setq org-drill-add-random-noise-to-intervals-p t) ;; slightly vary number of days to repetition
+
+ (defun cj/drill-start ()
+ "Prompt user to pick a drill org file, then starts an org-drill session."
+ (interactive)
+ (let ((choices (directory-files drill-dir nil "^[^.].*\\.org$")))
+ (setq chosen-drill-file (completing-read "Choose Flashcard File:" choices))
+ (find-file (concat drill-dir chosen-drill-file))
+ (require 'org-drill)
+ (org-drill)))
+
+ (defun cj/drill-edit ()
+ "Prompts the user to pick a drill org file, then opens it for editing."
+ (interactive)
+ (let* ((choices drill-dir)
+ (chosen-drill-file (completing-read "Choose Flashcards to Edit:" choices)))
+ (find-file chosen-drill-file)))
+
+ (defun cj/drill-capture ()
+ "Quickly capture a drill question."
+ (interactive)
+ (org-capture nil "d"))
+
+ (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))
+
+ ;; add useful org drill capture templates
+ (require 'custom-functions)
+ (cj/merge-list-to-list
+ 'org-capture-templates
+ '(("d" "Drill Question - Web" entry
+ (file (lambda () (completing-read "Choose file: " drill-dir)))
+ "* Item :drill:\n%?\n** Answer\n%i\nSource: [[%:link][%:description]]\nCaptured On: %U" :prepend t)
+ ("b" "Drill Question - EPUB" entry
+ (file (lambda () (completing-read "Choose file: " drill-dir)))
+ "* Item :drill:\n%?\n** Answer\n%i\nSource: [[%:link][%(buffer-name (org-capture-get :original-buffer))]]\nCaptured On: %U" :prepend t)
+ ("f" "Drill Question - PDF" entry
+ (file (lambda () (completing-read "Choose file: " drill-dir)))
+ "* Item :drill:\n%?\n** Answer\n%(org-capture-pdf-active-region)\nSource:[[%L][%(buffer-name (org-capture-get :original-buffer))]]\nCaptured On: %U" :prepend t))))
(provide 'org-drill-config)
;;; org-drill-config.el ends here.