Re: [O] [babel, patch] ob-octave does not catch EOE from matlabShell on MS Windows

2012-05-30 Thread Mikhail Titov
 -Original Message-
 From: emacs-orgmode-bounces+mlt=gmx...@gnu.org [mailto:emacs-orgmode-
 bounces+mlt=gmx...@gnu.org] On Behalf Of Achim Gratz
 Sent: Monday, May 28, 2012 1:24 PM
 To: emacs-orgmode@gnu.org
 Subject: Re: [O] [babel, patch] ob-octave does not catch EOE from
matlabShell
 on MS Windows
 
 Eric Schulte writes:
  Thanks for sending along the patch and the variable re-definition.  If I
  understand correctly then the patch should be applied for any system,
  but the variable definition need only be applied on windows systems.  Is
  that correct?
 
 The variable re-definition seems to be be needed for matlab-shell, I
 don't know if that would be restricted to Windows.
 
  Can anyone confirm that matlab/octave code blocks are still functional
  on a GNU/Linux machine after the above patch and redefinition have been
  applied?  I do not use octave/matlab myself and can't verify this.
 
 The octave tests still pass on openSUSE with the patch applied along
 with all the other tests (except R, since I'm missing ESS).

I wonder how it still passes the test...

I think my patch unintentionally breaks octave. It probably should have been
just

 org-babel-octave-eoe-output

instead of

 (if matlabp
 org-babel-octave-eoe-output
   org-babel-octave-eoe-indicator) 

or other way around.

I apologize for bringing it all over to the list as I'm not proficient in
elisp yet.

I feel like ob-octave needs an overhaul in general as it does not respect
many header arguments like :width, :height, and graphics format (always
png). Also it would be nice if it removed extra prompts left in results as
does ob-R.el .

I'll post improved patch once I feel it is ready.

Eric, so for now, just hold on with the application of what I've sent.

Mikhail






Re: [O] [babel, patch] ob-octave does not catch EOE from matlabShell on MS Windows

2012-05-30 Thread Eric Schulte
Mikhail Titov m...@gmx.us writes:

 -Original Message-
 From: emacs-orgmode-bounces+mlt=gmx...@gnu.org [mailto:emacs-orgmode-
 bounces+mlt=gmx...@gnu.org] On Behalf Of Achim Gratz
 Sent: Monday, May 28, 2012 1:24 PM
 To: emacs-orgmode@gnu.org
 Subject: Re: [O] [babel, patch] ob-octave does not catch EOE from
 matlabShell
 on MS Windows
 
 Eric Schulte writes:
  Thanks for sending along the patch and the variable re-definition.  If I
  understand correctly then the patch should be applied for any system,
  but the variable definition need only be applied on windows systems.  Is
  that correct?
 
 The variable re-definition seems to be be needed for matlab-shell, I
 don't know if that would be restricted to Windows.
 
  Can anyone confirm that matlab/octave code blocks are still functional
  on a GNU/Linux machine after the above patch and redefinition have been
  applied?  I do not use octave/matlab myself and can't verify this.
 
 The octave tests still pass on openSUSE with the patch applied along
 with all the other tests (except R, since I'm missing ESS).

 I wonder how it still passes the test...

 I think my patch unintentionally breaks octave. It probably should have been
 just

org-babel-octave-eoe-output

 instead of

(if matlabp
org-babel-octave-eoe-output
  org-babel-octave-eoe-indicator) 

 or other way around.

 I apologize for bringing it all over to the list as I'm not proficient in
 elisp yet.

 I feel like ob-octave needs an overhaul in general as it does not respect
 many header arguments like :width, :height, and graphics format (always
 png). Also it would be nice if it removed extra prompts left in results as
 does ob-R.el .

 I'll post improved patch once I feel it is ready.

 Eric, so for now, just hold on with the application of what I've sent.


Will do,

Thanks for following up on this.  The original author of the Octave and
Matlab support for Org-mode code blocks (Dan Davison) is no longer
following the Org-mode mailing list, so it would be good to have a new
pair of eyes on this.  If you run into elisp questions I'm sure there
are many experts on this list who would be happy to help provide
answers.

Best,


 Mikhail




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



Re: [O] [babel, patch] ob-octave does not catch EOE from matlabShell on MS Windows

2012-05-30 Thread Achim Gratz
Mikhail Titov writes:
 The octave tests still pass on openSUSE with the patch applied along
 with all the other tests (except R, since I'm missing ESS).

 I wonder how it still passes the test...

If you know how it breaks and why the tests don't catch it, please add a
test that does...


Regards,
Achim.
-- 
+[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]+

SD adaptations for Waldorf Q V3.00R3 and Q+ V3.54R2:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada




Re: [O] [babel, patch] ob-octave does not catch EOE from matlabShell on MS Windows

2012-05-29 Thread Mikhail Titov
 -Original Message-
 From: Eric Schulte [mailto:eric.schu...@gmx.com]
 Sent: Monday, May 28, 2012 10:57 AM
 To: Mikhail Titov
 Cc: emacs-orgmode@gnu.org
 Subject: Re: [O] [babel, patch] ob-octave does not catch EOE from
matlabShell
 on MS Windows
 
 ...
 
  It looks like org-babel-octave-eoe-output and org-babel-octave-eoe-
 indicator
  were swapped around in org-babel-octave-evaluate-session .
 
  I have the following in dot emacs
 
  (setq org-babel-octave-eoe-output 
  ans =
 
  org_babel_eoe
 
  )
 
  For the sake of completeness I'm attaching the patch. Also one should
 override
 
  (setq org-babel-matlab-emacs-link-wrapper-method
 %s
  if ischar(ans), fid = fopen('%s', 'w'); fprintf(fid, '%%s\\n', ans);
 fclose(fid); else, save -ascii %s ans ; end
  delete('%s')
  )
 
  as matlabShell does not like commands split across multiple lines.
 
 
 Thanks for sending along the patch and the variable re-definition.

I was in the hurry and the second variable should have been 

(setq org-babel-octave-wrapper-method
  %s
if ischar(ans), fid = fopen('%s', 'w'); fprintf(fid, '%%s\\n', ans);
fclose(fid); else, dlmwrite('%s', ans, '\\t'); end)

and not org-babel-matlab-emacs-link-wrapper-method . The only difference
from what is already in there, is that it should be a single line (with ;
delimiters). It might be a limitation of matlabShell.

From what I understand EmacsLink is something outdated and not supported
anymore as there is matlab-emacs mode.

Also the patch was missing yet another change to use single quotes instead
of double quotes when making default figures invisible. I'm attaching the
patch I ended up using.

  If I
 understand correctly then the patch should be applied for any system,
 but the variable definition need only be applied on windows systems.  Is
 that correct?

Unfortunately I don't have Matlab installed on my home GNU/Linux computer,
I'll see if I'm eligible and can get one.

What bugs me though is that I can't use both octave and matlab as they use
same variable (org-babel-octave-eoe-output) which should be set to different
values. In org-babel-comint-with-output macro (ob-comint.el) it is used to
check if shell/REPL is done with evaluation and ready for input. I wonder if
it is possible to generalize org-babel-octave-eoe-output for both matlab and
octave as the only difference is the bunch of newlines in Matlab output. One
may write a regexp that matches both, however (regexp-quote
,eoe-indicator) in aforementioned macro confuses me. So it got to be a
plain string.

M.

 Can anyone confirm that matlab/octave code blocks are still functional
 on a GNU/Linux machine after the above patch and redefinition have been
 applied?  I do not use octave/matlab myself and can't verify this.
 
 If they don't break anything I'm happy to apply these patches.
 
 Thanks,
 
 --
 Eric Schulte
 http://cs.unm.edu/~eschulte


ob-octave_matlab_updated.patch
Description: Binary data


Re: [O] [babel, patch] ob-octave does not catch EOE from matlabShell on MS Windows

2012-05-28 Thread Eric Schulte
Mikhail Titov m...@gmx.us writes:

 -Original Message-
 From: emacs-orgmode-bounces+mlt=gmx...@gnu.org [mailto:emacs-orgmode-
 bounces+mlt=gmx...@gnu.org] On Behalf Of Mikhail Titov
 Sent: Friday, May 25, 2012 11:31 AM
 To: emacs-orgmode@gnu.org
 Subject: Re: [O] [babel] ob-octave does not catch EOE from matlabShell on MS
 Windows
 
   ...
  
   I have a simple test block like
  
   #+begin_src matlab :session *MATLAB*
   a=2
   #+end_src
  
   When I try to execute it with C-c C-c , emacs never returns unless I hit
 C-
  g.
   If I do M-x toggle-debug-on-quit RET I see that for some reason it keeps
   waiting for EOE.
 
 It looks like org-babel-octave-eoe-output and org-babel-octave-eoe-indicator
 were swapped around in org-babel-octave-evaluate-session .
 
 I have the following in dot emacs
 
 (setq org-babel-octave-eoe-output 
 ans =
 
 org_babel_eoe
 
 )

 For the sake of completeness I'm attaching the patch. Also one should override

 (setq org-babel-matlab-emacs-link-wrapper-method
%s
 if ischar(ans), fid = fopen('%s', 'w'); fprintf(fid, '%%s\\n', ans); 
 fclose(fid); else, save -ascii %s ans ; end
 delete('%s')
 )

 as matlabShell does not like commands split across multiple lines.

 M.



Hi Mikhail,

Thanks for sending along the patch and the variable re-definition.  If I
understand correctly then the patch should be applied for any system,
but the variable definition need only be applied on windows systems.  Is
that correct?

Can anyone confirm that matlab/octave code blocks are still functional
on a GNU/Linux machine after the above patch and redefinition have been
applied?  I do not use octave/matlab myself and can't verify this.

If they don't break anything I'm happy to apply these patches.

Thanks,

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



Re: [O] [babel, patch] ob-octave does not catch EOE from matlabShell on MS Windows

2012-05-28 Thread Achim Gratz
Eric Schulte writes:
 Thanks for sending along the patch and the variable re-definition.  If I
 understand correctly then the patch should be applied for any system,
 but the variable definition need only be applied on windows systems.  Is
 that correct?

The variable re-definition seems to be be needed for matlab-shell, I
don't know if that would be restricted to Windows.

 Can anyone confirm that matlab/octave code blocks are still functional
 on a GNU/Linux machine after the above patch and redefinition have been
 applied?  I do not use octave/matlab myself and can't verify this.

The octave tests still pass on openSUSE with the patch applied along
with all the other tests (except R, since I'm missing ESS).


Regards,
Achim.
-- 
+[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]+

Wavetables for the Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#BlofeldUserWavetables




Re: [O] [babel, patch] ob-octave does not catch EOE from matlabShell on MS Windows

2012-05-25 Thread Mikhail Titov
 -Original Message-
 From: emacs-orgmode-bounces+mlt=gmx...@gnu.org [mailto:emacs-orgmode-
 bounces+mlt=gmx...@gnu.org] On Behalf Of Mikhail Titov
 Sent: Friday, May 25, 2012 11:31 AM
 To: emacs-orgmode@gnu.org
 Subject: Re: [O] [babel] ob-octave does not catch EOE from matlabShell on MS
 Windows
 
   ...
  
   I have a simple test block like
  
   #+begin_src matlab :session *MATLAB*
   a=2
   #+end_src
  
   When I try to execute it with C-c C-c , emacs never returns unless I hit
 C-
  g.
   If I do M-x toggle-debug-on-quit RET I see that for some reason it keeps
   waiting for EOE.
 
 It looks like org-babel-octave-eoe-output and org-babel-octave-eoe-indicator
 were swapped around in org-babel-octave-evaluate-session .
 
 I have the following in dot emacs
 
 (setq org-babel-octave-eoe-output 
 ans =
 
 org_babel_eoe
 
 )

For the sake of completeness I'm attaching the patch. Also one should override

(setq org-babel-matlab-emacs-link-wrapper-method
   %s
if ischar(ans), fid = fopen('%s', 'w'); fprintf(fid, '%%s\\n', ans); 
fclose(fid); else, save -ascii %s ans ; end
delete('%s')
)

as matlabShell does not like commands split across multiple lines.

M.



ob-octave_matlab.patch
Description: Binary data