diff options
author | Kyle Meyer <kyle@kyleam.com> | 2015-02-19 23:00:11 -0500 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2015-02-19 23:00:11 -0500 |
commit | 6feb27d7ab06d00e5364d9b9854c641c9f0d7849 (patch) | |
tree | efe3e41f8b0afa3f3daca856aa112694d0a6b5c2 /bog.el | |
parent | 091ce7f02bae1acd0baf5e35ac2c7a70cffe06ac (diff) | |
download | bog-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.
Diffstat (limited to 'bog.el')
-rw-r--r-- | bog.el | 22 |
1 files changed, 12 insertions, 10 deletions
@@ -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. |