Fix dangling braces#879
Conversation
Currently they are inserted once for each citekey. This also removes the private function citar--insert-bibtex
Also remove compat and require cl-lib. This gets rid of message that cl-set-difference might be undefined.
|
I don't have any idea about the eldev related failing test 😬 |
|
I think the test failure is unrelated. The same test also fails for the current main branch: https://github.com/emacs-citar/citar/actions/runs/22580821553 |
It says long documentation lines? |
|
I clicked the explain thing on the failing commits, and copilot gave a plausible explanation, which it seems to have summarized below the commits. |
I fixed that in bfecaff, the test that is still failing on later commits is due to and I have no idea where that is coming from.
I don't see any explain thing! |
|
The root cause of the CI failure is the removal of the function citar--insert-bibtex, while references to it remain in the code. Specifically, in citar-export-local-bib-file, there is a call to (citar--insert-bibtex citekey), but only citar-insert-bibtex now exists. Solution: Update the implementation of citar-export-local-bib-file to use citar-insert-bibtex instead. Here is the corrected snippet: The file is titled "local-bib", given the same extension as |
Just copy-pasted it's output. Sorry for the formatting. |
|
No,
There are no references to (defun citar-export-local-bib-file ()
"Create a new bibliography file from citations in current buffer.
The file is titled \"local-bib\", given the same extension as
the first entry in `citar-bibliography', and created in the
`default-directory'."
(interactive)
(let* ((citekeys (citar--major-mode-function 'list-keys #'ignore))
(bib-files (citar--bibliography-files))
(ext (file-name-extension (or (car-safe citar-bibliography)
citar-bibliography)))
(file (expand-file-name (format "local-bib.%s" ext))))
(with-temp-file file
(citar-insert-bibtex citekeys bib-files))))As far as I can tell, the test failure is not related to the pr. I manually triggered the CI on current main and it shows this same error: https://github.com/emacs-citar/citar/actions/runs/22580821553 |
|
I wouldn't worry too much about tests failing on the snapshot version of Emacs. Those tests are meant as a heads-up of breaking changes in Emacs master we need to be aware of. But they do fail inexplicably sometimes, and that should only be treated as a blocker after Emacs master has been branched for the next release. |
|
I think we are facing this issue in |
|
This is a really great feature, I'm looking forward to it being merged! I have one request though: could you make the file name an optional argument to My use case is this: I have a global .bib file which contains thousands of .bib keys (exported automatically via Zotero), but when I'm writing papers with collaborators, it's convenient to have a smaller bib file local to that repository (so my collaborators can more easily edit it). But my collaborators usually expect the bib file to be named "references.bib". |
Maybe we shouldn't run the snapshot with warnings as errors? Either way, I agree it's not worth holding up merging. Though consider the suggestion from @havarddj? |
This makes sense. Hardcoded name is not ideal. Optional arg is straightforward so we should add that and I think interactively we can prompt with a prefix arg. Beyond that should the default be made customizable? I think that makes sense but I don't use this feature so not sure. But that seem to be the best fit with @havarddj's workflow. |
|
Hi, sorry for the delay. I think having a customizable variable would be very helpful for my use-case, perhaps something like |
|
@havarddj I pushed a new commit, please try that. |
|
@roshanshariff @bdarcus tests are now failing because Embark can't be installed since it has started requiring Emacs 29. What should we do about that? |
Maybe we should follow Embark (and Vertico)? The alternative is changing the CI. |
Hey @aikrahguzar! I couldn't quite get it working, it doesn't seem to export all the references in the document. The smallest working example I could make was to add a file \documentclass[11pt]{amsart}
\usepackage[
backend=bibtex,
style=alphabetic,
natbib=true,
url=false,
doi=true,
eprint=false,
backref=true
]{biblatex}
\addbibresource{test.bib}
\begin{document}
This is citation. \cite{downes-74}
This is another citation. \cite{mann-68}
\printbibliography
\end{document}This compiles correctly (at least on my machine). I loaded the local version of |
I can't reproduce this. I see both entries in the
Sorting, makes sense. |
|
Thanks, running |
|
Out of curiosity, is there a reason why |
Also sort the entries
e1f17b6 to
25c49bd
Compare
|
I have now made the failure to find an entry loud: a message will be emitted mentioning missing the entry along with the bib files that were searched. Am empty list of bibliographies will be an error. Sorting is also implemented now. |
|
Awesome, thank you very much! |
|
Hi, coming over from #885, where @aikrahguzar pointed to this PR due to some overlap. For context: #885 adds a configurable name for the file produced by My suggestion is to consider splitting scope:
The brace fix could merge cleanly without being held up on UX/API discussion, and the larger conversation moves to a smaller follow-up PR. If you'd rather keep everything together, happy to close #885 and move the pieces here as suggested changes. See this comment with some changes from #885 I'd like to see retained. |
|
@bigodel, how much work would it be to rebase #885 on top of this? I can merge this and then we can move to #885. The problem with this splitting this is that is also fixes the issues raised in #834 so it is really the title of the pr which is inaccurate. It has become a reworking of local bib export. |
I'm happy to rebase #885 on top of this once it merges. One small ask: if a release is being cut on the back of this PR, would you consider also folding in the suggested renames, If a release isn't imminent, no urgency, I'm happy carrying the rename in #885 once I rebase. Either way works. |
Closes #876
Also a performance improvement in the exporter: we insert the bibliographies into a buffer once instead of once for each citekey.