joostkremers / ebib

A BibTeX database manager for Emacs.
https://joostkremers.github.io/ebib/
BSD 3-Clause "New" or "Revised" License
272 stars 37 forks source link

To have an indicator in the index of the reading state of an entry (and allow more reading states) #293

Closed KindlyRepeat closed 3 months ago

KindlyRepeat commented 4 months ago

Hi Joost,

I am interested in two things that are somewhat tangled (at least in my head).

The first one is having an indicator in the index to identify the reading state (TODO, DONE, etc.) of an entry. I'd like to be able to sort according to this state, for example TODO first, no state second and DONE last. If I wanted to sort according to this "reading state" field, the two current options, ascend and descend, would not be sufficient as I want the sorting to be independent of the character (or string) used to represent the "reading state" in the index. The way to solve this also depends on the reception of my second idea and if it considered helpful.

The second thing is to allow more states than DONE and TODO in the reading list. I would personally like to use a STARTED keyword as a state in between DONE and TODO. In this context, a command ebib-reading-list-state-cycle-item would be useful to go from one state to the next. It might be useful to define the possibles states as an alist where the order of apparition in the alist would define the next state.

I'd be willing to work on this if there is some interest.

Thanks !

joostkremers commented 4 months ago

Your first idea, adding a reading state column to the index, is already possible: The user option ebib-field-transformation-functions defines column names and functions to obtain the content to be displayed in the index buffer. The documentation kinda suggests that the fields in this option must be valid biblatex fields, but that's not actually the case. You can define any column name here, just as long as you define a function to get the value from the database.

Once a column is defined in ebib-field-transformation-functions, you can use it in the user option ebib-index-columns to create a column for it. Sorting can also be customised: The user option ebib-field-sort-functions-alist defines custom sort functions for index columns. Just define a sort function for your new column and it should all work.

The multiple TODO states for reading lists is another thing, however. Currently, Ebib only supports two, but I agree it would be nice to have support for more user-defined states. If you're willing to work on it, that'd be great!

KindlyRepeat commented 3 months ago

Thanks for the info ! I'll close this issue in favor of #217 (which I missed for some reason)