From ecf7cb67ae95cbd5031ecea6600395453dda3621 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sat, 13 Dec 2014 22:21:31 -0500 Subject: Extend goto functions to support citekey properties bog-goto-citekey-heading-in-buffer gives preference to citekeys as heading titles over citekeys as properties. The order of preference for bog-goto-citekey-heading-in-notes is the citekey as a heading title in the current buffer, the citekey as a property in the current buffer, the citekey as heading title in notes, and, finally, the citekey as property in notes. --- bog-tests.el | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'bog-tests.el') diff --git a/bog-tests.el b/bog-tests.el index 0532fc9..3fefc0b 100644 --- a/bog-tests.el +++ b/bog-tests.el @@ -328,6 +328,34 @@ other2000key " (bog-previous-non-heading-citekey 2) (should (equal citekey (bog-citekey-at-point)))))) +;; `bog--find-citekey-heading-in-buffer' + +(ert-deftest bog--find-citekey-heading-in-buffer-citekey-heading () + (let ((citekey "name2010word")) + (bog-tests--with-temp-text + " + +* other heading + +* " + (goto-char (bog--find-citekey-heading-in-buffer citekey)) + (should (equal citekey (org-get-heading t t)))))) + +(ert-deftest bog--find-citekey-heading-in-buffer-citekey-property () + (let ((citekey "name2010word")) + (bog-tests--with-temp-text + (format " + +* other heading + +* heading + :PROPERTIES: + :%s: + :END" + bog-citekey-property) + (goto-char (bog--find-citekey-heading-in-buffer citekey)) + (should (equal "heading" (org-get-heading t t)))))) + ;;; File functions -- cgit v1.2.3