From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yi Wang Subject: Babel language support for Mathematica Date: Thu, 9 Jan 2014 03:46:51 +0000 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e01176745bfcd3e04ef817586 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53669) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W16a6-0002mq-O3 for emacs-orgmode@gnu.org; Wed, 08 Jan 2014 22:46:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W16a5-0006dM-KV for emacs-orgmode@gnu.org; Wed, 08 Jan 2014 22:46:54 -0500 Received: from mail-oa0-x234.google.com ([2607:f8b0:4003:c02::234]:41563) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W16a5-0006dF-FO for emacs-orgmode@gnu.org; Wed, 08 Jan 2014 22:46:53 -0500 Received: by mail-oa0-f52.google.com with SMTP id o6so2783834oag.25 for ; Wed, 08 Jan 2014 19:46:52 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Cc: Yi Wang --089e01176745bfcd3e04ef817586 Content-Type: text/plain; charset=ISO-8859-1 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-mathematica-code-in-emacs-org.html While writing this extension, I have a question: How to add font-lock mode in org code blocks? I had a read of ob-C and ob-python code and didn't find out how they do font-lock. Note that the font lock support for Mathematica is available as mma-mode at https://github.com/skaslev/emacs.d/blob/master/progmodes/mma.el For my case in a .m file I have font lock from mma.el, but not src code blocks. Best wishes, Yi --089e01176745bfcd3e04ef817586 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hello,

As far as I can find, there is n= o babel support for Mathematica. So I wrote one and share it in case other = people are interested:



While writing this extension, I have a question: How to= add font-lock mode in org code blocks? I had a read of ob-C and ob-python = code and didn't find out how they do font-lock.

Note that the font lock support for Mathematica is available as mma-mo= de at

For my case in a .m file I have font lock from mm= a.el, but not src code blocks.

Best wishes,
<= div>Yi
--089e01176745bfcd3e04ef817586-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: Babel language support for Mathematica Date: Thu, 09 Jan 2014 11:28:50 +0100 Message-ID: <87ha9dwisd.fsf@bzg.ath.cx> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36601) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1CrE-0003Tq-38 for emacs-orgmode@gnu.org; Thu, 09 Jan 2014 05:29:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W1Cr8-0005Me-KP for emacs-orgmode@gnu.org; Thu, 09 Jan 2014 05:29:00 -0500 Received: from mail-we0-x234.google.com ([2a00:1450:400c:c03::234]:56561) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1Cr8-0005MT-Ct for emacs-orgmode@gnu.org; Thu, 09 Jan 2014 05:28:54 -0500 Received: by mail-we0-f180.google.com with SMTP id t61so2564934wes.39 for ; Thu, 09 Jan 2014 02:28:53 -0800 (PST) In-Reply-To: (Yi Wang's message of "Thu, 9 Jan 2014 03:46:51 +0000") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Yi Wang Cc: emacs-orgmode@gnu.org 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, it says that the file is part of Emacs while it's not.) > While writing this extension, I have a question: How to add font-lock > mode in org code blocks? (setq org-src-fontify-natively t) HTH, -- Bastien From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Sebastien Vauban" Subject: Re: Babel language support for Mathematica Date: Thu, 09 Jan 2014 11:34:17 +0100 Message-ID: <86wqi9zbo6.fsf@somewhere.org> References: <87ha9dwisd.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: text/plain Return-path: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org-mXXj517/zsQ@public.gmane.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org-mXXj517/zsQ@public.gmane.org To: emacs-orgmode-mXXj517/zsQ@public.gmane.org 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 on overall performance? Best regards, Seb -- Sebastien Vauban From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: Babel language support for Mathematica Date: Thu, 09 Jan 2014 11:39:29 +0100 Message-ID: <874n5dwiam.fsf@bzg.ath.cx> References: <87ha9dwisd.fsf@bzg.ath.cx> <86wqi9zbo6.fsf@somewhere.org> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40272) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1D1r-0007Og-J7 for emacs-orgmode@gnu.org; Thu, 09 Jan 2014 05:40:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W1D1j-0000RC-8m for emacs-orgmode@gnu.org; Thu, 09 Jan 2014 05:39:59 -0500 Received: from plane.gmane.org ([80.91.229.3]:36170) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1D1i-0000QL-VC for emacs-orgmode@gnu.org; Thu, 09 Jan 2014 05:39:51 -0500 Received: from public by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1W1D1h-0007AE-BJ for emacs-orgmode@gnu.org; Thu, 09 Jan 2014 11:39:49 +0100 In-Reply-To: <86wqi9zbo6.fsf@somewhere.org> (Sebastien Vauban's message of "Thu, 09 Jan 2014 11:34:17 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Sebastien Vauban Cc: public-emacs-orgmode-mXXj517/zsQ@plane.gmane.org 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 create a separate thread and poll the user for whether they want this to be the default for the next major release? Thanks! -- Bastien From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yi Wang Subject: Re: Babel language support for Mathematica Date: Thu, 9 Jan 2014 10:51:53 +0000 Message-ID: References: <87ha9dwisd.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b33d81ac7f95f04ef87654d Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43514) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1DDQ-0002Lh-Hl for emacs-orgmode@gnu.org; Thu, 09 Jan 2014 05:51:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W1DDP-0004S6-4T for emacs-orgmode@gnu.org; Thu, 09 Jan 2014 05:51:56 -0500 In-Reply-To: <87ha9dwisd.fsf@bzg.ath.cx> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Bastien Cc: emacs-orgmode@gnu.org --047d7b33d81ac7f95f04ef87654d Content-Type: text/plain; charset=ISO-8859-1 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 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? Best, Yi On Thu, Jan 9, 2014 at 10:28 AM, Bastien wrote: > 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, it says that the file is > part of Emacs while it's not.) > > > While writing this extension, I have a question: How to add font-lock > > mode in org code blocks? > > (setq org-src-fontify-natively t) > > HTH, > > -- > Bastien > --047d7b33d81ac7f95f04ef87654d Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hi, Bastien,

