emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] [PATCH] fix SETUPFILE pathname expansion with subdirectories


From: Richard Hansen
Subject: [O] [PATCH] fix SETUPFILE pathname expansion with subdirectories
Date: Fri, 18 Sep 2015 20:22:01 -0400

* 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): 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
---
 lisp/org.el | 1 +
 lisp/ox.el  | 1 +
 2 files changed, 2 insertions(+)

diff --git a/lisp/org.el b/lisp/org.el
index 74fe4ae..ded3e13 100755
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5194,6 +5194,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
+                      (cd (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 bfdfeba..07e5ef3 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -1455,6 +1455,7 @@ Assume buffer is in Org mode.  Narrowing, if any, is 
ignored."
                         ;; Avoid circular dependencies.
                         (unless (member file files)
                           (with-temp-buffer
+                            (cd (file-name-directory file))
                             (insert (org-file-contents file 'noerror))
                             (let ((org-inhibit-startup t)) (org-mode))
                             (setq plist (funcall get-options
-- 
2.5.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]