diff options
author | Kyle Meyer <kyle@kyleam.com> | 2014-02-07 01:23:35 -0500 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2014-02-07 01:25:11 -0500 |
commit | dc7806b748effca4ea57a165df0fff33b1f83ef3 (patch) | |
tree | cc801c5b50652e93941e3c160ac57f2926b86be5 /bog.el | |
parent | f4b7bea779a3a4ea1e07d5d98c917a6c79f7a1ea (diff) | |
download | bog-dc7806b748effca4ea57a165df0fff33b1f83ef3.tar.gz |
ENH: Make compatible with single BibTeX file
Diffstat (limited to 'bog.el')
-rw-r--r-- | bog.el | 32 |
1 files changed, 29 insertions, 3 deletions
@@ -88,9 +88,29 @@ rename." :group 'bog :type 'string) +(defcustom bog-find-citekey-bib-func 'bog-find-citekey-bib-file + "Function used to find BibTeX entry for citekey. + +Default is `bog-find-citekey-bib-file' that locates single entry +BibTeX files in `bog-bib-directory'. + +The other option is `bog-find-citekey-entry' that searches within +a single BibTeX file, `bog-bib-file', for the citekey entry." + :group 'bog + :type 'function) + (defcustom bog-bib-directory (expand-file-name "bibs" bog-notes-directory) - "The name of the directory that BibTeX files are stored in." + "The name of the directory that BibTeX files are stored in. +This is only meaningful if `bog-find-citekey-bib-func' set to +`bog-find-citekey-bib-file'." + :group 'bog + :type 'string) + +(defcustom bog-bib-file nil + "BibTeX file name. +This is only meaningful if `bog-find-citekey-bib-func' set to +`bog-find-citekey-entry'." :group 'bog :type 'string) @@ -273,16 +293,22 @@ available citekeys. Otherwise, the citekey will be taken from the text under point if it matches `bog-citekey-format' or using `bog-citekey-func'." (interactive "P") - (bog-citekey-action 'bog-open-citekey-bib + (bog-citekey-action bog-find-citekey-bib-func '(lambda () (bog-select-citekey (bog-bib-citekeys))) arg)) -(defun bog-open-citekey-bib (citekey) +(defun bog-find-citekey-bib-file (citekey) + "Open BibTeX file of CITEKEY contained in `bog-bib-directory'." (let ((bib-file (bog-citekey-as-bib citekey))) (unless (file-exists-p bib-file) (error "%s does not exist" bib-file)) (find-file-other-window bib-file))) +(defun bog-find-citekey-entry (citekey) + "Search for CITEKEY in `bog-bib-file'." + (find-file-other-window bog-bib-file) + (bibtex-search-entry citekey)) + ;;;###autoload (defun bog-rename-and-clean-new-bib-files () "Prepare new BibTeX files. |