Re: [O] Babel language support for Mathematica

2015-03-15 Thread Richard Stanton
Thanks. After a bit of experimentation, I found that you can have a block outputting several lines, but you need to manually add commas and carriage returns, e.g., #+BEGIN_SRC mathematica :results output f[x_] := 3*x^2+3; f[8], "\n", D[f[x],x] #+END_SRC #+RESULTS: : 195 : 6*x > On Mar 13,

Re: [O] Babel language support for Mathematica

2015-03-13 Thread Yi Wang
Dear Richard, You can do: #+BEGIN_SRC mathematica f[x_] := x+3; f[5] #+END_SRC Here are explanations: I actually put everything in the SRC block into a Print[...]. So in the second example, what actually runs is Print[f[x_] := x+3 f[5]] This does not return any value. Because what it really d

Re: [O] Babel language support for Mathematica

2015-03-13 Thread John Kitchin
I wonder if this is an output vs value issue on the return of the block. If you set :results output does anything change? or, is there a way to specify a return value? or specifically print something? Richard Stanton writes: > I recently saw this posting about org support for Mathematica. Thanks

Re: [O] Babel language support for Mathematica

2015-03-13 Thread Richard Stanton
I recently saw this posting about org support for Mathematica. Thanks for writing this! Unfortunately, while I can get it to work for simple things (e.g., 2+3), even slightly more complex things don't seem to work. For example, suppose I'd like to define a function f(x) = x + 3, and then calcu

Re: [O] Babel language support for Mathematica

2014-01-09 Thread Yi Wang
Now it worked. I added (add-to-list 'org-src-lang-modes '("mathematica" . "mma")). After that font lock and edit source works. Thank @Bastien for the help! On Thu, Jan 9, 2014 at 11:31 AM, Yi Wang wrote: > Ah, now the problem appears. It says "No such language mode: > mathematica-mode". > > So

Re: [O] Babel language support for Mathematica

2014-01-09 Thread Yi Wang
Ah, now the problem appears. It says "No such language mode: mathematica-mode". So there is a mismatch between the name mathematica (which I used as name in org-babel extension) and the name mma-mode (which is provided by mma.el). However, as auto-mode-alist suggests (where there is ("\\.m\\'" .

Re: [O] Babel language support for Mathematica

2014-01-09 Thread Bastien
Yi Wang writes: > (1) If I open a .m file, there is font lock. Thus the problem > shouldn't be binding between mma.el and .m files. > (2) If I insert a src block of C or python code in org mode, there is > font lock. Thus the problem shouldn't be org-src-fontify-natively > (and I checked it is in

Re: [O] Babel language support for Mathematica

2014-01-09 Thread Yi Wang
> I don't think so, you may just have to check that the mode defined in > mma.el is automatically boundled with .m files -- which is not the case > with a default Emacs installation, where .m files are open with > objc-mode. I already have this line in my configuration file: (add-to-list 'auto-mo

Re: [O] Babel language support for Mathematica

2014-01-09 Thread Bastien
Yi Wang writes: > Yes, I already set this. But curiously the Mathematica code is still > not highlighted like other codes. I wonder there may be some > non-standard things inside mma.el (the Mathematica package file major > mode) then? I don't think so, you may just have to check that the mode d

Re: [O] Babel language support for Mathematica

2014-01-09 Thread Yi Wang
Hi, Bastien, > (By the way, you should fix the .el header, it says that the file is > part of Emacs while it's not.) Sorry I thought it was general GPL... Now it is updated. Thank you for pointing that out! > (setq org-src-fontify-natively t) Yes, I already set this. But curiously the Mathemati

Re: [O] Babel language support for Mathematica

2014-01-09 Thread Bastien
Hi Sébastien, "Sebastien Vauban" writes: >> (setq org-src-fontify-natively t) > > Shouldn't that be enabled by default, now, as there so many users who > seems to be unaware of that? Well, I'm all for it. > Or is there a fear of impacts on overall performance? No, I don't think so. Can you

Re: [O] Babel language support for Mathematica

2014-01-09 Thread Sebastien Vauban
Hi Bastien, Bastien wrote: >> While writing this extension, I have a question: How to add font-lock >> mode in org code blocks? > > (setq org-src-fontify-natively t) Shouldn't that be enabled by default, now, as there so many users who seems to be unaware of that? Or is there a fear of impacts o

Re: [O] Babel language support for Mathematica

2014-01-09 Thread Bastien
Hi Yi, Yi Wang writes: > As far as I can find, there is no babel support for Mathematica. So I > wrote one and share it in case other people are interested: > > https://github.com/tririver/wy-els/blob/master/ob-mathematica.el Nice, thanks for sharing! (By the way, you should fix the .el header

[O] Babel language support for Mathematica

2014-01-09 Thread Yi Wang
Hello, As far as I can find, there is no babel support for Mathematica. So I wrote one and share it in case other people are interested: https://github.com/tririver/wy-els/blob/master/ob-mathematica.el It is also discussed in this blog http://cosmosimple.blogspot.co.uk/2014/01/evaluate-mathemati