joostkremers / ebib

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

Display reading list status in index buffer (maybe just more flexible display all round) #217

Open Hugo-Heagren opened 3 years ago

Hugo-Heagren commented 3 years ago

I would find it useful to display the reading list status of an item in the index buffer---just like the status displayed in the modeline at the moment: whether the item is on the list or not, and if so, whether it has been read or not. I would find it espcially useful to colour-coordinate this display (in the index) with the corresponding text properties of TODO and DONE items in my org mode buffers (to signify things to read and that have been read).

I can imagine that a few other users might also want reading list information in the index line, but my particular ideas are quite specific. I wonder if it might be a good idea to make the index line more customisable overall, perhaps with arbitrary elisp somehow? I don't know what the best way to do this would be (or much about the basic emacs capabilities involved) but I would be willing to have a look.

joostkremers commented 3 years ago

The index display is actually configurable, including the possibility to define new columns. Which columns are shown is defined in ebib-index-columns, and the columns themselves are defined in ebib-field-transformation-functions. (The name isn't very informative, I admit...)

There is some information in the manual here, but in order to find out how to define new column types, you'll need to check the doc string of ebib-field-transformation-functions. You can take inspiration from the functions ebib-notes-display-note-symbol (note esp. that the field and db arguments here are completely ignored) and ebib--format-entry-info-for-modeline.

The function ebib--reading-list-item-p could be expanded a bit to return the status of the reading list item: nil if the entry is not on the list at all, the TODO state if it is on the list. That would provide the basis for color-coding the marker in the index buffer.

If you create something along these lines, I'd be happy to include it in Ebib.

Hugo-Heagren commented 3 years ago

Thanks! I had the column customisation, but not the new columns. I'll have a look later.

Hugo-Heagren commented 3 years ago

I had a look at this just now thinking it would be pretty simple. It's not. All the code should be straightforward, and you're right that the functionality for modifying the index columns is fine, but there is no low-level function for checking whether an item which is on the reading list is active or not. I could make a local hacky fix which would probably work, but (at least for the sake of keeping my init file tidy!) I'd much rather improve the software itself. So I'll have a look at some point and make a PR, which will also probably include some extra functions for the columns.