From mboxrd@z Thu Jan  1 00:00:00 1970
From: Eric Schulte <eric.schulte@gmx.com>
Subject: Re: [babel] session initialization (was RE:	python/babel	inline
 images)
Date: Thu, 07 Jun 2012 16:44:20 -0600
Message-ID: <87txymn3fb.fsf@gmx.com>
References: <87pq9egifm.fsf@bye.fritz.box> <874nqp9580.fsf@gmx.com>
	<007401cd437f$ab542b20$01fc8160$@us> <878vg0bbwm.fsf@gmx.com>
	<000001cd440b$8d20abb0$a7620310$@us> <87ehpsqn5v.fsf@gmx.com>
	<002601cd441c$685c60b0$39152210$@us>
	<004301cd4438$f5e90980$e1bb1c80$@us>
	<001801cd44fd$7323e7c0$596bb740$@us>
Mime-Version: 1.0
Content-Type: text/plain
Return-path: <emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org>
Received: from eggs.gnu.org ([208.118.235.92]:42374)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eric.schulte@gmx.com>) id 1SclWR-00005R-SB
	for emacs-orgmode@gnu.org; Thu, 07 Jun 2012 18:49:45 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <eric.schulte@gmx.com>) id 1SclWP-0002c0-VV
	for emacs-orgmode@gnu.org; Thu, 07 Jun 2012 18:49:43 -0400
Received: from mailout-us.gmx.com ([74.208.5.67]:53362)
	by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <eric.schulte@gmx.com>) id 1SclWP-0002ag-Nt
	for emacs-orgmode@gnu.org; Thu, 07 Jun 2012 18:49:41 -0400
List-Id: "General discussions about Org-mode." <emacs-orgmode.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-orgmode>,
	<mailto:emacs-orgmode-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/emacs-orgmode>
List-Post: <mailto:emacs-orgmode@gnu.org>
List-Help: <mailto:emacs-orgmode-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-orgmode>,
	<mailto:emacs-orgmode-request@gnu.org?subject=subscribe>
Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org
Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org
To: Mikhail Titov <mlt@gmx.us>
Cc: emacs-orgmode@gnu.org, 'Eric Schulte' <eric.schulte@gmx.com>

"Mikhail Titov" <mlt@gmx.us> writes:

>> -----Original Message-----
>> From: emacs-orgmode-bounces+mlt=gmx.us@gnu.org [mailto:emacs-orgmode-
>> bounces+mlt=gmx.us@gnu.org] On Behalf Of Mikhail Titov
>> Sent: Wednesday, June 06, 2012 6:06 PM
>> To: 'Eric Schulte'
>> Cc: emacs-orgmode@gnu.org
>> Subject: Re: [O] [babel] session initialization (was RE: python/babel
> inline
>> images)
>> 
>> ...
>> 
>> How would I reliably refer to the org doc buffer from where everything was
>> called? The following works just fine in session initialization code for
>> Matlab but not for Octave
>> 
>> (file-name-directory (buffer-file-name (other-buffer)))
>> 
>> At this point, (current-buffer) refers to the one with inferior process.
>
> So I ended up using the following in session initialization for inferior
> process to get a current folder of a document from where calculations
> initiated
>
> (file-name-directory
>    (car (delq nil (mapcar #'buffer-file-name (buffer-list)))))
>
> It works. But I have a feeling that it is not a reliable method. Any
> suggestions?
>

I would recommend using the `default-directory' variable.  That should
hold the value of the directory of the Org-mode file or the value of the
:dir header argument if present.

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