summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bog-tests.el10
-rw-r--r--bog.el6
2 files changed, 13 insertions, 3 deletions
diff --git a/bog-tests.el b/bog-tests.el
index b6d8ef0..6f64593 100644
--- a/bog-tests.el
+++ b/bog-tests.el
@@ -139,6 +139,16 @@
(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)))))
+
;;; BibTeX functions
diff --git a/bog.el b/bog.el
index 5441fd8..0c6befd 100644
--- a/bog.el
+++ b/bog.el
@@ -162,9 +162,9 @@ from the text under point if it matches `bog-citekey-format' or
using `bog-citekey-func'.
ACTION will be called with the resulting citekey as an argument."
- (let* ((citekey (and ask-citekey (funcall ask-func)))
- (citekey (or (bog-citekey-at-point)
- (funcall bog-citekey-func))))
+ (let ((citekey (or (and ask-citekey (funcall ask-func))
+ (bog-citekey-at-point)
+ (funcall bog-citekey-func))))
(funcall action citekey)))
(defun bog-select-citekey (citekeys)