> (By the way, you should fix the .el = header, it says that the file is
> part of Em= acs 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 Mathematica code is st= ill not highlighted like other codes. I wonder there may be some non-standa= rd things inside mma.el (the Mathematica package file major mode) then?

Bes= t,
Yi


On Thu,= Jan 9, 2014 at 10:28 AM, Bastien <bzg@gnu.org> wrote:
Hi Yi,

Yi Wang <tririverwangyi@gmai= l.com> writes:

> As far as I can find, there is no babel support for Mathematica. So I<= br> > 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, it says that the file is
part of Emacs while it's not.)

> While writing this extension, I have a question: How to add font-lock<= br> > mode in org code blocks?

(setq org-src-fontify-natively t)

HTH,

--
=A0Bastien

--047d7b33d81ac7f95f04ef87654d-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: Babel language support for Mathematica Date: Thu, 09 Jan 2014 11:55:40 +0100 Message-ID: <87sisxtoer.fsf@bzg.ath.cx> References: <87ha9dwisd.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:44555) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1DHG-00053C-Qu for emacs-orgmode@gnu.org; Thu, 09 Jan 2014 05:56:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W1DH8-0005Wp-Ej for emacs-orgmode@gnu.org; Thu, 09 Jan 2014 05:55:54 -0500 Received: from mail-wi0-x233.google.com ([2a00:1450:400c:c05::233]:52338) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1DH7-0005We-9P for emacs-orgmode@gnu.org; Thu, 09 Jan 2014 05:55:45 -0500 Received: by mail-wi0-f179.google.com with SMTP id z2so3277105wiv.12 for ; Thu, 09 Jan 2014 02:55:44 -0800 (PST) In-Reply-To: (Yi Wang's message of "Thu, 9 Jan 2014 10:51:53 +0000") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Yi Wang Cc: emacs-orgmode@gnu.org 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 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. -- Bastien From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yi Wang Subject: Re: Babel language support for Mathematica Date: Thu, 9 Jan 2014 11:03:24 +0000 Message-ID: References: <87ha9dwisd.fsf@bzg.ath.cx> <87sisxtoer.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11c1fd62f2d82a04ef878ec1 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46874) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1DOY-0001tU-Sw for emacs-orgmode@gnu.org; Thu, 09 Jan 2014 06:03:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W1DOX-0008Cq-Ga for emacs-orgmode@gnu.org; Thu, 09 Jan 2014 06:03:26 -0500 Received: from mail-oa0-x234.google.com ([2607:f8b0:4003:c02::234]:44719) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1DOX-0008Cc-9k for emacs-orgmode@gnu.org; Thu, 09 Jan 2014 06:03:25 -0500 Received: by mail-oa0-f52.google.com with SMTP id o6so3220996oag.11 for ; Thu, 09 Jan 2014 03:03:24 -0800 (PST) In-Reply-To: <87sisxtoer.fsf@bzg.ath.cx> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Bastien Cc: emacs-orgmode@gnu.org --001a11c1fd62f2d82a04ef878ec1 Content-Type: text/plain; charset=ISO-8859-1 > 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-mode-alist '("\\.m\\'" . mma-mode)) Now I have (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 indeed t). This is why I am confused. Actually I don't badly need this feature. Just it would be a little better to have things work properly. Best, Yi On Thu, Jan 9, 2014 at 10:55 AM, Bastien wrote: > 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 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. > > -- > Bastien > --001a11c1fd62f2d82a04ef878ec1 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
> 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 def= ault Emacs installation, where .m files are open with
> objc-mode.

