diff options
author | Eric Schulte <schulte.eric@gmail.com> | 2011-04-28 10:02:33 -0600 |
---|---|---|
committer | Eric Schulte <schulte.eric@gmail.com> | 2011-04-28 10:02:33 -0600 |
commit | d689755ca5d046a1d2aa3e7e5436d8767f036b41 (patch) | |
tree | 1aafe5375877a8617e221c01ee519eb65e92e3cd | |
parent | daef7d8631e3c6c6fbf0dfc2aa89e31d4640467b (diff) | |
download | org-mode-d689755ca5d046a1d2aa3e7e5436d8767f036b41.tar.gz |
org-bibtex: prompts for file name when writing to .bib file
Thanks to Tom Dye for this suggestion
* lisp/org-bibtex.el (org-bibtex): Now prompts for a file name.
-rw-r--r-- | lisp/org-bibtex.el | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lisp/org-bibtex.el b/lisp/org-bibtex.el index 04baadb..9d114b0 100644 --- a/lisp/org-bibtex.el +++ b/lisp/org-bibtex.el @@ -441,12 +441,16 @@ With optional argument OPTIONAL, also prompt for optional fields." ;;; Bibtex <-> Org-mode headline translation functions -(defun org-bibtex () +(defun org-bibtex (&optional filename) "Export each headline in the current file to a bibtex entry. Headlines are exported using `org-bibtex-export-headline'." - (interactive) + (interactive + (list (read-file-name + "Bibtex file: " nil nil nil + (file-name-nondirectory + (concat (file-name-sans-extension (buffer-file-name)) ".bib"))))) (let ((bibtex-entries (remove nil (org-map-entries #'org-bibtex-headline)))) - (with-temp-file (concat (file-name-sans-extension (buffer-file-name)) ".bib") + (with-temp-file filename (insert (mapconcat #'identity bibtex-entries "\n"))))) (defun org-bibtex-check (&optional optional) |