From c49d398dd64638944db9dd5e54e41918f7485159 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Mon, 9 Feb 2015 22:34:54 -0500 Subject: bog--find-citekey-heading-in-notes: Use base buffer Use base buffer so that bog--find-citekey-heading-in-notes still tries to find a heading in the current note file first, regardless of whether the buffer is an indirect buffer for the note file. --- bog.el | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/bog.el b/bog.el index 944d9b0..3034356 100644 --- a/bog.el +++ b/bog.el @@ -800,10 +800,14 @@ buffer, the narrowing is removed." CITEKEY can either be the heading title or the property value of 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)))) + (let* ((base-buf (buffer-base-buffer)) + (buf (or base-buf (current-buffer))) + (buf-file (buffer-file-name buf))) + (or (and (member buf-file (bog-notes)) + (with-current-buffer buf + (bog--find-citekey-heading-in-buffer citekey))) + (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