Skip to content

Commit dc7018e

Browse files
arifer612bdarcus
authored andcommitted
feat: citar--insert-bibtex to omit fields in citar-bibtex-no-export-fields
This commit extends the `citar--insert-bibtex' function to omit bibtex fields that were declared in `citar-bibtex-no-export-fields' in the bibtex entry that is to be exported/inserted. This mirrors what is done by `bibtex-completion-insert-bibtex' when the `bibtex-completion-no-export-fields' variable is non-nil.
1 parent ef3fdc0 commit dc7018e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

citar.el

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1681,6 +1681,12 @@ including the citekeys, is maintained in Zotero with Better BibTeX."
16811681
(dolist (bib-file bibtex-files)
16821682
(insert-file-contents bib-file))
16831683
(bibtex-search-entry citekey)
1684+
(dolist (field citar-bibtex-no-export-fields)
1685+
(let ((position (bibtex-search-forward-field
1686+
field t)))
1687+
(when position
1688+
(delete-region (caar position)
1689+
(car (last position))))))
16841690
(let ((beg (bibtex-beginning-of-entry))
16851691
(end (bibtex-end-of-entry)))
16861692
(buffer-substring-no-properties beg end)))))

0 commit comments

Comments
 (0)