=
I already have this line in my configuration file:

(add-to-list 'auto-mode-alist '("\\.m\\'"= ; . mma-mode))

Now I have

(= 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=A0org-src-fontify-natively (and I checked it = is indeed t).

Thi= s is why I am confused. Actually I don't badly need this feature. Just = it would be a little better to have things work properly.

Bes= t,
Yi


On Thu,= Jan 9, 2014 at 10:55 AM, Bastien <bzg@altern.org> wrote:
Yi Wang <t= ririverwangyi@gmail.com> 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<= br> > mode) then?

I don't think so, you may just have to check that the mode define= d 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.

--
=A0Bastien

--001a11c1fd62f2d82a04ef878ec1-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: Babel language support for Mathematica Date: Thu, 09 Jan 2014 12:15:25 +0100 Message-ID: <87bnzltnhu.fsf@bzg.ath.cx> References: <87ha9dwisd.fsf@bzg.ath.cx> <87sisxtoer.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50542) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1DaN-0006fS-CA for emacs-orgmode@gnu.org; Thu, 09 Jan 2014 06:15:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W1DaE-0003mF-Um for emacs-orgmode@gnu.org; Thu, 09 Jan 2014 06:15:39 -0500 Received: from mail-wg0-x234.google.com ([2a00:1450:400c:c00::234]:46074) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1DaE-0003m8-Gw for emacs-orgmode@gnu.org; Thu, 09 Jan 2014 06:15:30 -0500 Received: by mail-wg0-f52.google.com with SMTP id b13so2374343wgh.19 for ; Thu, 09 Jan 2014 03:15:29 -0800 (PST) In-Reply-To: (Yi Wang's message of "Thu, 9 Jan 2014 11:03:24 +0000") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Yi Wang Cc: emacs-orgmode@gnu.org 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 indeed t). What happen if you C-c ' on a .m block? -- Bastien From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yi Wang Subject: Re: Babel language support for Mathematica Date: Thu, 9 Jan 2014 11:31:35 +0000 Message-ID: References: <87ha9dwisd.fsf@bzg.ath.cx> <87sisxtoer.fsf@bzg.ath.cx> <87bnzltnhu.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e013a1822c1597904ef87f3f0 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55506) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1Dps-00051b-HQ for emacs-orgmode@gnu.org; Thu, 09 Jan 2014 06:31:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W1Dpo-00013q-OA for emacs-orgmode@gnu.org; Thu, 09 Jan 2014 06:31:40 -0500 Received: from mail-oa0-x233.google.com ([2607:f8b0:4003:c02::233]:47856) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1Dpo-00013d-JW for emacs-orgmode@gnu.org; Thu, 09 Jan 2014 06:31:36 -0500 Received: by mail-oa0-f51.google.com with SMTP id m1so3226897oag.24 for ; Thu, 09 Jan 2014 03:31:36 -0800 (PST) In-Reply-To: <87bnzltnhu.fsf@bzg.ath.cx> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Bastien Cc: emacs-orgmode@gnu.org --089e013a1822c1597904ef87f3f0 Content-Type: text/plain; charset=ISO-8859-1 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\\'" . mma-mode), and no entry with mathematica-mode), I still have no idea why org-edit-special looks for mathematica-mode instead of mma-mode. On Thu, Jan 9, 2014 at 11:15 AM, Bastien wrote: > 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 indeed t). > > What happen if you C-c ' on a .m block? > > -- > Bastien > --089e013a1822c1597904ef87f3f0 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Ah, now the problem appears. It says "No such languag= e mode: mathematica-mode".

