summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hansen <rhansen@bbn.com>2015-09-20 01:28:53 -0400
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2015-09-24 10:16:04 +0200
commit11bba63dc32efb2a74beeab2e0bf8f3c3e1bc460 (patch)
treea120046b0be129da17789618c316a398b14ec122
parent2e1b93db418e0ab2b0f481543187960e0d3f92ce (diff)
downloadorg-mode-11bba63dc32efb2a74beeab2e0bf8f3c3e1bc460.tar.gz
fix SETUPFILE pathname expansion with subdirectories
* lisp/org-macro.el (org-macro--collect-macros): cd to the directory containing the SETUPFILE before recursing so that relative pathnames in the SETUPFILE are expanded properly. * lisp/org.el (org--setup-collect-keywords): cd to the directory containing the SETUPFILE before recursing so that relative pathnames in the SETUPFILE are expanded properly. * lisp/ox.el (org-export--get-inbuffer-options, org-export--list-bound-variables): cd to the directory containing the SETUPFILE before recursing so that relative pathnames in the SETUPFILE are expanded properly. If /path/to/foo.org contains: #+SETUPFILE: settings/beamer.org and /path/to/settings/beamer.org contains: #+SETUPFILE: common.org then we want to read /path/to/settings/common.org, not /path/to/common.org. TINYCHANGE
-rw-r--r--lisp/org-macro.el2
-rwxr-xr-xlisp/org.el1
-rw-r--r--lisp/ox.el4
-rw-r--r--testing/examples/setupfile.org7
-rw-r--r--testing/examples/setupfile3.org6
-rw-r--r--testing/examples/subdir/setupfile2.org1
6 files changed, 15 insertions, 6 deletions
diff --git a/lisp/org-macro.el b/lisp/org-macro.el
index 65795f6..e808972 100644
--- a/lisp/org-macro.el
+++ b/lisp/org-macro.el
@@ -106,6 +106,8 @@ Return an alist containing all macro templates found."
(org-remove-double-quotes val))))
(unless (member file files)
(with-temp-buffer
+ (setq default-directory
+ (file-name-directory file))
(org-mode)
(insert (org-file-contents file 'noerror))
(setq templates
diff --git a/lisp/org.el b/lisp/org.el
index b1ce578..ea6c955 100755
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5208,6 +5208,7 @@ Return value contains the following keys: `archive', `category',
(org-remove-double-quotes value)))))
(when (and f (file-readable-p f) (not (member f files)))
(with-temp-buffer
+ (setq default-directory (file-name-directory f))
(insert-file-contents f)
(setq alist
;; Fake Org mode to benefit from cache
diff --git a/lisp/ox.el b/lisp/ox.el
index c4c09b9..0adbdf2 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -1455,6 +1455,8 @@ Assume buffer is in Org mode. Narrowing, if any, is ignored."
;; Avoid circular dependencies.
(unless (member file files)
(with-temp-buffer
+ (setq default-directory
+ (file-name-directory file))
(insert (org-file-contents file 'noerror))
(let ((org-inhibit-startup t)) (org-mode))
(setq plist (funcall get-options
@@ -1586,6 +1588,8 @@ an alist where associations are (VARIABLE-NAME VALUE)."
(org-remove-double-quotes val))))
(unless (member file files)
(with-temp-buffer
+ (setq default-directory
+ (file-name-directory file))
(let ((org-inhibit-startup t)) (org-mode))
(insert (org-file-contents file 'noerror))
(setq alist
diff --git a/testing/examples/setupfile.org b/testing/examples/setupfile.org
index a85dbc0..71acfca 100644
--- a/testing/examples/setupfile.org
+++ b/testing/examples/setupfile.org
@@ -1,6 +1 @@
-#+BIND: variable value
-#+DESCRIPTION: l2
-#+LANGUAGE: en
-#+SELECT_TAGS: b
-#+TITLE: b
-#+PROPERTY: a 1
+#+SETUPFILE: subdir/setupfile2.org
diff --git a/testing/examples/setupfile3.org b/testing/examples/setupfile3.org
new file mode 100644
index 0000000..a85dbc0
--- /dev/null
+++ b/testing/examples/setupfile3.org
@@ -0,0 +1,6 @@
+#+BIND: variable value
+#+DESCRIPTION: l2
+#+LANGUAGE: en
+#+SELECT_TAGS: b
+#+TITLE: b
+#+PROPERTY: a 1
diff --git a/testing/examples/subdir/setupfile2.org b/testing/examples/subdir/setupfile2.org
new file mode 100644
index 0000000..31586fa
--- /dev/null
+++ b/testing/examples/subdir/setupfile2.org
@@ -0,0 +1 @@
+#+SETUPFILE: ../setupfile3.org