diff options
| author | Phillip Lord <phillip.lord@russet.org.uk> | 2019-06-29 16:35:12 +0100 |
|---|---|---|
| committer | Phillip Lord <phillip.lord@russet.org.uk> | 2019-06-29 16:35:12 +0100 |
| commit | e7460b6262cc8d3a1c27339cdc55969dfa03e409 (patch) | |
| tree | 905673c621ffefe4374b323f64d043e8fd4194f6 | |
| parent | 2b44b3628439df4252765ca380fa187045b04597 (diff) | |
| download | org-drill-e7460b6262cc8d3a1c27339cdc55969dfa03e409.tar.gz org-drill-e7460b6262cc8d3a1c27339cdc55969dfa03e409.zip | |
Regularize use of scope
| -rw-r--r-- | org-drill.el | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/org-drill.el b/org-drill.el index 19a11c0..00837b5 100644 --- a/org-drill.el +++ b/org-drill.el @@ -765,8 +765,7 @@ CMD is bound, or nil if it is not bound to a key." (defun org-drill-map-entries (func &optional scope drill-match &rest skip) "Like `org-map-entries', but only drill entries are processed." - (let ((org-drill-scope (or scope org-drill-scope)) - (org-drill-match (or drill-match org-drill-match))) + (let ((org-drill-match (or drill-match org-drill-match))) (apply 'org-map-entries func (concat "+" org-drill-question-tag (if (and (stringp org-drill-match) @@ -777,14 +776,20 @@ CMD is bound, or nil if it is not bound to a key." skip))) (defun org-drill-current-scope (scope) - (cl-case scope - (file nil) - (file-no-restriction 'file) - (directory - (directory-files - (file-name-directory (buffer-file-name)) - t "^[^.].*\\.org$")) - (t scope))) + "Translate SCOPE into an scope suitable for `org-map-entries'. + +If scope is NIL, then use `org-drill-scope'. + +Returns scope as defined by `org-map-entries'" + (let ((scope (or scope org-drill-scope))) + (cl-case scope + (file nil) + (file-no-restriction 'file) + (directory + (directory-files + (file-name-directory (buffer-file-name)) + t "^[^.].*\\.org$")) + (t scope)))) (defmacro org-drill-with-hidden-cloze-text (&rest body) `(progn @@ -3787,10 +3792,9 @@ shuffling is done in place." (defun org-drill-map-leitner (func &optional scope) "Return all entries marked with leitner tag." - (let ((scope (or scope org-drill-scope))) - (org-map-entries - func (concat "+" "leitner") - (org-drill-current-scope scope)))) + (org-map-entries + func (concat "+" "leitner") + (org-drill-current-scope scope))) (defun org-drill-all-leitner-capture (&optional scope) "Capture all items marked with a leitner tag" @@ -3959,7 +3963,7 @@ shuffling is done in place." (org-drill-map-entries (lambda () (setq number-drill-entries (+ 1 number-drill-entries))) - org-drill-scope nil) + nil nil) (message "There are %s drill entries\nThere are %s leitner entries\nA total of %s entries." number-drill-entries (+ (length org-drill-leitner-boxed-entries) |
