emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] fix SETUPFILE pathname expansion with subdirectories
@ 2015-09-19  0:22 Richard Hansen
  2015-09-19  8:16 ` Nicolas Goaziou
  0 siblings, 1 reply; 15+ messages in thread
From: Richard Hansen @ 2015-09-19  0:22 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Richard Hansen

* 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

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2015-09-25 11:56 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-19  0:22 [PATCH] fix SETUPFILE pathname expansion with subdirectories Richard Hansen
2015-09-19  8:16 ` Nicolas Goaziou
2015-09-19 20:18   ` Richard Hansen
2015-09-19 22:07   ` [PATCH v2] " Richard Hansen
2015-09-19 22:43     ` Kyle Meyer
2015-09-19 23:14       ` Richard Hansen
2015-09-20  5:07         ` Kyle Meyer
2015-09-20  5:28           ` [PATCH v3] " Richard Hansen
2015-09-22 22:28             ` Richard Hansen
2015-09-24  8:22               ` Nicolas Goaziou
2015-09-24 21:55                 ` Richard Hansen
2015-09-24 22:20                   ` [PATCH 1/2] test INCLUDE " Richard Hansen
2015-09-24 22:20                     ` [PATCH 2/2] fix SETUPFILE pathname expansion from within an INCLUDE Richard Hansen
2015-09-25 11:58                       ` Nicolas Goaziou
2015-09-25 11:51                   ` [PATCH v3] fix SETUPFILE pathname expansion with subdirectories Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).