So there is a mismatch b= etween the name mathematica (which I used as name in org-babel extension) a= nd the name mma-mode (which is provided by mma.el).=A0

However, as=A0auto-mode-alist suggests (where there is = ("\\.m\\'" . mma-mode), and no entry with mathematica-mode), = I still have no idea why=A0org-edit-special looks for mathematica-mode inst= ead of mma-mode.


On Thu,= Jan 9, 2014 at 11:15 AM, Bastien <bzg@altern.org> wrote:
Yi Wang <t= ririverwangyi@gmail.com> 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<= br> > font lock. Thus the problem shouldn't be=A0org-src-fontify-nativel= y
> (and I checked it is indeed t).

What happen if you C-c ' on a .m block?

--
=A0Bastien

--089e013a1822c1597904ef87f3f0-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yi Wang Subject: Re: Babel language support for Mathematica Date: Thu, 9 Jan 2014 11:49:24 +0000 Message-ID: References: <87ha9dwisd.fsf@bzg.ath.cx> <87sisxtoer.fsf@bzg.ath.cx> <87bnzltnhu.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b2e46f0749a0b04ef88338d Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:60381) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1E74-0001FR-Pv for emacs-orgmode@gnu.org; Thu, 09 Jan 2014 06:49:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W1E73-0006qg-Jc for emacs-orgmode@gnu.org; Thu, 09 Jan 2014 06:49:26 -0500 Received: from mail-oa0-x236.google.com ([2607:f8b0:4003:c02::236]:33021) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1E73-0006qZ-AV for emacs-orgmode@gnu.org; Thu, 09 Jan 2014 06:49:25 -0500 Received: by mail-oa0-f54.google.com with SMTP id o6so3302183oag.27 for ; Thu, 09 Jan 2014 03:49:24 -0800 (PST) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Bastien Cc: emacs-orgmode@gnu.org --047d7b2e46f0749a0b04ef88338d Content-Type: text/plain; charset=ISO-8859-1 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 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\\'" . > mma-mode), and no entry with mathematica-mode), I still have no idea > why org-edit-special looks for mathematica-mode instead of mma-mode. > > > On Thu, Jan 9, 2014 at 11:15 AM, Bastien wrote: > >> 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 indeed t). >> >> What happen if you C-c ' on a .m block? >> >> -- >> Bastien >> > > --047d7b2e46f0749a0b04ef88338d Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Now it worked. I added=A0(add-to-list 'org-src-lang-mo= des '("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= <tririverwangyi@gmail.com> wrote:
Ah, now the problem appears. It says "No such languag= e mode: mathematica-mode".

So there is a mismatch b= etween the name mathematica (which I used as name in org-babel extension) a= nd the name mma-mode (which is provided by mma.el).=A0

However, as=A0auto-mode-alist suggests (where there is = ("\\.m\\'" . mma-mode), and no entry with mathematica-mode), = I still have no idea why=A0org-edit-special looks for mathematica-mode inst= ead of mma-mode.

On Thu, Jan 9, 2014 at 11:15 AM, Bastien <= span dir=3D"ltr"><bz= g@altern.org> wrote:
Yi Wang <tririverwangyi@gmail.com> 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<= br> > font lock. Thus the problem shouldn't be=A0org-src-fontify-nativel= y
> (and I checked it is indeed t).

What happen if you C-c ' on a .m block?

--
=A0Bastien


--047d7b2e46f0749a0b04ef88338d-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Stanton Subject: Re: Babel language support for Mathematica Date: Fri, 13 Mar 2015 16:06:12 -0700 Message-ID: <0E109199-8E68-4B76-A1D9-20105FF0C1D3@haas.berkeley.edu> Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2070.6\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:48678) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YWYes-0006fZ-B9 for emacs-orgmode@gnu.org; Fri, 13 Mar 2015 19:06:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YWYep-0003LF-5r for emacs-orgmode@gnu.org; Fri, 13 Mar 2015 19:06:22 -0400 Received: from mail-pa0-f44.google.com ([209.85.220.44]:34346) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YWYep-0003L4-07 for emacs-orgmode@gnu.org; Fri, 13 Mar 2015 19:06:19 -0400 Received: by pacwe9 with SMTP id we9so1316200pac.1 for ; Fri, 13 Mar 2015 16:06:16 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Cc: tririverwangyi@gmail.com I recently saw this posting about org support for Mathematica. Thanks = for writing this!=20 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) =3D x + 3, and then calculate = f(5). In a MMA notebook, if I type f[x_] :=3D x+3 f[5] I get the answer 8. If I try the same code in an org-mode code block, = here's what happens: #+BEGIN_SRC mathematica=20 f[x_] :=3D x+3 f[5] #+END_SRC #+RESULTS: : Null Am I missing something obvious here? Thanks very much. Richard Stanton= From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: Babel language support for Mathematica Date: Fri, 13 Mar 2015 19:09:56 -0400 Message-ID: References: <0E109199-8E68-4B76-A1D9-20105FF0C1D3@haas.berkeley.edu> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49302) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YWYiR-0008Jr-PV for emacs-orgmode@gnu.org; Fri, 13 Mar 2015 19:10:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YWYiO-00042R-JK for emacs-orgmode@gnu.org; Fri, 13 Mar 2015 19:10:03 -0400 Received: from smtp.andrew.cmu.edu ([128.2.157.37]:36492) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YWYiO-00042E-ER for emacs-orgmode@gnu.org; Fri, 13 Mar 2015 19:10:00 -0400 In-reply-to: <0E109199-8E68-4B76-A1D9-20105FF0C1D3@haas.berkeley.edu> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Richard Stanton Cc: emacs-orgmode@gnu.org, tririverwangyi@gmail.com 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 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 calculate f(5). In a MMA notebook, if I type > > f[x_] := x+3 > f[5] > > I get the answer 8. If I try the same code in an org-mode code block, here's what happens: > > #+BEGIN_SRC mathematica > f[x_] := x+3 > f[5] > #+END_SRC > > #+RESULTS: > : Null > > Am I missing something obvious here? > > Thanks very much. > > Richard Stanton -- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yi Wang Subject: Re: Babel language support for Mathematica Date: Fri, 13 Mar 2015 23:16:36 +0000 Message-ID: References: <0E109199-8E68-4B76-A1D9-20105FF0C1D3@haas.berkeley.edu> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11c2e5583567dc051133b105 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51331) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YWYoq-0002Nw-7S for emacs-orgmode@gnu.org; Fri, 13 Mar 2015 19:16:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YWYoo-0007Tt-P1 for emacs-orgmode@gnu.org; Fri, 13 Mar 2015 19:16:40 -0400 Received: from mail-ob0-x233.google.com ([2607:f8b0:4003:c01::233]:35098) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YWYoo-0007Tl-HN for emacs-orgmode@gnu.org; Fri, 13 Mar 2015 19:16:38 -0400 Received: by obfv9 with SMTP id v9so983531obf.2 for ; Fri, 13 Mar 2015 16:16:37 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: John Kitchin , Richard Stanton Cc: emacs-orgmode@gnu.org --001a11c2e5583567dc051133b105 Content-Type: text/plain; charset=UTF-8 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 does is print the value of "f[x_] := x+3 f[5]" Here is the code: (concat (mapconcat ;; define any variables (lambda (pair) (format "%s=%s;" (car pair) (org-babel-mathematica-var-to-mathematica (cdr pair)))) vars "\n") "\nPrint[\n" body "\n]\n") If anybody has idea to improve it, I will be happy to see and work it out! Best, Yi On Sat, Mar 14, 2015 at 7:09 AM John Kitchin wrote: > 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 > 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 calculate f(5). In a > MMA notebook, if I type > > > > f[x_] := x+3 > > f[5] > > > > I get the answer 8. If I try the same code in an org-mode code block, > here's what happens: > > > > #+BEGIN_SRC mathematica > > f[x_] := x+3 > > f[5] > > #+END_SRC > > > > #+RESULTS: > > : Null > > > > Am I missing something obvious here? > > > > Thanks very much. > > > > Richard Stanton > > -- > Professor John Kitchin > Doherty Hall A207F > Department of Chemical Engineering > Carnegie Mellon University > Pittsburgh, PA 15213 > 412-268-7803 > @johnkitchin > http://kitchingroup.cheme.cmu.edu > --001a11c2e5583567dc051133b105 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Dear Richard,

