Nicolas Goaziou <[email protected]> writes:
> Hello,
>
> stardiviner <[email protected]> writes:
>
>> Nicolas Goaziou <[email protected]> writes:
>>
>>> Hello,
>>>
>>> stardiviner <[email protected]> writes:
>>>
>>>> A gentle ping..
>>>
>>> I'm not sure "org-drill.el" is still actively maintained. I'm Cc'ing
>>> Paul Sexton. In the long run, I think this package could be packaged
>>> through ELPA instead.
>>
>> It is indeed not actively maintained. But still has some user are using
>> it. I found some recently used in Org Mode ML mentioned it.
>>
>> I will ping the author Paul Sexton, I would like to particited in
>> maintain it. If he agree to publish it to MELPA, I could help.
>
> Did you forget to add the new patch? Or is it intentional?
>
>
> Regards,
Oh, sorry, seems yes.
>From b95a90cbecdf4fa2f47079eed08d2395f2700d41 Mon Sep 17 00:00:00 2001
From: stardiviner <[email protected]>
Date: Sun, 27 Jan 2019 10:43:37 +0800
Subject: [PATCH] org-drill.el: Add feature let org-drill auto pronounce
* contrib/lisp/org-drill.el (org-drill-entry,
org-drill-entry-before-hook, org-drill-entry-after-hook): Add two
hooks around ~org-drill-entry~.
(org-drill-auto-pronounce): option to toggle this functionality.
(org-drill-pronounce-command,org-drill-pronounce-command-args): option
to specify the pronounce command and arguments.
(org-drill-pronounce-word): The real function to pronounce word.
(org-drill-hide-subheadings-if): fix issue in Org 9.2 version.
---
contrib/lisp/org-drill.el | 45 +++++++++++++++++++++++++++++++++++++--
1 file changed, 43 insertions(+), 2 deletions(-)
diff --git a/contrib/lisp/org-drill.el b/contrib/lisp/org-drill.el
index c7f509bff..39785e7e3 100644
--- a/contrib/lisp/org-drill.el
+++ b/contrib/lisp/org-drill.el
@@ -532,6 +532,35 @@ exponential effect on inter-repetition spacing."
:type 'float)
+(defcustom org-drill-entry-before-hook nil
+ "A hook to run functions when every org-drill entry."
+ :type 'hook
+ :group 'org-drill)
+
+(defcustom org-drill-entry-after-hook nil
+ "A hook to run functions when every org-drill entry."
+ :type 'hook
+ :group 'org-drill)
+
+(defcustom org-drill-auto-pronounce t
+ "Auto pronounce org-drill word if non-nil."
+ :type 'boolean
+ :safe #'booleanp
+ :group 'org-drill)
+
+(defcustom org-drill-pronounce-command ""
+ "Org-drill pronounce command."
+ :type 'string
+ :safe #'stringp
+ :group 'org-drill)
+
+(defcustom org-drill-pronounce-command-args ""
+ "Org-drill pronounce command arguments."
+ :type 'string
+ :safe #'stringp
+ :group 'org-drill)
+
+
(defvar drill-answer nil
"Global variable that can be bound to a correct answer when an
item is being presented. If this variable is non-nil, the default
@@ -1486,7 +1515,7 @@ the current topic."
(funcall test))
(hide-subtree))
(push (point) drill-sections)))
- "" 'tree))
+ nil 'tree))
(reverse drill-sections)))
@@ -2163,6 +2192,15 @@ If ANSWER is supplied, set the global variable `drill-answer' to its value."
(prog1 (org-drill-presentation-prompt)
(org-drill-hide-subheadings-if 'org-drill-entry-p)))))
+(defun org-drill-pronounce-word ()
+ "Pronounce word after querying."
+ (when org-drill-auto-pronounce
+ (shell-command-to-string
+ (format "%s %s %s &"
+ org-drill-pronounce-command org-drill-pronounce-command-args
+ (shell-quote-argument
+ (substring-no-properties
+ (org-get-heading 'no-tags 'no-todo 'no-priority 'no-comment)))))))
(defun org-drill-entry ()
"Present the current topic for interactive review, as in `org-drill'.
@@ -2202,6 +2240,7 @@ See `org-drill' for more details."
'org-drill-present-default-answer)
present-empty-cards (third presentation-fn)
presentation-fn (first presentation-fn)))
+ (run-hook-with-args 'org-drill-entry-before-hook)
(prog1
(cond
((null presentation-fn)
@@ -2223,7 +2262,9 @@ See `org-drill' for more details."
(save-excursion
(funcall answer-fn
(lambda () (org-drill-reschedule))))))))
- (org-remove-latex-fragment-image-overlays)))))))
+ (when org-drill-auto-pronounce org-drill-pronounce-word)
+ (run-hook-with-args 'org-drill-entry-after-hook)
+ (org-remove-latex-fragment-image-overlays)))))))
(defun org-drill-entries-pending-p ()
--
2.20.1
--
[ stardiviner ]
I try to make every word tell the meaning what I want to express.
Blog: https://stardiviner.github.io/
IRC(freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3