Re: [O] [babel] 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: Thursday, May 24, 2012 4:31 PM
 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

)

M.

 
  ...
 
  Here is what I see in *MATLAB* buffer:
 
  8-*MATLAB*--8-
   a=2
  if ischar(ans), fid = fopen('c:/DOCUME~1/user/LOCALS~1/Temp/babel-
  7560HUp/matlab-7560PPd', 'w'); fprintf(fid, '%s\n', ans); fclose(fid); else,
  dlmwrite('c:/DOCUME~1/user/LOCALS~1/Temp/babel-7560HUp/matlab-7560PPd', ans,
  '\t'); end
  'org_babel_eoe'
 
  a =
 
   2
 
   
  ans =
 
  org_babel_eoe
 
  
  8-*MATLAB*--8-
 
 I feel like it is about
 
 (defvar org-babel-octave-eoe-output ans = org_babel_eoe)
 
 as Matlab's return has newlines. I'm not sure so far how to make universal
 regex for re-search-forward in org-babel-comint-with-output .
 
 Mikhail
 
 
 





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

2012-05-24 Thread Mikhail Titov
Hello!

I was trying hard to set up Matlab R2011a to work with my Emacs 24.1.50.1 (org 
version is release_7.8.09-532-gb797c8.dirty) and finally I was able to use it 
from M-shell but not from orgmode yet. I've edited emacs wiki [1] to reflect 
somewhat working matlab-mode setup on win32. Namely I use [2] as matlab shell.

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.

I'd appreciate any suggestion as what to try (other than Octave which has its 
own tricks on Win32). I'm lost.

[1] http://www.emacswiki.org/emacs/MatlabMode#toc3
[2] http://www.cs.umb.edu/~ram/matlabShell/index.html

--
Mikhail


Here is what I see in *MATLAB* buffer:

8-*MATLAB*--8-
 a=2
if ischar(ans), fid = 
fopen('c:/DOCUME~1/user/LOCALS~1/Temp/babel-7560HUp/matlab-7560PPd', 'w'); 
fprintf(fid, '%s\n', ans); fclose(fid); else, 
dlmwrite('c:/DOCUME~1/user/LOCALS~1/Temp/babel-7560HUp/matlab-7560PPd', ans, 
'\t'); end
'org_babel_eoe'

a =

 2

  
ans =

org_babel_eoe


8-*MATLAB*--8-


8-*Bactrace*--8-
Debugger entered--Lisp error: (quit)
  accept-process-output(#process MATLAB)
  (while (progn (goto-char comint-last-input-end) (not (save-excursion (and 
(re-search-forward (regexp-quote (if matlabp org-babel-octave-eoe-indicator 
org-babel-octave-eoe-output)) nil t) (re-search-forward comint-prompt-regexp 
nil t) (accept-process-output (get-buffer-process (current-buffer
  (progn (goto-char (process-mark (get-buffer-process (current-buffer (let 
((start (point)) (end (point-max))) (setq dangling-text (buffer-substring start 
end)) (delete-region start end)) (insert full-body) (comint-send-input nil t) 
(while (progn (goto-char comint-last-input-end) (not (save-excursion (and 
(re-search-forward (regexp-quote ...) nil t) (re-search-forward 
comint-prompt-regexp nil t) (accept-process-output (get-buffer-process 
(current-buffer (goto-char (process-mark (get-buffer-process 
(current-buffer (insert dangling-text))
  (unwind-protect (progn (goto-char (process-mark (get-buffer-process 
(current-buffer (let ((start (point)) (end (point-max))) (setq 
dangling-text (buffer-substring start end)) (delete-region start end)) (insert 
full-body) (comint-send-input nil t) (while (progn (goto-char 
comint-last-input-end) (not (save-excursion (and (re-search-forward ... nil t) 
(re-search-forward comint-prompt-regexp nil t) (accept-process-output 
(get-buffer-process (current-buffer (goto-char (process-mark 
(get-buffer-process (current-buffer (insert dangling-text)) (remove-hook 
(quote comint-output-filter-functions) (quote my-filt)))
  (progn (fset (quote my-filt) (function* (lambda (text) (block my-filt (setq 
string-buffer (concat string-buffer text)) (add-hook (quote 
comint-output-filter-functions) (quote my-filt)) (unwind-protect (progn 
(goto-char (process-mark (get-buffer-process (current-buffer (let ((start 
(point)) (end (point-max))) (setq dangling-text (buffer-substring start end)) 
(delete-region start end)) (insert full-body) (comint-send-input nil t) (while 
(progn (goto-char comint-last-input-end) (not (save-excursion (and ... ... 
(accept-process-output (get-buffer-process (current-buffer (goto-char 
(process-mark (get-buffer-process (current-buffer (insert dangling-text)) 
(remove-hook (quote comint-output-filter-functions) (quote my-filt
  (unwind-protect (progn (fset (quote my-filt) (function* (lambda (text) (block 
my-filt (setq string-buffer (concat string-buffer text)) (add-hook (quote 
comint-output-filter-functions) (quote my-filt)) (unwind-protect (progn 
(goto-char (process-mark (get-buffer-process (current-buffer (let ((start 
(point)) (end (point-max))) (setq dangling-text (buffer-substring start end)) 
(delete-region start end)) (insert full-body) (comint-send-input nil t) (while 
(progn (goto-char comint-last-input-end) (not (save-excursion ...))) 
(accept-process-output (get-buffer-process (current-buffer (goto-char 
(process-mark (get-buffer-process (current-buffer (insert dangling-text)) 
(remove-hook (quote comint-output-filter-functions) (quote my-filt (if 
--cl-letf-bound-- (fset (quote my-filt) --cl-letf-save--) (fmakunbound (quote 
my-filt
  (let* ((--cl-letf-bound-- (fboundp (quote my-filt))) (--cl-letf-save-- (and 
--cl-letf-bound-- (symbol-function (quote my-filt) (unwind-protect (progn 
(fset (quote my-filt) (function* (lambda (text) (block my-filt (setq 
string-buffer ...) (add-hook (quote comint-output-filter-functions) (quote 
my-filt)) (unwind-protect (progn (goto-char (process-mark (get-buffer-process 
...))) (let ((start ...) (end ...)) (setq dangling-text (buffer-substring start 

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

2012-05-24 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: Thursday, May 24, 2012 4:02 PM
 To: emacs-orgmode@gnu.org
 Subject: [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.

 ...
 
 Here is what I see in *MATLAB* buffer:
 
 8-*MATLAB*--8-
  a=2
 if ischar(ans), fid = fopen('c:/DOCUME~1/user/LOCALS~1/Temp/babel-
 7560HUp/matlab-7560PPd', 'w'); fprintf(fid, '%s\n', ans); fclose(fid); else,
 dlmwrite('c:/DOCUME~1/user/LOCALS~1/Temp/babel-7560HUp/matlab-7560PPd', ans,
 '\t'); end
 'org_babel_eoe'
 
 a =
 
  2
 
  
 ans =
 
 org_babel_eoe
 
 
 8-*MATLAB*--8-

I feel like it is about

(defvar org-babel-octave-eoe-output ans = org_babel_eoe)

as Matlab's return has newlines. I'm not sure so far how to make universal 
regex for re-search-forward in org-babel-comint-with-output .

Mikhail