diff options
author | Leon Rische <leon.rische@me.com> | 2020-01-21 12:12:51 +0100 |
---|---|---|
committer | Leon Rische <leon.rische@me.com> | 2020-01-21 12:12:51 +0100 |
commit | 7dbbf1085fe2e6e753377e2cc237826589edb829 (patch) | |
tree | bb1bb08443b5c4120c87ea1e4cb75c99f1050be0 /org-fc.el | |
parent | d1eb3cbd4cb0859ae8b6f3204ed2fe6c48f73432 (diff) |
Add a hotkey for tagging cards during review
Diffstat (limited to 'org-fc.el')
-rw-r--r-- | org-fc.el | 22 |
1 files changed, 17 insertions, 5 deletions
@@ -60,6 +60,11 @@ :type 'float :group 'org-fc) +(defcustom org-fc-card-tags (list org-fc-suspended-tag) + "Card tags that can be added during review." + :type 'list + :group 'org-fc) + ;; TODO: Allow customizing this, currently that's not possible because ;; the indexers / filters expect a ISO8601 format. (defvar org-fc-timestamp-format "%FT%H:%M:%S" @@ -134,17 +139,24 @@ Used to determine if a card uses the compact style." ;;; Adding / Removing Tags -(defun org-fc-add-tag (tag) +(defun org-fc--add-tag (tag) "Add TAG to the heading at point." (org-set-tags-to (remove-duplicates (cons tag (org-get-tags-at (point) t)) :test #'string=))) -(defun org-fc-remove-tag (tag) +(defun org-fc--remove-tag (tag) "Add TAG to the heading at point." (org-set-tags-to (remove tag (org-get-tags-at (point) t)))) +;;;###autoload +(defun org-fc-tag-card (tag) + "Add one of the predefined card tags to the current card, +e.g. to suspend a card during review." + (interactive (list (completing-read "Tag: " org-fc-card-tags))) + (org-fc--add-tag tag)) + ;;; Registering Card Types (defvar org-fc-types '() @@ -192,7 +204,7 @@ Should only be used by the init functions of card types." (org-fc-timestamp-now)) (org-set-property org-fc-type-property type) (org-id-get-create) - (org-fc-add-tag org-fc-flashcard-tag)) + (org-fc--add-tag org-fc-flashcard-tag)) ;;; Default Card Types @@ -235,7 +247,7 @@ FN is called with point at the headline and no arguments." (if (org-fc-entry-p) (progn (org-fc-goto-entry-heading) - (org-fc-add-tag org-fc-suspended-tag)) + (org-fc--add-tag org-fc-suspended-tag)) (message "Entry at point is not a flashcard"))) ;;;###autoload @@ -249,7 +261,7 @@ FN is called with point at the headline and no arguments." `org-fc-unsuspend-overdue-percentage' of its interval, reset it to box 0, if not, keep the current parameters." (when (org-fc-suspended-entry-p) - (org-fc-remove-tag org-fc-suspended-tag) + (org-fc--remove-tag org-fc-suspended-tag) ;; Reset all positions overdue more than `org-fc-unsuspend-overdue-percentage'. (org-fc-set-review-data (mapcar |