[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/org-drill 4114c541a7 082/251: You can now customise the ke
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/org-drill 4114c541a7 082/251: You can now customise the keys for the 'quit', 'edit', 'tags', 'help' and |
Date: |
Mon, 17 Jan 2022 18:59:03 -0500 (EST) |
branch: elpa/org-drill
commit 4114c541a7a57e541f7d5273f12f89ead3b71195
Author: Paul Sexton <eeeickythump@gmail.com>
Commit: Paul Sexton <eeeickythump@gmail.com>
You can now customise the keys for the 'quit', 'edit', 'tags', 'help' and
'skip' actions in drill sessions, by setting the values of the variables
org-drill--quit-key and others.
Pressing C-g during a drill session will abort the session.
---
org-drill.el | 64 ++++++++++++++++++++++++++++++++++++++++++++----------------
1 file changed, 47 insertions(+), 17 deletions(-)
diff --git a/org-drill.el b/org-drill.el
index 95b192a02e..a78b8068ce 100755
--- a/org-drill.el
+++ b/org-drill.el
@@ -1,10 +1,10 @@
-;;; -*- coding: utf-8-unix -*-
+;; -*- coding: utf-8-unix -*-
;;; org-drill.el - Self-testing using spaced repetition
;;;
;;; Copyright (C) 2010-2015 Paul Sexton
;;;
;;; Author: Paul Sexton <eeeickythump@gmail.com>
-;;; Version: 2.4.6
+;;; Version: 2.4.7
;;; Keywords: flashcards, memory, learning, memorization
;;; Repository at http://bitbucket.org/eeeickythump/org-drill/
;;;
@@ -254,6 +254,23 @@ the hidden cloze during a test.")
(org-drill--compute-cloze-keywords))
+;; Variables defining what keys can be pressed during drill sessions to quit
the
+;; session, edit the item, etc.
+(defvar org-drill--quit-key ?q
+ "If this character is pressed during a drill session, quit the session.")
+(defvar org-drill--edit-key ?e
+ "If this character is pressed during a drill session, suspend the session
+with the cursor at the current item..")
+(defvar org-drill--help-key ??
+ "If this character is pressed during a drill session, show help.")
+(defvar org-drill--skip-key ?s
+ "If this character is pressed during a drill session, skip to the next
+item.")
+(defvar org-drill--tags-key ?t
+ "If this character is pressed during a drill session, edit the tags for
+the current item.")
+
+
(defcustom org-drill-card-type-alist
'((nil org-drill-present-simple-card)
("simple" org-drill-present-simple-card)
@@ -1346,11 +1363,19 @@ of QUALITY."
"Returns quality rating (0-5), or nil if the user quit."
(let ((ch nil)
(input nil)
- (next-review-dates (org-drill-hypothetical-next-review-dates)))
+ (next-review-dates (org-drill-hypothetical-next-review-dates))
+ (key-prompt (format "(0-5, %c=help, %c=edit, %c=tags, %c=quit)"
+ org-drill--help-key
+ org-drill--edit-key
+ org-drill--tags-key
+ org-drill--quit-key)))
(save-excursion
- (while (not (memq ch '(?q ?e ?0 ?1 ?2 ?3 ?4 ?5)))
+ (while (not (memq ch (list org-drill--quit-key
+ org-drill--edit-key
+ 7 ; C-g
+ ?0 ?1 ?2 ?3 ?4 ?5)))
(setq input (read-key-sequence
- (if (eq ch ??)
+ (if (eq ch org-drill--help-key)
(format "0-2 Means you have forgotten the item.
3-5 Means you have remembered the item.
@@ -1361,11 +1386,12 @@ of QUALITY."
4 - After a little bit of thought you remembered. (+%s days)
5 - You remembered the item really easily. (+%s days)
-How well did you do? (0-5, ?=help, e=edit, t=tags, q=quit)"
+How well did you do? %s"
(round (nth 3 next-review-dates))
(round (nth 4 next-review-dates))
- (round (nth 5 next-review-dates)))
- "How well did you do? (0-5, ?=help, e=edit, t=tags,
q=quit)")))
+ (round (nth 5 next-review-dates))
+ key-prompt)
+ (format "How well did you do? %s" key-prompt))))
(cond
((stringp input)
(setq ch (elt input 0)))
@@ -1382,7 +1408,7 @@ How well did you do? (0-5, ?=help, e=edit, t=tags,
q=quit)"
(case (car (elt input 0))
(wheel-up (ignore-errors (mwheel-scroll (elt input 0))))
(wheel-down (ignore-errors (mwheel-scroll (elt input 0)))))))
- (if (eql ch ?t)
+ (if (eql ch org-drill--tags-key)
(org-set-tags-command))))
(cond
((and (>= ch ?0) (<= ch ?5))
@@ -1413,7 +1439,7 @@ How well did you do? (0-5, ?=help, e=edit, t=tags,
q=quit)"
(org-set-property "DRILL_LAST_REVIEWED"
(time-to-inactive-org-timestamp (current-time))))
quality))
- ((= ch ?e)
+ ((= ch org-drill--edit-key)
'edit)
(t
nil))))
@@ -1484,8 +1510,12 @@ the current topic."
(apply 'format
(first fmt-and-args)
(rest fmt-and-args))
- (concat "Press key for answer, "
- "e=edit, t=tags, s=skip, q=quit."))))
+ (format (concat "Press key for answer, "
+ "%c=edit, %c=tags, %c=skip, %c=quit.")
+ org-drill--edit-key
+ org-drill--tags-key
+ org-drill--skip-key
+ org-drill--quit-key))))
(setq prompt
(format "%s %s %s %s %s %s"
(propertize
@@ -1531,7 +1561,7 @@ You seem to be having a lot of trouble memorising this
item.
Consider reformulating the item to make it easier to remember.\n"
'face '(:foreground "red"))
prompt)))
- (while (memq ch '(nil ?t))
+ (while (memq ch '(nil org-drill--tags-key))
(setq ch nil)
(while (not (input-pending-p))
(let ((elapsed (time-subtract (current-time) item-start-time)))
@@ -1542,12 +1572,12 @@ Consider reformulating the item to make it easier to
remember.\n"
(sit-for 1)))
(setq input (read-key-sequence nil))
(if (stringp input) (setq ch (elt input 0)))
- (if (eql ch ?t)
+ (if (eql ch org-drill--tags-key)
(org-set-tags-command)))
(case ch
- (?q nil)
- (?e 'edit)
- (?s 'skip)
+ (org-drill--quit-key nil)
+ (org-drill--edit-key 'edit)
+ (org-drill--skip-key 'skip)
(otherwise t))))
- [nongnu] elpa/org-drill e698616493 026/251: - More robust handling of the situation where we resume a drill session but, (continued)
- [nongnu] elpa/org-drill e698616493 026/251: - More robust handling of the situation where we resume a drill session but, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill e7ffd8e6eb 040/251: Renamed documentation file and fixed a few typos., ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 063e8035a8 071/251: - Ignore cloze markings if they occur inside Org source blocks, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 663a1ee3f3 079/251: Clarified that org-drill is licensed under GPL v3., ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 8a9192cc2f 080/251: Persistence of the optimal factor matrix across application sessions is now, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill cfe271d824 062/251: Fixed: org-drill-strip-all-data now works again (was using obsolete arguments, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 09f7bc5c9b 083/251: Backout changeset 5d9b61ea5a181eb282e4069c17cbdf00e4325726, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill f9a217faa1 052/251: Wrapped all calls to 'org-display-inline-images' in 'ignore-errors', to prevent, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill d0405e9311 060/251: Fixed bug with scheduling failed cards, caused by changes to 'org-schedule' in, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill e43199b988 056/251: Changed permissions on some files., ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 4114c541a7 082/251: You can now customise the keys for the 'quit', 'edit', 'tags', 'help' and,
ELPA Syncer <=
- [nongnu] elpa/org-drill 8c374c0998 091/251: Merged in Fuco/org-drill/fix-input (pull request #3), ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill c62093fad3 095/251: Added tag 2.5 for changeset 97921372f286, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 201e6991df 100/251: Added tag 2.6 for changeset f96493b0ba4a, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 66d74724d7 090/251: Turn off input method while reading events, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 6fc2bfe8c3 103/251: SM2 algorithm should now actually work., ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 615ce00d86 105/251: Fix org-drill-hide-subheadings-if, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 941ad8c2b8 110/251: Add leitner learning, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 355c3a602f 108/251: Merge fix/do-not-match-lockfile, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill 5e05755fdf 118/251: Update load-test name, ELPA Syncer, 2022/01/17
- [nongnu] elpa/org-drill d2591c4676 116/251: Dependency clean ups, ELPA Syncer, 2022/01/17