You can do:

#+BEGIN_SRC mathe= matica
f[x_] :=3D 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_] :=3D x+3
f[5]]
<= br>
This does not return any value. Because what it really does i= s print the value of "f[x_] :=3D x+3=C2=A0f[5]"

Here is the code:

(concat
=C2=A0 =C2=A0 =C2=A0(mapconca= t ;; define any variables
=C2=A0 =C2=A0 =C2=A0 (lambda (pair)
(fo= rmat "%s=3D%s;"
(car pair)
(org-babel-mathematica-var-to-mathem= atica (cdr pair))))
=C2=A0 =C2=A0 =C2=A0 vars "\n") &qu= ot;\nPrint[\n" body "\n]\n")

= If anybody has idea to improve it, I will be happy to see and work it out!<= /div>

Best,
Yi



On Sat, Mar 14, 2015 at 7:09 AM= John Kitchin <jkitchin@andre= w.cmu.edu> wrote:
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 = 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, s= uppose I'd like to define a function f(x) =3D x + 3, and then calculate= f(5). In a MMA notebook, if I type
>
> f[x_] :=3D x+3
> f[5]
>
> I get the answer 8. If I try the same code in an org-mode code block, = here's what happens:
>
> #+BEGIN_SRC mathematica
> f[x_] :=3D x+3
> f[5]
> #+END_SRC
>
> #+RESULTS:
> : Null
>
> Am I missing something obvious here?
>
> Thanks very much.
>
> Richard Stanton

--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitc= hingroup.cheme.cmu.edu
--001a11c2e5583567dc051133b105-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Stanton Subject: Re: Babel language support for Mathematica Date: Sun, 15 Mar 2015 10:26:48 -0700 Message-ID: <938F6CD6-C9DF-48B2-93EF-95268ABACB5D@haas.berkeley.edu> References: <0E109199-8E68-4B76-A1D9-20105FF0C1D3@haas.berkeley.edu> Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2070.6\)) Content-Type: multipart/alternative; boundary="Apple-Mail=_314F25B4-D46F-43ED-AB3E-D69511216464" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37009) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YXCJW-0001Xd-EP for emacs-orgmode@gnu.org; Sun, 15 Mar 2015 13:27:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YXCJT-0005OF-5Y for emacs-orgmode@gnu.org; Sun, 15 Mar 2015 13:26:58 -0400 Received: from mail-pd0-f181.google.com ([209.85.192.181]:33044) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YXCJS-0005O1-T3 for emacs-orgmode@gnu.org; Sun, 15 Mar 2015 13:26:55 -0400 Received: by pdnc3 with SMTP id c3so35101249pdn.0 for ; Sun, 15 Mar 2015 10:26:52 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Yi Wang Cc: emacs-orgmode@gnu.org, John Kitchin --Apple-Mail=_314F25B4-D46F-43ED-AB3E-D69511216464 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii 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_] :=3D 3*x^2+3; f[8], "\n", D[f[x],x] #+END_SRC #+RESULTS: : 195 : 6*x > On Mar 13, 2015, at 4:16 PM, Yi Wang wrote: >=20 > Dear Richard, >=20 > You can do: >=20 > #+BEGIN_SRC mathematica > f[x_] :=3D x+3; > f[5] > #+END_SRC >=20 > Here are explanations: I actually put everything in the SRC block into = a Print[...]. >=20 > So in the second example, what actually runs is >=20 > Print[f[x_] :=3D x+3 > f[5]] >=20 > This does not return any value. Because what it really does is print = the value of "f[x_] :=3D x+3 f[5]" >=20 > Here is the code: >=20 > (concat > (mapconcat ;; define any variables > (lambda (pair) > (format "%s=3D%s;" > (car pair) > (org-babel-mathematica-var-to-mathematica (cdr pair)))) > vars "\n") "\nPrint[\n" body "\n]\n") >=20 > If anybody has idea to improve it, I will be happy to see and work it = out! >=20 > Best, > Yi >=20 >=20 >=20 >=20 > On Sat, Mar 14, 2015 at 7:09 AM John Kitchin > wrote: > 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? >=20 > Richard Stanton writes: >=20 > > 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) =3D x + 3, and then calculate = f(5). In a MMA notebook, if I type > > > > f[x_] :=3D x+3 > > f[5] > > > > I get the answer 8. If I try the same code in an org-mode code = block, here's what happens: > > > > #+BEGIN_SRC mathematica > > f[x_] :=3D x+3 > > f[5] > > #+END_SRC > > > > #+RESULTS: > > : Null > > > > Am I missing something obvious here? > > > > Thanks very much. > > > > Richard Stanton >=20 > -- > Professor John Kitchin > Doherty Hall A207F > Department of Chemical Engineering > Carnegie Mellon University > Pittsburgh, PA 15213 > 412-268-7803 > @johnkitchin > http://kitchingroup.cheme.cmu.edu --Apple-Mail=_314F25B4-D46F-43ED-AB3E-D69511216464 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii 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_] :=3D 3*x^2+3;
f[8], "\n",
D[f[x],x]
#+END_SRC

