emacs-citar / citar

Emacs package to quickly find and act on bibliographic references, and edit org, markdown, and latex academic documents.
GNU General Public License v3.0
502 stars 54 forks source link

feat!: make indicator affixes configurable #753

Closed bdarcus closed 1 year ago

bdarcus commented 1 year ago

The current indicators are hard-coded, with the only configurable details being the symbols in citar-symbols, and the space between them in citar-symbol-separator.

This makes all of it configurable by adding:

BREAKING CHANGE: citar-symbols will be deprecated in favor of citar-indicators

Close: #601


Status

From what I can tell, everything works correctly; this example removes the links indicator, and uses default for files, and icons for notes:

image

And while I haven't benchmarked, I don't believe this should be any slower.

Aside: I had an idea to extend this later so people can separately configure left (what we do now) and right sides of the affixation.

I think I may turn citar-indicators into a defcustom, but later.

In the second commit I switched to using a cl-defstruct for the citar-indicator type. Maybe a tad overkill, but it mirrors what we do with citar-cache, and it provides some advantages from a coding POV. I've made this function public to encourage people to use it in their configs.

@andersjohansson with some help, I figured out the code for this. When I merge this, you could use it for #744.

bdarcus commented 1 year ago

OK, merged. I think it's pretty solid, though let me know, or send a PR, if any little bugs.

Does occur to me I didn't really include error handling in the key functions, so that's a good next step.