abo-abo / pamparam

Simple and fast flashcards for Emacs
229 stars 16 forks source link

The format of the master file #26

Closed daphniz closed 4 years ago

daphniz commented 4 years ago

If I am not mistaken, all :cards: trees in the master file must be first-level. Is there any good reason for this? If I used more than one, and used the file for non-pamparam things as well, I would prefer to gather all :cards: trees under a pamparam tree (level 1 or higher). I would also rather not have to tag each individual tree.

I think in the example you used in your video you had a single top-level tree, and you didn't use the file for anything else. So, in this case, it would seem better to me to have top-level card trees, and use some file-level property instead of a tag to indicate that this is indeed a pamparam file.

I would suggest using a file or tree property pamdepth to indicate how many subtrees of the current file or tree should count as cards (now the hardcoded depth is 2, right?). This would require pamdepth to be non-inheritable; I don't know whether that's possible.

I may of course have overlooked some complications that caused you to decide on the format you did.

abo-abo commented 4 years ago

Thanks, please test.

daphniz commented 4 years ago

Thank you! But what do you think about allowing top-level cards? These files will tend to have only one top-level tree, which seems wrong.

Also, is using a tag really the best way to mark the presence of cards? This tag will be inherited, but it seems inappropriate that a single card should have the tag cards.

How about an alternative file property?

#+PROPERTY: pamparam t
abo-abo commented 4 years ago

Thanks, please test.

daphniz commented 4 years ago

I don't seem to have the function org--property-global-or-keyword-value.

abo-abo commented 4 years ago

Thanks, please test again.

daphniz commented 4 years ago

Thanks. But I don't have org-keyword-properties either.

 (defun pamapram--cards-at-level-one-p ()
    (org--property-global-value "pamparam" t))

seems to work.

abo-abo commented 4 years ago

Which version of Org are you using? I have 9.3.1, which does not have org--property-global-value.

daphniz commented 4 years ago

Oh. I'm using 9.3.6. Org plus contrib.

abo-abo commented 4 years ago

OK. It seems Org changed the API from org-file-properties to org-keyword-properties. It should work now for both versions.