#+RESULTS:
: 195
: = 6*x





On Mar 13, 2015, at 4:16 PM, Yi = Wang <tririverwangyi@gmail.com> wrote:

Dear Richard,

You can do:

#+BEGIN_SRC mathematica
f[x_] :=3D 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_] :=3D x+3
f[5]]

This does not return any value. Because what it really does = is print the value of "f[x_] :=3D x+3 f[5]"

Here = is the code:

(concat
     (mapconcat ;; define any = variables
      (lambda = (pair)
(format "%s=3D%s;"
= (car pair)
= (org-babel-mathematica-var-to-mathematica (cdr pair))))
      vars "\n") "\nPrint[\n" body = "\n]\n")

If anybody has idea to improve it, I will be happy to see and = work it out!

Best,
Yi




On Sat, Mar 14, 2015 at 7:09 AM = John Kitchin <jkitchin@andrew.cmu.edu> wrote:
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 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) =3D x + 3, and then calculate = f(5). In a MMA notebook, if I type
>
> f[x_] :=3D x+3
> f[5]
>
> I get the answer 8. If I try the same code in an org-mode code = block, here's what happens:
>
> #+BEGIN_SRC mathematica
> f[x_] :=3D x+3
> f[5]
> #+END_SRC
>
> #+RESULTS:
> : Null
>
> Am I missing something obvious here?
>
> Thanks very much.
>
> Richard Stanton

--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

= --Apple-Mail=_314F25B4-D46F-43ED-AB3E-D69511216464--