From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christopher Long Subject: Re: [babel] org-babel for matlab? Date: Fri, 5 Mar 2010 04:00:43 +0000 (UTC) Message-ID: References: <38c4de4b1002161216p2b886431t476fc4f71c2dc485@mail.gmail.com> <4b7be517.0d1abc0a.7168.31d4@mx.google.com> <871vgjolph.fsf_-_@stats.ox.ac.uk> <4b7d5189.101abc0a.2dea.0a74@mx.google.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NnYXc-0007Wi-0t for emacs-orgmode@gnu.org; Fri, 05 Mar 2010 09:30:12 -0500 Received: from [140.186.70.92] (port=42941 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NnYXW-0007WN-3w for emacs-orgmode@gnu.org; Fri, 05 Mar 2010 09:30:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NnYXU-0006Sx-O8 for emacs-orgmode@gnu.org; Fri, 05 Mar 2010 09:30:05 -0500 Received: from lo.gmane.org ([80.91.229.12]:39833) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NnYXU-0006St-A2 for emacs-orgmode@gnu.org; Fri, 05 Mar 2010 09:30:04 -0500 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1NnYXS-0006Pc-Py for emacs-orgmode@gnu.org; Fri, 05 Mar 2010 15:30:03 +0100 Received: from c-67-161-148-82.hsd1.co.comcast.net ([67.161.148.82]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 05 Mar 2010 15:30:02 +0100 Received: from Stoph by c-67-161-148-82.hsd1.co.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 05 Mar 2010 15:30:02 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Darlan Cavalcante Moreira gmail.com> writes: > > > I'm afraid I can't help much on this. I just used the org-babel-template.el file > provided by Eric and did a search and replace as told in the file comments in > order to make tangle work for octave and MATLAB. I didn't implement any function > (I only know enough lisp to understand my own .emacs file). > > - Darlan > > > Attachment (org-babel-matlab.el): application/octet-stream, 5941 bytes > Attachment (org-babel-octave.el): application/octet-stream, 5941 bytes > > > At Wed, 17 Feb 2010 11:45:14 -0500, > Dan Davison stats.ox.ac.uk> wrote: > > > > Darlan Cavalcante Moreira gmail.com> writes: > > > > > This is also important for me (in fact, for octave). For now I used the template > > > file and I can tangle the code correctly, but since I didn't implement any > > > function for code execution tangling is all I've got. > > > > > > - Darlan > > > > I was also going to suggest that if someone did this, they might want to > > try to address octave at the same time. > > > > Darlan -- would you like to share your initial version of octave > > support? If we get it onto a git repository then we can all have a look > > and maybe make a bit of progress. Either post it, or contact me off-line > > for the admin details for http://repo.or.cz/w/org-mode/babel.git. > > > > I don't use either language but here are some comments about the various > > tasks and guesses about how hard they would be. > > > > If someone could comment on the extent to which differences between > > matlab and octave (running as command-line external processes) are going > > to make shared org-babel support problematic that would probably be > > useful. > > > > - external process :results output > > Running octave as an external process under linux/OS X and collecting > > stdout shouldn't be too hard. Presumably same for matlab? Windows > > support: unavailable for matlab, but probably feasible for octave. > > > > - external process :results value > > This basically involves (in matlab/octave) writing vectors and arrays > > to a tabular file (and then using existing code to import the org > > table, but this bit can be taken from the files for another language) > > > > - :session > > At first glance it looks like there's an inferior octave mode that > > should be suitable for use > > with :session. Darlan -- do you have experience with this? > > > > http://www.gnu.org/software/octave/doc/interpreter/Running-Octave- From-Within-Emacs.html#Running-Octave-From-Within-Emacs > > > > - Matlab :session on Windows > > Getting org-babel to work with the MatLab "EmacsLink" module may well be > > possible, but I would only be able to help very superficially. > > > > Dan > > > > > > > > > > At Tue, 16 Feb 2010 21:16:44 +0100, > > > Bob Jansen gmail.com> wrote: > > >> > > >> Hi list, > > >> > > >> Has any progress been made on this? I'm fairly new to org-mode and > > >> org-babel but this sounds to me like a very useful feature. > > >> > > >> > Hi Christopher, > > >> > > > >> > I do not know of anyone working on matlab support for org-babel. I am > > >> > attaching a template file which contains instructions for adding support > > >> > for a new language. Depending on your level of familiarity with elisp > > >> > it could take anywhere from a couple of hours to a couple of days. > > >> > We're still debugging some of the original language specific files :) > > >> > > > >> > Best of Luck! -- Eric > > >> > > > >> > > > >> > Attachment: org-babel-template.el > > >> > Description: application/emacs-lisp > > >> > > > >> > Christopher Long writes: > > >> > > > >> > Dear All, > > >> > > > >> > Has anyone started on a babel mode for matlab? Or is anyone else > > >> > interested > > >> > in making it happen? Or have a suggestion for a good template to > > >> > start from (babel-python? babel-R?) And anyone has an estimate of how > > >> > time consuming such a project would be? > > >> > > > >> > I'd like it to work on Windows and there isn't a console mode of Matlab > > >> > on windows, but you can evaluate code with EmacsLink and likely direct > > >> > all output to temporary files. > > >> > (I know EmacsLink was dropped in R2009a, but some of us are avoiding > > >> > upgrading > > >> > and hoping that Matlab will return EmacsLink in the future.) > > >> > > > >> > > > >> > Thanks, > > >> > > > >> > Stoph > > >> > > > >> > > > >> > _______________________________________________ > > >> > Emacs-orgmode mailing list > > >> > Please use `Reply All' to send replies to the list. > > >> > Emacs-orgmode gnu.org > > >> > http://lists.gnu.org/mailman/listinfo/emacs-orgmode > > >> > > >> _______________________________________________ > > >> Emacs-orgmode mailing list > > >> Please use `Reply All' to send replies to the list. > > >> Emacs-orgmode gnu.org > > >> http://lists.gnu.org/mailman/listinfo/emacs-orgmode > > >> > > >> > > >> -- > > >> Met vriendelijke groet, > > >> > > >> Bob Jansen > > >> > > >> > > >> _______________________________________________ > > >> Emacs-orgmode mailing list > > >> Please use `Reply All' to send replies to the list. > > >> Emacs-orgmode gnu.org > > >> http://lists.gnu.org/mailman/listinfo/emacs-orgmode > > > > > > > > > _______________________________________________ > > > Emacs-orgmode mailing list > > > Please use `Reply All' to send replies to the list. > > > Emacs-orgmode gnu.org > > > http://lists.gnu.org/mailman/listinfo/emacs-orgmode > > > _______________________________________________ > Emacs-orgmode mailing list > Please use `Reply All' to send replies to the list. > Emacs-orgmode gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode > In case it is useful to anyone I've hacked together something to read back things from matlab's output using the diary mode, m-files, and a bit of lisp combined with EmacsLink (which - sadly - is no longer supported by the Mathworks on their most recent versions of Matlab). This was done on windows xp. This is still a few steps away from full orgmode integration, but it is a bit nice. Perhaps someone can build on it. example use: %in emacs matlab mode ss; a=1 fprintf(1,'%d\n',a) se; % mark the above in emacs % ctrl-c ctrl-r % ctrl-c ctrl-i %the result: %%%%%%%%%%%%% % 04-Mar-2010 20:49:45 a=1 a = 1 fprintf(1,'%d\n',a) 1 se; %%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%% the .emacs changes: (defun my-matlab-mode-hook () (setq fill-column 76) (font-lock-mode 1) (auto-fill-mode 0) ; turn off auto-fill (imenu-add-to-menubar "Find")) ; where auto-fill should wrap (setq matlab-session-filename "session.txt") (defun insert-session-file () (interactive) ;; (matlab-shell-run-region (mark) (point)) (insert-file-contents matlab-session-filename)) (global-set-key "\C-c\C-i" 'insert-session-file) (add-hook 'matlab-mode-hook 'my-matlab-mode-hook) ss.m %sessionstart diary off; sessionfilename='C:\Documents and Settings\clong\My Documents\MatlabToolboxes\stoph\session.txt'; eval(['delete ''' sessionfilename ''' ']); diary([sessionfilename]); fprintf(1,'\n%%%%%%%%%%%%%%%%%%%%%%%%%%\n') fprintf(1,'%% %s\n',datestr(now)) se.m % fprintf(1,'\n%%%%%%%%%%%%%%%%%%%%%%%%%%\n') diary off; Stoph