From 9f58e9ba0d43f7bda3c07a493b1f5f4d146976e3 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sat, 15 Feb 2014 15:04:49 -0500 Subject: ENH: Remove bog-citekey-action `bog-citekey-action' generalizes the common setup (citekey selection from notes or from user completion) of the citekey functions, but it doesn't allow much flexibility for functions to handle citekey selection differently. Replacing this with `bog-citekey-from-notes' shares the citekey selection from notes but doesn't couple this to the user selection. --- bog-tests.el | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) (limited to 'bog-tests.el') diff --git a/bog-tests.el b/bog-tests.el index 6f64593..48da709 100644 --- a/bog-tests.el +++ b/bog-tests.el @@ -110,44 +110,32 @@ ;; `bog-citekey-action' -(ert-deftest bog-citekey-action-on-heading () - (let ((citekey "name2010word") - (action '(lambda (ck) ck))) +(ert-deftest bog-citekey-from-notes-on-heading () + (let ((citekey "name2010word")) (with-temp-buffer (insert (format "\n* top level\n\n** %s\n\nsome text\n" citekey)) (org-mode) (show-all) (re-search-backward bog-citekey-format) - (should (equal (bog-citekey-action action nil nil) citekey))))) + (should (equal (bog-citekey-from-notes) citekey))))) -(ert-deftest bog-citekey-action-on-in-text-citekey () - (let ((citekey "name2010word") - (action '(lambda (ck) ck))) +(ert-deftest bog-citekey-from-notes-on-in-text-citekey () + (let ((citekey "name2010word")) (with-temp-buffer (insert (format "\n* top level\n\n** other2000key\n\nsome text and %s\n" citekey)) (org-mode) (show-all) (re-search-backward bog-citekey-format) - (should (equal (bog-citekey-action action nil nil) citekey))))) + (should (equal (bog-citekey-from-notes) citekey))))) -(ert-deftest bog-citekey-action-no-citekey () +(ert-deftest bog-citekey-from-notes-no-citekey () (with-temp-buffer (insert "\n* top level\n\n** second\n\n") (org-mode) (show-all) - (should-error (bog-citekey-action nil nil nil)))) - -(ert-deftest bog-citekey-action-askfunc () - (let* ((citekey "name2010word") - (ask-func '(lambda () citekey)) - (action '(lambda (ck) ck))) - (with-temp-buffer - (insert "\n* top level\n\n** second\n\n") - (org-mode) - (show-all) - (should (equal (bog-citekey-action action ask-func t) citekey))))) + (should-error (bog-citekey-from-notes)))) ;;; BibTeX functions -- cgit v1.2.3