l3kn / org-fc

Spaced Repetition System for Emacs org-mode
https://www.leonrische.me/fc/index.html
GNU General Public License v3.0
258 stars 31 forks source link

feat: Allow custom, per-card, cloze context value #97

Open cashpw opened 1 year ago

cashpw commented 1 year ago

Reference: #96

l3kn commented 1 year ago

Wow, you're fast.

This is pretty much exactly what I had in mind.

As I understand it, the new property is set each time a cloze card is initialized / updated so I assume the workflow you're thinking of is to manually edit the property for cards you want to change. One downside to this is that if there's a deck of many cards all using the default context and the default context changes, the property of the cards stays the same.

For this reason, I'd prefer a function that optionally adds the property, prompting for a numeric value.

cashpw commented 1 year ago

Wow, you're fast.

The trick is to forget to create the issue until you're more than half-way through implementing the feature.

For this reason, I'd prefer a function that optionally adds the property, prompting for a numeric value.

Done: org-fc-cloze-set-context. Do you think it's worthwhile to validate the user's input here as a non-negative integer?

cashpw commented 1 year ago

Checking in -- is there anything you'd like to see changed in this pull request?

l3kn commented 1 year ago

It just occurred to me that there is already a mechanism for this in the form of the org-fc-property macro and I've added an implementation based on that to the develop branch.

Two missing parts are a setter function (probably to hard to generate using the macro, due to the interactive-read) and a way to customize the property (not implemented yet, but should be possible in the macro).

Despite this, I think the macro-based approach will avoid some code duplication once more variables of this kind are added.