From 6feb27d7ab06d00e5364d9b9854c641c9f0d7849 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Thu, 19 Feb 2015 23:00:11 -0500 Subject: bog-{,non-}heading-citekeys-in-file: Set default-directory Set the default directory so that Org mode is able to read any setup files that are specified with a relative path. --- bog.el | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/bog.el b/bog.el index 37ba29a..5fd42dc 100644 --- a/bog.el +++ b/bog.el @@ -357,9 +357,10 @@ word constituents." (defun bog-heading-citekeys-in-file (file) "Return all citekeys in headings of FILE." (with-temp-buffer - (insert-file-contents file) - (org-mode) - (bog-heading-citekeys-in-buffer))) + (let ((default-directory (file-name-directory file))) + (insert-file-contents file) + (org-mode) + (bog-heading-citekeys-in-buffer)))) (defun bog-heading-citekeys-in-buffer () "Return all heading citekeys in current buffer." @@ -374,13 +375,14 @@ word constituents." (let (citekeys case-fold-search) (with-temp-buffer - (insert-file-contents file) - (org-mode) - (while (re-search-forward bog-citekey-format nil t) - (unless (or (org-at-heading-p) - (org-at-property-p)) - (push (match-string-no-properties 0) citekeys)))) - (delete-dups citekeys))) + (let ((default-directory (file-name-directory file))) + (insert-file-contents file) + (org-mode) + (while (re-search-forward bog-citekey-format nil t) + (unless (or (org-at-heading-p) + (org-at-property-p)) + (push (match-string-no-properties 0) citekeys)))) + (delete-dups citekeys)))) (defun bog-list-orphan-citekeys (&optional file) "List citekeys that appear in notes but don't have a heading. -- cgit v1.2.3