summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2015-02-19 23:00:11 -0500
committerKyle Meyer <kyle@kyleam.com>2015-02-19 23:00:11 -0500
commit6feb27d7ab06d00e5364d9b9854c641c9f0d7849 (patch)
treeefe3e41f8b0afa3f3daca856aa112694d0a6b5c2
parent091ce7f02bae1acd0baf5e35ac2c7a70cffe06ac (diff)
downloadbog-6feb27d7ab06d00e5364d9b9854c641c9f0d7849.tar.gz
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.
-rw-r--r--bog.el22
1 files 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.