Hi Vikas and all, Vikas Rawal writes: >> I manage my whole bibtex database on org. It makes my workflow more >> integrated. It allows me to keep bib info, todo states and notes all >> in the same place, and it allows me to access it all through the >> agenda. I just periodically run org-bibtex to make sure that I have a >> updated bib file. > > This is exactly what I have in mind. Would you mind sharing an example > file, and may be an outline of your work flow? I also manage my whole bibtex database in Org. Here is my setup: 1) I store new readings as I come across them using a capture template. (See the attached "reading.txt".) This template is pretty basic, but I think it could easily be adapted to store more data, such as links to PDFs, or automatically import Bibtex entries (over org-protocol?) using a function from org-bibtex. The relevant stanza from my org-capture-templates is: #+BEGIN_SRC elisp ("dr" "Reading" entry (file+olp ,dissertation-agenda-file "Reading list") (file ,(concat org-template-directory "/reading.txt")) :prepend t) #+END_SRC 2) I use a post-capture hook to detect whether a captured entry is a reading (it looks for the AUTHOR property) and optionally add bibliographic data using org-bibtex-create-in-current-entry: #+BEGIN_SRC elisp (defun add-bibliographic-data () ; this is a bit hacky: we detect the AUTHOR property, and create bibtex entries if ; it is present (message "optionally adding bibliographic data") (if (and (org-entry-get (point) "AUTHOR") (y-or-n-p "Add bibliographic data? ")) ; with prefix arg to get all fields: (org-bibtex-create-in-current-entry 1) nil)) (add-hook 'org-capture-before-finalize-hook (lambda () (add-bibliographic-data))) #+END_SRC This completes the `front-end' portion of my setup, which gets data on new readings into Org. The `back-end' setup, which exports the captured entries to a .bib file, involves a Makefile that calls wrappers around org-bibtex functions. 3) All the wrapper functions do is walk over the Org tree containing my reading list, using org-map-entries, and export each entry with a defined CUSTOM_ID value using org-bibtex-headline to a new buffer. (It skips those with no CUSTOM_ID, since these won't produce valid bibtex entries.) This buffer then gets saved as the new .bib file. The code is in bib-export.el, attached. Note that this code makes some assumptions about my setup (mostly that all reading entries are stored under a top-level "Reading list" heading in a certain Org file); it is not suitable for general use without some adaptation. You can call the wrapper functions from within Emacs using M-x reading-list-to-bibtex. 4) I also call the wrapper functions from a Makefile. This allows me to get a fresh copy of my .bib file whenever it's needed, just by typing `make bib'. Here's the relevant stanza from the Makefile, which lives in the same directory as the file containing my reading list (tasks.org): #+BEGIN_SRC make EMACS=emacs BATCH_EMACS=$(EMACS) --batch -Q --load lib/el/org-dissertation.el build/dissertation.bib: tasks.org lib/el/bib-export.el $(BATCH_EMACS) --load lib/el/bib-export.el --file tasks.org \ --funcall reading-list-to-bibtex bib: build/dissertation.bib #+END_SRC That's it! Hope you find that useful. Best, Richard