summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2015-02-09 22:34:54 -0500
committerKyle Meyer <kyle@kyleam.com>2015-02-09 22:34:54 -0500
commitc49d398dd64638944db9dd5e54e41918f7485159 (patch)
tree2b905296644dc0c232fde50ddb735a229c4452a7
parent9c7b5d1c93f1634b82ed5e8ecfb50dd6b16e2247 (diff)
downloadbog-c49d398dd64638944db9dd5e54e41918f7485159.tar.gz
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.
-rw-r--r--bog.el12
1 files 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.