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
501 stars 54 forks source link

Fix edge case for `citar-org-shift-reference-{left,right}` #790

Closed krisbalintona closed 1 year ago

krisbalintona commented 1 year ago

The current behavior for citar-org-shift-reference-left and citar-org-shift-reference-right fails when, in the same citation, there are multiple references with the same citekey (regardless of prefix and suffix differences). The reason for this lies in citar-org--get-ref-index using citekeys to retrieve the index of a reference within a citation.

This pull request has that function use the point at the beginning of a reference instead. Doing so required a slight change to how citar-org--shift-reference leaves the point on the correct reference.

Finally, the final commit enhances how the point is left on the reference: rather than left at the beginning, the point retains its position relative to where the command was called in the reference. For instance, if the command was called on the fourth character of the reference, it will remain there.

bdarcus commented 1 year ago

Looks good.

Minor thing, for future reference: we're using conventional commit messages.

https://www.conventionalcommits.org

krisbalintona commented 1 year ago

Looks good.

Minor thing, for future reference: we're using conventional commit messages.

https://www.conventionalcommits.org

Thanks for letting me know. I haven't contributed to packages before, so I wasn't aware of the convention. I'll use it moving forward (for citar and other packages, if ever).

bdarcus commented 1 year ago

It does depend on the project. A lot are using it, however, because the conventions make it suitable for processing.

I can just squash merge this when you're done, however, and rewrite the commit message.

krisbalintona commented 1 year ago

It does depend on the project. A lot are using it, however, because the conventions make it suitable for processing.

I can just squash merge this when you're done, however, and rewrite the commit message.

I just remade the commit messages to be more helpful and (hopefully) follow the conventions. I haven't discovered any lingering bugs, so I believe this should be ready to go?

bdarcus commented 1 year ago

I just remade the commit messages to be more helpful and (hopefully) follow the conventions. I haven't discovered any lingering bugs, so I believe this should be ready to go?

You have it marked as a draft. I'll unmark it.