summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeon Rische <leon.rische@me.com>2020-09-07 12:12:05 +0200
committerLeon Rische <leon.rische@me.com>2020-09-07 12:12:05 +0200
commitca9c4272b73dfaaa3863124e96a8d761568d72d1 (patch)
tree2cd30abf8f2779223dbb2c1325b5f2127e2dca9a
parentf276b13ad837c4b866be4798ee7392158dd4adaf (diff)
Rework setup & flipping of text input cards
-rw-r--r--org-fc.el22
1 files changed, 10 insertions, 12 deletions
diff --git a/org-fc.el b/org-fc.el
index 8a7b2b9..f5eb75d 100644
--- a/org-fc.el
+++ b/org-fc.el
@@ -699,18 +699,14 @@ function is expected to be called with point on a heading."
(org-fc--init-card "text-input")
(org-fc-review-data-update '("front")))
-(defvar org-fc-type-text-input--hidden '())
-
(defun org-fc-type-text-input-setup (_position)
"Prepare a text-input card for review."
(interactive)
;; Hide answer
- (if (org-fc-has-back-heading-p)
- (progn
- (org-show-subtree)
- (setq org-fc-type-text-input--hidden (org-fc-hide-subheading "Back")))
- (setq org-fc-type-text-input--hidden nil)
- (org-flag-subtree t))
+ (outline-hide-subtree)
+ (when (org-fc-has-back-heading-p)
+ (org-show-entry)
+ (org-fc-with-point-at-back-heading (org-show-set-visibility 'minimal)))
;; Prompt user, create diff overlay
(let* ((pos-content (org-fc-text-input-content))
(content (cdr pos-content))
@@ -736,10 +732,12 @@ function is expected to be called with point on a heading."
")\n"))))
;; Reveal answer & diff
(save-excursion
- (org-show-subtree)
- (dolist (pos org-fc-type-text-input--hidden)
- (goto-char pos)
- (org-show-subtree))))
+ (org-show-entry)
+ (org-show-children)
+ (org-fc-with-point-at-back-heading
+ (org-show-entry)
+ (org-show-children)
+ (org-fc-show-latex))))
(org-fc-register-type
'text-input