* Re: org-babel for matlab?
@ 2010-02-16 20:16 Bob Jansen
2010-02-17 12:45 ` Darlan Cavalcante Moreira
0 siblings, 1 reply; 5+ messages in thread
From: Bob Jansen @ 2010-02-16 20:16 UTC (permalink / raw)
To: schulte.eric; +Cc: emacs-orgmode
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 <stophl...@yahoo.co.uk> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: org-babel for matlab?
2010-02-16 20:16 org-babel for matlab? Bob Jansen
@ 2010-02-17 12:45 ` Darlan Cavalcante Moreira
2010-02-17 16:45 ` [babel] " Dan Davison
0 siblings, 1 reply; 5+ messages in thread
From: Darlan Cavalcante Moreira @ 2010-02-17 12:45 UTC (permalink / raw)
To: Bob Jansen; +Cc: emacs-orgmode
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
At Tue, 16 Feb 2010 21:16:44 +0100,
Bob Jansen <bobjansen@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 <stophl...@yahoo.co.uk> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [babel] org-babel for matlab?
2010-02-17 12:45 ` Darlan Cavalcante Moreira
@ 2010-02-17 16:45 ` Dan Davison
2010-02-18 14:41 ` Darlan Cavalcante Moreira
0 siblings, 1 reply; 5+ messages in thread
From: Dan Davison @ 2010-02-17 16:45 UTC (permalink / raw)
To: Darlan Cavalcante Moreira; +Cc: emacs-orgmode, "stophl..."
Darlan Cavalcante Moreira <darcamo@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 <bobjansen@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 <stophl...@yahoo.co.uk> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [babel] org-babel for matlab?
2010-02-17 16:45 ` [babel] " Dan Davison
@ 2010-02-18 14:41 ` Darlan Cavalcante Moreira
2010-03-05 4:00 ` Christopher Long
0 siblings, 1 reply; 5+ messages in thread
From: Darlan Cavalcante Moreira @ 2010-02-18 14:41 UTC (permalink / raw)
To: Dan Davison; +Cc: emacs-orgmode, "stophl..."
[-- Attachment #1: Type: text/plain, Size: 312 bytes --]
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 #2: org-babel-matlab.el --]
[-- Type: application/octet-stream, Size: 5941 bytes --]
;;; org-babel-matlab.el --- org-babel functions for matlab evaluation
;; Copyright (C) your name here
;; Author: your name here
;; Keywords: literate programming, reproducible research
;; Homepage: http://orgmode.org
;; Version: 0.01
;;; License:
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Commentary:
;; This file is not intended to ever be loaded by org-babel, rather it
;; is a template for use in adding new language support to Org-babel.
;; Good first steps are to copy this file to a file named by the
;; language you are adding, and then use `query-replace' to replace
;; all strings of "template" in this file with the name of your new
;; language.
;;
;; If you have questions as to any of the portions of the file defined
;; below please look to existing language support for guidance.
;;
;; If you are planning on adding a language to org-babel we would ask
;; that if possible you fill out the FSF copyright assignment form
;; available at http://orgmode.org/request-assign-future.txt as this
;; will simplify the eventual inclusion of your addition into
;; org-babel and possibly at some point into org-mode and Emacs
;; proper.
;;; Requirements:
;; Use this section to list the requirements of this language. Most
;; languages will require that at least the language be installed on
;; the user's system, and the Emacs major mode relevant to the
;; language be installed as well.
;;; Code:
(require 'org-babel)
;; possibly require modes required for your language
;; Add this language to the list of supported languages. Org-babel
;; will match the string below against the declared language of the
;; source-code block.
(org-babel-add-interpreter "matlab")
;; specify the name, file extension, and shebang line for this language
(add-to-list 'org-babel-tangle-langs '("matlab" "m" "#!/usr/bin/env matlab"))
;; This is the main function which is called to evaluate a code
;; block. It should setup the source code block according to all of
;; the header arguments packaged into params, including...
;; - defining variables
;; - optionally starting up a session (depending on the value of the
;; :session) header argument
;;
;; This function will then evaluate the body of the source code and
;; return the results as emacs-lisp depending on the value of the
;; :results header argument
;; - output means that the output to STDOUT will be captured and
;; returned
;; - value means that the value of the last statement in the
;; source code block will be returned
;;
;; The most common first step in this function is the expansion of the
;; PARAMS argument using `org-babel-process-params'.
;;
;; Please feel free to not implement options which aren't appropriate
;; for your language (e.g. not all languages support interactive
;; "session" evaluation). Also you are free to define any new header
;; arguments which you feel may be useful -- all header arguments
;; specified by the user will be available in the PARAMS variable.
(defun org-babel-execute:matlab (body params)
"Execute a block of Matlab code with org-babel. This function is
called by `org-babel-execute-src-block' via multiple-value-bind."
(message "executing Matlab source code block")
(let* ((processed-params (org-babel-process-params params))
;; set the session if the session variable is non-nil
(session (org-babel-matlab-initiate-session (first processed-params)))
;; variables assigned for use in the block
(vars (second processed-params))
(result-params (third processed-params))
;; either OUTPUT or VALUE which should behave as described above
(result-type (fourth processed-params))
(full-body (concat
;; prepend code to define all arguments passed to the code block
;; (may not be appropriate for all languages)
(mapconcat
(lambda (pair)
(format "%s=%s"
(car pair)
(org-babel-matlab-var-to-matlab (cdr pair))))
vars "\n") "\n" body "\n")))
;; actually execute the source-code block either in a session or
;; possibly by dropping it to a temporary file and evaluating the
;; file.
;;
;; for session based evaluation the helpers defined in
;; `org-babel-comint' will probably be helpful.
))
;; This function should be used to assign any variables in params in
;; the context of the session environment.
(defun org-babel-prep-session:matlab (session params)
"Prepare SESSION according to the header arguments specified in PARAMS."
)
(defun org-babel-matlab-var-to-matlab (var)
"Convert an elisp var into a string of matlab source code
specifying a var of the same value."
)
(defun org-babel-matlab-table-or-string (results)
"If the results look like a table, then convert them into an
Emacs-lisp table, otherwise return the results as a string."
)
(defun org-babel-matlab-initiate-session (&optional session)
"If there is not a current inferior-process-buffer in SESSION
then create. Return the initialized session."
(unless (string= session "none")
))
(provide 'org-babel-matlab)
;;; org-babel-matlab.el ends here
[-- Attachment #3: org-babel-octave.el --]
[-- Type: application/octet-stream, Size: 5941 bytes --]
;;; org-babel-octave.el --- org-babel functions for octave evaluation
;; Copyright (C) your name here
;; Author: your name here
;; Keywords: literate programming, reproducible research
;; Homepage: http://orgmode.org
;; Version: 0.01
;;; License:
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Commentary:
;; This file is not intended to ever be loaded by org-babel, rather it
;; is a template for use in adding new language support to Org-babel.
;; Good first steps are to copy this file to a file named by the
;; language you are adding, and then use `query-replace' to replace
;; all strings of "template" in this file with the name of your new
;; language.
;;
;; If you have questions as to any of the portions of the file defined
;; below please look to existing language support for guidance.
;;
;; If you are planning on adding a language to org-babel we would ask
;; that if possible you fill out the FSF copyright assignment form
;; available at http://orgmode.org/request-assign-future.txt as this
;; will simplify the eventual inclusion of your addition into
;; org-babel and possibly at some point into org-mode and Emacs
;; proper.
;;; Requirements:
;; Use this section to list the requirements of this language. Most
;; languages will require that at least the language be installed on
;; the user's system, and the Emacs major mode relevant to the
;; language be installed as well.
;;; Code:
(require 'org-babel)
;; possibly require modes required for your language
;; Add this language to the list of supported languages. Org-babel
;; will match the string below against the declared language of the
;; source-code block.
(org-babel-add-interpreter "octave")
;; specify the name, file extension, and shebang line for this language
(add-to-list 'org-babel-tangle-langs '("octave" "m" "#!/usr/bin/env octave"))
;; This is the main function which is called to evaluate a code
;; block. It should setup the source code block according to all of
;; the header arguments packaged into params, including...
;; - defining variables
;; - optionally starting up a session (depending on the value of the
;; :session) header argument
;;
;; This function will then evaluate the body of the source code and
;; return the results as emacs-lisp depending on the value of the
;; :results header argument
;; - output means that the output to STDOUT will be captured and
;; returned
;; - value means that the value of the last statement in the
;; source code block will be returned
;;
;; The most common first step in this function is the expansion of the
;; PARAMS argument using `org-babel-process-params'.
;;
;; Please feel free to not implement options which aren't appropriate
;; for your language (e.g. not all languages support interactive
;; "session" evaluation). Also you are free to define any new header
;; arguments which you feel may be useful -- all header arguments
;; specified by the user will be available in the PARAMS variable.
(defun org-babel-execute:octave (body params)
"Execute a block of Octave code with org-babel. This function is
called by `org-babel-execute-src-block' via multiple-value-bind."
(message "executing Octave source code block")
(let* ((processed-params (org-babel-process-params params))
;; set the session if the session variable is non-nil
(session (org-babel-octave-initiate-session (first processed-params)))
;; variables assigned for use in the block
(vars (second processed-params))
(result-params (third processed-params))
;; either OUTPUT or VALUE which should behave as described above
(result-type (fourth processed-params))
(full-body (concat
;; prepend code to define all arguments passed to the code block
;; (may not be appropriate for all languages)
(mapconcat
(lambda (pair)
(format "%s=%s"
(car pair)
(org-babel-octave-var-to-octave (cdr pair))))
vars "\n") "\n" body "\n")))
;; actually execute the source-code block either in a session or
;; possibly by dropping it to a temporary file and evaluating the
;; file.
;;
;; for session based evaluation the helpers defined in
;; `org-babel-comint' will probably be helpful.
))
;; This function should be used to assign any variables in params in
;; the context of the session environment.
(defun org-babel-prep-session:octave (session params)
"Prepare SESSION according to the header arguments specified in PARAMS."
)
(defun org-babel-octave-var-to-octave (var)
"Convert an elisp var into a string of octave source code
specifying a var of the same value."
)
(defun org-babel-octave-table-or-string (results)
"If the results look like a table, then convert them into an
Emacs-lisp table, otherwise return the results as a string."
)
(defun org-babel-octave-initiate-session (&optional session)
"If there is not a current inferior-process-buffer in SESSION
then create. Return the initialized session."
(unless (string= session "none")
))
(provide 'org-babel-octave)
;;; org-babel-octave.el ends here
[-- Attachment #4: Type: text/plain, Size: 4803 bytes --]
At Wed, 17 Feb 2010 11:45:14 -0500,
Dan Davison <davison@stats.ox.ac.uk> wrote:
>
> Darlan Cavalcante Moreira <darcamo@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 <bobjansen@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 <stophl...@yahoo.co.uk> 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
[-- Attachment #5: Type: text/plain, Size: 201 bytes --]
_______________________________________________
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [babel] org-babel for matlab?
2010-02-18 14:41 ` Darlan Cavalcante Moreira
@ 2010-03-05 4:00 ` Christopher Long
0 siblings, 0 replies; 5+ messages in thread
From: Christopher Long @ 2010-03-05 4:00 UTC (permalink / raw)
To: emacs-orgmode
Darlan Cavalcante Moreira <darcamo <at> 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 <davison
<at> stats.ox.ac.uk> wrote: > > > > Darlan Cavalcante Moreira <darcamo
<at> 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
<bobjansen <at> 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
<stophl...@yahoo.co.uk> 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 <at> 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 <at> 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 <at> 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 <at> 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 <at> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-03-05 14:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-16 20:16 org-babel for matlab? Bob Jansen
2010-02-17 12:45 ` Darlan Cavalcante Moreira
2010-02-17 16:45 ` [babel] " Dan Davison
2010-02-18 14:41 ` Darlan Cavalcante Moreira
2010-03-05 4:00 ` Christopher Long
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).