emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [babel] Relative path for "dir" header argument
@ 2012-05-29  9:08 Hans-Peter Deifel
  2012-06-04 21:57 ` [PATCH] " Hans-Peter Deifel
  0 siblings, 1 reply; 4+ messages in thread
From: Hans-Peter Deifel @ 2012-05-29  9:08 UTC (permalink / raw)
  To: emacs-orgmode

Hi all,

Currently, the 'dir'-argument only understands absolute paths, because
it simply sets default-directory.

I think it would be quite useful to be able to specify paths relative to
the default-directory of the buffer. What do you think?

Thanks in advance,
Hans-Peter

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

* [PATCH] Re: [babel] Relative path for "dir" header argument
  2012-05-29  9:08 [babel] Relative path for "dir" header argument Hans-Peter Deifel
@ 2012-06-04 21:57 ` Hans-Peter Deifel
  2012-06-05  7:26   ` Forian Schmaus
  2012-06-05 14:53   ` Eric Schulte
  0 siblings, 2 replies; 4+ messages in thread
From: Hans-Peter Deifel @ 2012-06-04 21:57 UTC (permalink / raw)
  To: emacs-orgmode

On Di, Mai 29 2012, Hans-Peter Deifel wrote:
> Currently, the 'dir'-argument only understands absolute paths, because
> it simply sets default-directory.
>
> I think it would be quite useful to be able to specify paths relative to
> the default-directory of the buffer. What do you think?

I tried to implement exactly that by wrapping `dir' with
`expand-file-name'. So far, it works very well. Here is the patch:

---
 lisp/ob.el |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/lisp/ob.el b/lisp/ob.el
index d2d94b8..509bd41 100644
--- a/lisp/ob.el
+++ b/lisp/ob.el
@@ -524,7 +524,8 @@ block."
 			   (nth 1 info))))
 	     (dir (cdr (assoc :dir params)))
 	     (default-directory
-	       (or (and dir (file-name-as-directory dir)) default-directory))
+	       (or (and dir (file-name-as-directory (expand-file-name dir)))
+		   default-directory))
 	     (org-babel-call-process-region-original
 	      (if (boundp 'org-babel-call-process-region-original)
 		  org-babel-call-process-region-original
-- 
1.7.8.6

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

* Re: [PATCH] Re: [babel] Relative path for "dir" header argument
  2012-06-04 21:57 ` [PATCH] " Hans-Peter Deifel
@ 2012-06-05  7:26   ` Forian Schmaus
  2012-06-05 14:53   ` Eric Schulte
  1 sibling, 0 replies; 4+ messages in thread
From: Forian Schmaus @ 2012-06-05  7:26 UTC (permalink / raw)
  To: emacs-orgmode

Hans-Peter Deifel <hpdeifel <at> gmx.de> writes:

> 
> On Di, Mai 29 2012, Hans-Peter Deifel wrote:
> > Currently, the 'dir'-argument only understands absolute paths, because
> > it simply sets default-directory.
> >
> > I think it would be quite useful to be able to specify paths relative to
> > the default-directory of the buffer. What do you think?
> 
> I tried to implement exactly that by wrapping `dir' with
> `expand-file-name'. So far, it works very well. Here is the patch:

Thanks, that is exactly what I was looking for. Works like a charm here.

Florian

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

* Re: [PATCH] Re: [babel] Relative path for "dir" header argument
  2012-06-04 21:57 ` [PATCH] " Hans-Peter Deifel
  2012-06-05  7:26   ` Forian Schmaus
@ 2012-06-05 14:53   ` Eric Schulte
  1 sibling, 0 replies; 4+ messages in thread
From: Eric Schulte @ 2012-06-05 14:53 UTC (permalink / raw)
  To: Hans-Peter Deifel; +Cc: emacs-orgmode

Hans-Peter Deifel <hpdeifel@gmx.de> writes:

> On Di, Mai 29 2012, Hans-Peter Deifel wrote:
>> Currently, the 'dir'-argument only understands absolute paths, because
>> it simply sets default-directory.
>>
>> I think it would be quite useful to be able to specify paths relative to
>> the default-directory of the buffer. What do you think?
>
> I tried to implement exactly that by wrapping `dir' with
> `expand-file-name'. So far, it works very well. Here is the patch:
>
> ---
>  lisp/ob.el |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/lisp/ob.el b/lisp/ob.el
> index d2d94b8..509bd41 100644
> --- a/lisp/ob.el
> +++ b/lisp/ob.el
> @@ -524,7 +524,8 @@ block."
>  			   (nth 1 info))))
>  	     (dir (cdr (assoc :dir params)))
>  	     (default-directory
> -	       (or (and dir (file-name-as-directory dir)) default-directory))
> +	       (or (and dir (file-name-as-directory (expand-file-name dir)))
> +		   default-directory))
>  	     (org-babel-call-process-region-original
>  	      (if (boundp 'org-babel-call-process-region-original)
>  		  org-babel-call-process-region-original

Thanks for this patch, I've just applied it.

-- 
Eric Schulte
http://cs.unm.edu/~eschulte

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

end of thread, other threads:[~2012-06-05 14:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-29  9:08 [babel] Relative path for "dir" header argument Hans-Peter Deifel
2012-06-04 21:57 ` [PATCH] " Hans-Peter Deifel
2012-06-05  7:26   ` Forian Schmaus
2012-06-05 14:53   ` Eric Schulte

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).