From mboxrd@z Thu Jan  1 00:00:00 1970
From: "Mikhail Titov" <mlt@gmx.us>
Subject: Re: [babel] session initialization (was RE: python/babel	inline
 images)
Date: Wed, 6 Jun 2012 18:06:08 -0500
Message-ID: <004301cd4438$f5e90980$e1bb1c80$@us>
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>
Mime-Version: 1.0
Content-Type: text/plain;
	charset="koi8-r"
Content-Transfer-Encoding: 7bit
Return-path: <emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org>
Received: from eggs.gnu.org ([208.118.235.92]:57390)
	by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <mlt@gmx.us>)
	id 1ScPIf-0000dE-2X
	for emacs-orgmode@gnu.org; Wed, 06 Jun 2012 19:06:02 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <mlt@gmx.us>) id 1ScPId-0003Pf-7Z
	for emacs-orgmode@gnu.org; Wed, 06 Jun 2012 19:06:00 -0400
Received: from mailout-us.gmx.com ([74.208.5.67]:59803)
	by eggs.gnu.org with smtp (Exim 4.71) (envelope-from <mlt@gmx.us>)
	id 1ScPId-0003PS-23
	for emacs-orgmode@gnu.org; Wed, 06 Jun 2012 19:05:59 -0400
In-Reply-To: <002601cd441c$685c60b0$39152210$@us>
Content-Language: en-us
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: 'Eric Schulte' <eric.schulte@gmx.com>
Cc: emacs-orgmode@gnu.org

> -----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 2:42 PM
> To: 'Eric Schulte'
> Cc: emacs-orgmode@gnu.org
> Subject: Re: [O] [babel] session initialization (was RE: python/babel
inline
> images)
> 
> > -----Original Message-----
> > From: emacs-orgmode-bounces+mlt=gmx.us@gnu.org [mailto:emacs-orgmode-
> > bounces+mlt=gmx.us@gnu.org] On Behalf Of Eric Schulte
> > Sent: Wednesday, June 06, 2012 2:02 PM
> > To: Mikhail Titov
> > Cc: emacs-orgmode@gnu.org; 'henry atting'; 'Eric Schulte'
> > Subject: Re: [O] [babel] session initialization (was RE: python/babel
> inline
> > images)
> >
> > > Right now I have something like the following in that function
> > >
> > > 	  (comint-send-string
> > > 	   (get-buffer-process (current-buffer))
> > > 	  		       "set(0, 'defaultfigurevisible', 'off');\n")
> > >
> > > I do it there as it does not make sense to call for each block. I was
> about
> > > to write that ob-R does show stuff but I believe it was in earlier
> versions
> > > of ob-R.el or something as I've checked and indeed nothing appears on
> screen
> > > as code being wrapped in a device output block.
> > >
> >
> > I'm not aware of a way to run code on the start of a session.  I do see
> > how this could be a useful addition.
> 
> So the fragment above does look legitimate to you? I just add
> 
> (format "cd('%s');\n" (file-name-directory (buffer-file-name)))
> 
> and problem solved? Well... for sessions. I don't know if it is common to
> use non-session based calculations...

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.

M.