Skip to content

Added a pre-write hook. #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Added a pre-write hook. #13

wants to merge 2 commits into from

Conversation

asilata
Copy link

@asilata asilata commented Jul 4, 2019

Added a hook to be run on the buffer after retrieving the bibitem but before saving. This can be used (for example) with bibtool to reformat the entries in the new buffer before saving it to the file.

@pzorin
Copy link
Owner

pzorin commented Jul 20, 2019

Could you show an example hook (e.g. the one that you use)? I might then include it in the code (deactivated).

@asilata
Copy link
Author

asilata commented Sep 14, 2019

Here is how I use the hook. This way, whenever I fetch something using bibretrieve and then add it to a bib file, the file is automatically reorganised (sorted, keys rewritten etc) using bibtool and the bibtool rules file I use.

(add-hook
 'bibretrieve-pre-write-bib-items-hook
 (lambda ()
   (shell-command-on-region
    (point-min) (point-max)
    "bibtool -r ~/Bibliography/rules.rsc" t t "*Messages*")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants