From 6d1a763fea9b835a94c839bd6b7dd5a905ea9579 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sat, 31 Jan 2015 23:35:05 -0500 Subject: Search current file first for citekey heading Move current file check from bog-goto-citekey-heading-in-notes to bog--find-citekey-heading-in-notes so that other functions that use bog--find-citekey-heading-in-notes (e.g., bog-citekey-tree-to-indirect-buffer) have the same behavior. --- bog.el | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/bog.el b/bog.el index e98b855..07ec163 100644 --- a/bog.el +++ b/bog.el @@ -784,9 +784,7 @@ If the heading is found outside any current narrowing of the buffer, the narrowing is removed." (interactive "P") (let* ((citekey (bog-citekey-from-point-or-all-headings no-context)) - (marker (or (and (member (buffer-file-name) (bog-notes)) - (bog--find-citekey-heading-in-buffer citekey)) - (bog--find-citekey-heading-in-notes citekey)))) + (marker (bog--find-citekey-heading-in-notes citekey))) (if marker (progn (pop-to-buffer (marker-buffer marker)) @@ -800,9 +798,12 @@ buffer, the narrowing is removed." (defun bog--find-citekey-heading-in-notes (citekey) "Return the marker of heading for CITEKEY in notes. CITEKEY can either be the heading title or the property value of -the key `bog-citekey-property'." - (or (org-find-exact-heading-in-directory citekey bog-note-directory) - (bog--find-citekey-property-in-notes citekey))) +the key `bog-citekey-property'. When in a note file, search for +headings there first." + (or (and (member (buffer-file-name) (bog-notes)) + (bog--find-citekey-heading-in-buffer citekey)) + (or (org-find-exact-heading-in-directory citekey bog-note-directory) + (bog--find-citekey-property-in-notes citekey)))) (defun bog--find-citekey-property-in-notes (citekey) "Return marker within notes for heading with CITEKEY as a property value. -- cgit v1.2.3