You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(3) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
|
Feb
(5) |
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
2007 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(9) |
Jun
(1) |
Jul
(1) |
Aug
(3) |
Sep
(1) |
Oct
|
Nov
(1) |
Dec
|
2009 |
Jan
|
Feb
(4) |
Mar
|
Apr
|
May
(2) |
Jun
(1) |
Jul
(7) |
Aug
(1) |
Sep
(5) |
Oct
|
Nov
(6) |
Dec
(3) |
2010 |
Jan
|
Feb
(10) |
Mar
(12) |
Apr
(13) |
May
(2) |
Jun
(4) |
Jul
(4) |
Aug
(4) |
Sep
|
Oct
(4) |
Nov
(2) |
Dec
(4) |
2011 |
Jan
(11) |
Feb
|
Mar
(18) |
Apr
|
May
(1) |
Jun
(12) |
Jul
(10) |
Aug
(4) |
Sep
(4) |
Oct
(5) |
Nov
|
Dec
(10) |
2012 |
Jan
(4) |
Feb
(26) |
Mar
|
Apr
(1) |
May
|
Jun
(8) |
Jul
(3) |
Aug
(1) |
Sep
|
Oct
(14) |
Nov
(1) |
Dec
(2) |
2013 |
Jan
(5) |
Feb
(2) |
Mar
(2) |
Apr
(5) |
May
(3) |
Jun
|
Jul
(8) |
Aug
(4) |
Sep
|
Oct
(7) |
Nov
(2) |
Dec
(7) |
2014 |
Jan
(14) |
Feb
|
Mar
(6) |
Apr
|
May
(3) |
Jun
(2) |
Jul
(4) |
Aug
(3) |
Sep
(7) |
Oct
(9) |
Nov
(9) |
Dec
(5) |
2015 |
Jan
(2) |
Feb
(1) |
Mar
|
Apr
(2) |
May
(1) |
Jun
(10) |
Jul
(3) |
Aug
(4) |
Sep
(8) |
Oct
(1) |
Nov
(3) |
Dec
(3) |
2016 |
Jan
(12) |
Feb
(59) |
Mar
(23) |
Apr
(11) |
May
(4) |
Jun
(15) |
Jul
|
Aug
|
Sep
(9) |
Oct
(19) |
Nov
(12) |
Dec
(5) |
2017 |
Jan
(1) |
Feb
(5) |
Mar
(5) |
Apr
|
May
(2) |
Jun
|
Jul
(5) |
Aug
|
Sep
(3) |
Oct
(12) |
Nov
(15) |
Dec
|
2018 |
Jan
(7) |
Feb
(6) |
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
(3) |
Aug
(2) |
Sep
(2) |
Oct
(4) |
Nov
|
Dec
|
2019 |
Jan
(2) |
Feb
(9) |
Mar
(4) |
Apr
(9) |
May
(1) |
Jun
(1) |
Jul
(1) |
Aug
(3) |
Sep
|
Oct
(2) |
Nov
(6) |
Dec
(5) |
2020 |
Jan
(9) |
Feb
|
Mar
(2) |
Apr
|
May
(1) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
(3) |
Nov
(28) |
Dec
(5) |
2021 |
Jan
(11) |
Feb
(2) |
Mar
(2) |
Apr
(2) |
May
(15) |
Jun
(9) |
Jul
(11) |
Aug
(1) |
Sep
|
Oct
(2) |
Nov
|
Dec
(3) |
2022 |
Jan
(1) |
Feb
|
Mar
|
Apr
(9) |
May
(1) |
Jun
|
Jul
(1) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2023 |
Jan
|
Feb
|
Mar
|
Apr
(12) |
May
(4) |
Jun
|
Jul
(22) |
Aug
(3) |
Sep
|
Oct
(1) |
Nov
|
Dec
(14) |
2024 |
Jan
|
Feb
|
Mar
|
Apr
(17) |
May
(35) |
Jun
(1) |
Jul
(18) |
Aug
(31) |
Sep
(5) |
Oct
(18) |
Nov
(20) |
Dec
(9) |
2025 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(1) |
Jun
(1) |
Jul
(5) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Eric L. <Eri...@ma...> - 2018-01-25 14:58:47
|
Hi Uwe, I’ve asked how to get the blog post updated so hopefully that reference will improve. I’ve poked around the SF site for a while as I’ve forgotten how to edit the web page. It’s been many years since I updated it. I’ll try to remember to do the update from home where my ssh keys are. Eric From: Hunter McClelland [mailto:hun...@gm...] Sent: Thursday, January 25, 2018 8:56 AM To: Uwe Brauer <ou...@ma...> Cc: mat...@li... Subject: Re: [Matlab-emacs-discuss] download emacs-matlab Googling "Matlab Emacs" returns at least this MathWorks blogs<https://blogs.mathworks.com/community/2009/09/14/matlab-emacs-integration-is-back/> site, which refers to this page<http://matlab-emacs.sourceforge.net/>. I think that page links to the command here<https://sourceforge.net/p/matlab-emacs/code/?source=navbar>. I thought I remembered that we moved to git, but decided to trust Google rather than search my emails. :) On Wed, Jan 24, 2018 at 4:50 PM, Uwe Brauer <ou...@ma...<mailto:ou...@ma...>> wrote: >>> "Hunter" == Hunter McClelland <hun...@gm...<mailto:hun...@gm...>> writes: > Strange... it worked for me. (Shell history copied below) Could you > describe the error you experienced in more detail? > I've also attached a copy of the .m script, you could try that. > Best, > -Hunter > $ hgm@miata:~/Sandbox/ML_emacs $ cvs -z3 > -d:pserver:anonymous@a.cvs.sourceforge.net:/cvsroot/matlab-emacs co -P > matlab-emacs Aeh this is the wrong repo. The new one on sourceforge uses git so the command to be used should be git clone git://git.code.sf.net/p/matlab-emacs/src<http://git.code.sf.net/p/matlab-emacs/src> there is even a mirror on github. And I might consider to have a mercurial mirror in bitbucket, if there is sufficient address. Please tell me where you found this outdated information. Uwe |
From: Uwe B. <ou...@ma...> - 2018-01-25 14:57:08
|
>>> "Hunter" == Hunter McClelland <hun...@gm...> >>> writes: > Googling "Matlab Emacs" returns at least this MathWorks blogs > <https://blogs.mathworks.com/community/2009/09/14/matlab-emacs-integration-is-back/> > site, which refers to this page > <http://matlab-emacs.sourceforge.net/>. I think that page links > to the command here > <https://sourceforge.net/p/matlab-emacs/code/?source=navbar>. Thanks for point it out to me. I will ask the people from mathwork, how to change that information. Uwe |
From: Hunter M. <hun...@gm...> - 2018-01-25 13:56:23
|
Googling "Matlab Emacs" returns at least this MathWorks blogs <https://blogs.mathworks.com/community/2009/09/14/matlab-emacs-integration-is-back/> site, which refers to this page <http://matlab-emacs.sourceforge.net/>. I think that page links to the command here <https://sourceforge.net/p/matlab-emacs/code/?source=navbar>. I thought I remembered that we moved to git, but decided to trust Google rather than search my emails. :) On Wed, Jan 24, 2018 at 4:50 PM, Uwe Brauer <ou...@ma...> wrote: > >>> "Hunter" == Hunter McClelland <hun...@gm...> writes: > > > Strange... it worked for me. (Shell history copied below) Could you > > describe the error you experienced in more detail? > > > I've also attached a copy of the .m script, you could try that. > > > Best, > > -Hunter > > > $ hgm@miata:~/Sandbox/ML_emacs $ cvs -z3 > > -d:pserver:anonymous@a.cvs.sourceforge.net:/cvsroot/matlab-emacs co > -P > > matlab-emacs > > Aeh this is the wrong repo. The new one on sourceforge uses git so > the command to be used should be > git clone git://git.code.sf.net/p/matlab-emacs/src > there is even a mirror on github. > > And I might consider to have a mercurial mirror in bitbucket, if there > is sufficient address. > > Please tell me where you found this outdated information. > > Uwe > |
From: Uwe B. <ou...@ma...> - 2018-01-24 22:15:19
|
>>> "Hunter" == Hunter McClelland <hun...@gm...> writes: > Strange... it worked for me. (Shell history copied below) Could you > describe the error you experienced in more detail? > I've also attached a copy of the .m script, you could try that. > Best, > -Hunter > $ hgm@miata:~/Sandbox/ML_emacs $ cvs -z3 > -d:pserver:anonymous@a.cvs.sourceforge.net:/cvsroot/matlab-emacs co -P > matlab-emacs Aeh this is the wrong repo. The new one on sourceforge uses git so the command to be used should be git clone git://git.code.sf.net/p/matlab-emacs/src there is even a mirror on github. And I might consider to have a mercurial mirror in bitbucket, if there is sufficient address. Please tell me where you found this outdated information. Uwe |
From: Liu, J. <jia...@gm...> - 2018-01-24 19:40:46
|
Hi Hunter Thanks for confirming it. I went to my network manager and found out the port was blocked by the firewall. Now it works. Best, Jiaen On Wed, Jan 24, 2018 at 2:13 PM, Hunter McClelland < hun...@gm...> wrote: > Strange... it worked for me. (Shell history copied below) Could you > describe the error you experienced in more detail? > > I've also attached a copy of the .m script, you could try that. > > Best, > -Hunter > > $ hgm@miata:~/Sandbox/ML_emacs $ cvs -z3 -d:pserver:anonymous@a.cvs. > sourceforge.net:/cvsroot/matlab-emacs co -P matlab-emacs > cvs checkout: Updating matlab-emacs > U matlab-emacs/.cvsignore > U matlab-emacs/ChangeLog > U matlab-emacs/ChangeLog.old1 > U matlab-emacs/ChangeLog.old2 > U matlab-emacs/INSTALL > U matlab-emacs/Makefile > U matlab-emacs/Project.ede > U matlab-emacs/README > U matlab-emacs/cedet-matlab.el > U matlab-emacs/company-matlab-shell.el > U matlab-emacs/dl_emacs_support.m > U matlab-emacs/linemark.el > U matlab-emacs/matlab-load.el > U matlab-emacs/matlab-publish.el > U matlab-emacs/matlab.el > U matlab-emacs/mlint.el > U matlab-emacs/semantic-matlab.el > U matlab-emacs/semanticdb-matlab.el > U matlab-emacs/srecode-matlab.el > U matlab-emacs/tlc.el > cvs checkout: Updating matlab-emacs/templates > U matlab-emacs/templates/Makefile > U matlab-emacs/templates/Project.ede > U matlab-emacs/templates/srecode-matlab.srt > cvs checkout: Updating matlab-emacs/toolbox > U matlab-emacs/toolbox/Makefile > U matlab-emacs/toolbox/Project.ede > U matlab-emacs/toolbox/emacsdocomplete.m > U matlab-emacs/toolbox/emacsinit.m > U matlab-emacs/toolbox/opentoline.m > > > > On Wed, Jan 24, 2018 at 1:42 PM, Liu, Jiaen <jia...@gm...> wrote: > >> Hi >> >> I am new to use matlab mode in emacs. I followed the link to download >> emacs-matlab by >> cvs -z3 -d:pserver:ano...@ma...:/cvsroot/matlab-emacs >> co -P matlab-emacs >> But it doesn't work. It seems the connection is broken. Could anyone let >> me know how to download the files? >> >> Thanks, >> >> Jiaen >> >> ------------------------------------------------------------ >> ------------------ >> Check out the vibrant tech community on one of the world's most >> engaging tech sites, Slashdot.org! http://sdm.link/slashdot >> _______________________________________________ >> Matlab-emacs-discuss mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matlab-emacs-discuss >> >> > |
From: Hunter M. <hun...@gm...> - 2018-01-24 19:14:20
|
Strange... it worked for me. (Shell history copied below) Could you describe the error you experienced in more detail? I've also attached a copy of the .m script, you could try that. Best, -Hunter $ hgm@miata:~/Sandbox/ML_emacs $ cvs -z3 -d:pserver:anonymous@a.cvs.sourceforge.net:/cvsroot/matlab-emacs co -P matlab-emacs cvs checkout: Updating matlab-emacs U matlab-emacs/.cvsignore U matlab-emacs/ChangeLog U matlab-emacs/ChangeLog.old1 U matlab-emacs/ChangeLog.old2 U matlab-emacs/INSTALL U matlab-emacs/Makefile U matlab-emacs/Project.ede U matlab-emacs/README U matlab-emacs/cedet-matlab.el U matlab-emacs/company-matlab-shell.el U matlab-emacs/dl_emacs_support.m U matlab-emacs/linemark.el U matlab-emacs/matlab-load.el U matlab-emacs/matlab-publish.el U matlab-emacs/matlab.el U matlab-emacs/mlint.el U matlab-emacs/semantic-matlab.el U matlab-emacs/semanticdb-matlab.el U matlab-emacs/srecode-matlab.el U matlab-emacs/tlc.el cvs checkout: Updating matlab-emacs/templates U matlab-emacs/templates/Makefile U matlab-emacs/templates/Project.ede U matlab-emacs/templates/srecode-matlab.srt cvs checkout: Updating matlab-emacs/toolbox U matlab-emacs/toolbox/Makefile U matlab-emacs/toolbox/Project.ede U matlab-emacs/toolbox/emacsdocomplete.m U matlab-emacs/toolbox/emacsinit.m U matlab-emacs/toolbox/opentoline.m On Wed, Jan 24, 2018 at 1:42 PM, Liu, Jiaen <jia...@gm...> wrote: > Hi > > I am new to use matlab mode in emacs. I followed the link to download > emacs-matlab by > cvs -z3 -d:pserver:ano...@ma...:/cvsroot/matlab-emacs > co -P matlab-emacs > But it doesn't work. It seems the connection is broken. Could anyone let > me know how to download the files? > > Thanks, > > Jiaen > > ------------------------------------------------------------ > ------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Matlab-emacs-discuss mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matlab-emacs-discuss > > |
From: Liu, J. <jia...@gm...> - 2018-01-24 18:42:25
|
Hi I am new to use matlab mode in emacs. I followed the link to download emacs-matlab by cvs -z3 -d:pserver:ano...@ma...:/cvsroot/matlab-emacs co -P matlab-emacs But it doesn't work. It seems the connection is broken. Could anyone let me know how to download the files? Thanks, Jiaen |
From: Uwe B. <ou...@ma...> - 2017-11-14 16:22:42
|
Hi After restarting emacs everything worked as expected. Maybe I am debugging too many matlab files today. So please ignore my message Uwe Brauer |
From: Uwe B. <ou...@ma...> - 2017-11-14 16:04:43
|
Hi Maybe my memory does not serve me well, but I swore it was possible, some time ago, to set a breakpoint in a matlab file which I want to debug. However right now the only thing which works is using something like this in the matlab shell >> dbstop in mieuler at 23 and then run mieuler(fun,[0 1],1,100) But I thought using gud-break at line 23 in mieuler would do the same, it does not however. Do I miss something or is this functionally gone, or do I have hallucinations? Uwe Brauer |
From: Uwe B. <ou...@ma...> - 2017-11-14 11:58:33
|
Hi For some bizarre reason I was not receiving email from that list for while, so I had to subscribe again (the system did not tell me that I am already subscribed, which is odd since I should be subscribed since several years). In any case did my message from yesterday concerning the branch proposed_changes created by John Ciolfi? I did not push Nathan's change since I am not sure what to do with that branch. I wait a day. If there is no reaction I try to contact John directly. Regards Uwe Brauer |
From: Uwe B. <ou...@ma...> - 2017-11-13 20:37:05
|
>>> "Eric" == Eric Ludlam <Eri...@ma...> writes: > Hi Uwe, > Are you not getting email from the matlab-emacs-discuss mailing list? That is odd indeed. > I'm re-attaching the diffs to this email. Hm does not work. This time patch did not refuse it outright as last time but I obtain. Hunk #1 FAILED at 24. 1 out of 1 hunk FAILED -- saving rejects to file company-matlab-shell.el.rej And similar for matlab.el Ok I see what happens (and why I hate git). In the official repos github sf The last commit is mine. Git log gives commit 3b3c48ac0c27039e0bef89c643f0ee4c0b53d3d0 Author: Uwe Brauer <ou...@ma...> Date: Fri Sep 2 11:59:06 2016 +0000 * tlc.el: Add space to ;;;###autoload(add-to-list 'auto-mode-alist '("\\.tlc$" .tlc-mode)) ^^^ thanks to John Ciolfi However in my local repos I still have three commits by John Ciolfi, namely (using hg) changeset: 167:ea809ae422ac | bookmark: proposed_changes | tag: tip | user: John Ciolfi <ci...@ma...> | date: Tue Oct 18 10:18:15 2016 -0400 | summary: Added custom completions, fixed typos | o changeset: 166:0d6ad456b544 | user: John Ciolfi <ci...@ma...> | date: Mon Oct 10 20:43:17 2016 -0400 | summary: matlab-load.el is a generated file | o changeset: 165:96cee86a0430 | user: John Ciolfi <ci...@ma...> | date: Mon Oct 10 20:39:21 2016 -0400 | summary: Fixed TAB completion, debugging updates, warning fixes which sit as I understand in the branch (bookmark in hg speach) proposed_changes. (That I would have failed to identify that these 3 commits belong to a different branch would not have happened in mercurial using named branches, but I don't want to open a flamewar). I can apply Nathan patch to master but not to the latest commit in that branch. I think I will commit and push Nathan Changes, and could merge in later John's changes from his branch. Did anybody try out the commits in this branch? I seem now to remember vaguely an email form him mentioning his changes and that he would put in a branch. I am not even sure that I tested his changes. Any thoughts before I push? I might wait a day or so more to hear opinions. Uwe |
From: Eric L. <Eri...@ma...> - 2017-11-13 19:42:02
|
Hi Uwe, Are you not getting email from the matlab-emacs-discuss mailing list? I'm re-attaching the diffs to this email. Eric -----Original Message----- From: Uwe Brauer [mailto:ou...@ma...] Sent: Monday, November 13, 2017 1:45 PM To: Eric Ludlam <Eri...@ma...> Cc: Nathaniel Chodosh <nch...@an...>; Uwe Brauer <ou...@ma...>; mat...@li... Subject: Re: [Matlab-emacs-discuss] Removing extra lines from collect-command-output >>> "Eric" == Eric Ludlam <Eri...@ma...> writes: > Thanks Nate. > Hopefully this works for Uwe for merge/test. Hi I don't see any patch attached. There are several way to produce the patch. The simplest would be diff -u old.el new.el or diff -c old.el New.el I'd prefer -u but -c should be fine. If you use mercurial :-D , you could do hg export tip Or with git :'( git format-patch HEAD~1 Uwe |
From: Uwe B. <ou...@ma...> - 2017-11-13 18:45:29
|
>>> "Eric" == Eric Ludlam <Eri...@ma...> writes: > Thanks Nate. > Hopefully this works for Uwe for merge/test. Hi I don't see any patch attached. There are several way to produce the patch. The simplest would be diff -u old.el new.el or diff -c old.el New.el I'd prefer -u but -c should be fine. If you use mercurial :-D , you could do hg export tip Or with git :'( git format-patch HEAD~1 Uwe |
From: Eric L. <Eri...@ma...> - 2017-11-13 15:32:12
|
Thanks Nate. Hopefully this works for Uwe for merge/test. Eric From: Nathaniel Chodosh [mailto:nch...@an...] Sent: Wednesday, November 08, 2017 12:56 PM To: Eric Ludlam <Eri...@ma...> Cc: mat...@li... Subject: Re: [Matlab-emacs-discuss] Removing extra lines from collect-command-output Hi, Here's the patch files, sorry I didn't know what the usual format was. You should just be able to pipe them into 'patch'. -Nate On Fri, Nov 3, 2017 at 10:41 AM Eric Ludlam <Eri...@ma...<mailto:Eri...@ma...>> wrote: Hi Nate, Could your provide a diff that provides context (a context diff) ? It isn’t clear how to merge the patch into code where the line numbers may have changed. Ideally, the diff could be intput into the ‘patch’ command. Thanks Eric From: nchodosh [mailto:nch...@an...<mailto:nch...@an...>] Sent: Tuesday, October 17, 2017 11:44 AM To: Eric Ludlam <Eri...@ma...<mailto:Eri...@ma...>>; mat...@li...<mailto:mat...@li...> Subject: Re: [Matlab-emacs-discuss] Removing extra lines from collect-command-output Hi, Sorry about the delay, I had a busy few weeks. Here's the diff for matlab.el, I also included one for company-matlab-shell.el which enables predictions while editing the middle of a line. Best, Nate On Tue, Oct 3, 2017 at 3:24 PM Eric Ludlam <Eri...@ma...<mailto:Eri...@ma...>> wrote: Ah, this is a good reminder I need to poke the source forge site to point at the new github location that Uwe is using. Start with the mailing list. I’m not sure what process would work best for Uwe. Eric From: Nathaniel Chodosh [mailto:nch...@an...<mailto:nch...@an...>] Sent: Tuesday, October 03, 2017 1:18 PM To: Eric Ludlam <Eri...@ma...<mailto:Eri...@ma...>>; mat...@li...<mailto:mat...@li...> Subject: Re: [Matlab-emacs-discuss] Removing extra lines from collect-command-output Great. I've never contributed to a sourceforge project, should I post the diff under patches? On Tue, Oct 3, 2017 at 12:59 PM Eric Ludlam <Eri...@ma...<mailto:Eri...@ma...>> wrote: Sounds reasonable to me. When you are happy with your changes, post a diff and hopefully Uwe can install it. Thanks Eric From: Nathaniel Chodosh [mailto:nch...@an...<mailto:nch...@an...>] Sent: Tuesday, October 03, 2017 12:26 PM To: Eric Ludlam <Eri...@ma...<mailto:Eri...@ma...>>; mat...@li...<mailto:mat...@li...> Subject: Re: [Matlab-emacs-discuss] Removing extra lines from collect-command-output That's what I thought the purpose of the newline is, but the documentation for comint-simple-send states that it automatically appends a newline to the command, so it's not needed. As an aside I think that in the current version of emacs the while loop in the same function needs to be wrapped in a with-local-quit to avoid raising an error (or at least the accept-process-output call does). Best, Nate On Mon, Oct 2, 2017 at 4:14 PM Eric Ludlam <Eri...@ma...<mailto:Eri...@ma...>> wrote: I wrote that a long time ago, but my vague recollection is that the newline was needed to make the subprocess execute the command. Is it adding a 2nd newline to the end of ‘command’ resulting in the spare line? Eric From: Nathaniel Chodosh [mailto:nch...@an...<mailto:nch...@an...>] Sent: Monday, October 02, 2017 1:27 PM To: mat...@li...<mailto:mat...@li...> Subject: [Matlab-emacs-discuss] Removing extra lines from collect-command-output Hello, I've noticed that calling 'matlab-shell-collect-command-output' can result in extra new lines being sent to the *MATLAB* buffer which aren't deleted. When using company-mode to complete text this behavior is pretty annoying since as I'm typing lines are being inserted above the prompt. I believe that the cause of this is the line: (comint-simple-send (get-buffer-process (current-buffer)) (concat command "\n")) The newline added to the end of the command causes an extra line to be printed since it's interpreted as execute 'command' and then send a newline. Removing the newline fixes the problem. This seems like a suspiciously simple fix so I'm wondering why the newline was being appended to the command. Thanks, Nate P.S I am new to using mailing lists so if I've committed any faux pas in this email please let me know |
From: Nathaniel C. <nch...@an...> - 2017-11-08 18:19:54
|
Hi, Here's the patch files, sorry I didn't know what the usual format was. You should just be able to pipe them into 'patch'. -Nate On Fri, Nov 3, 2017 at 10:41 AM Eric Ludlam <Eri...@ma...> wrote: > Hi Nate, > > > > Could your provide a diff that provides context (a context diff) ? It > isn’t clear how to merge the patch into code where the line numbers may > have changed. Ideally, the diff could be intput into the ‘patch’ command. > > > > Thanks > > Eric > > > > *From:* nchodosh [mailto:nch...@an...] > *Sent:* Tuesday, October 17, 2017 11:44 AM > > > *To:* Eric Ludlam <Eri...@ma...>; > mat...@li... > *Subject:* Re: [Matlab-emacs-discuss] Removing extra lines from > collect-command-output > > > > Hi, > > > > Sorry about the delay, I had a busy few weeks. Here's the diff for > matlab.el, I also included one for company-matlab-shell.el which enables > predictions while editing the middle of a line. > > > > Best, > > Nate > > > > On Tue, Oct 3, 2017 at 3:24 PM Eric Ludlam <Eri...@ma...> > wrote: > > Ah, this is a good reminder I need to poke the source forge site to point > at the new github location that Uwe is using. > > > > Start with the mailing list. I’m not sure what process would work best > for Uwe. > > > > Eric > > > > *From:* Nathaniel Chodosh [mailto:nch...@an...] > > *Sent:* Tuesday, October 03, 2017 1:18 PM > > > *To:* Eric Ludlam <Eri...@ma...>; > mat...@li... > *Subject:* Re: [Matlab-emacs-discuss] Removing extra lines from > collect-command-output > > > > Great. I've never contributed to a sourceforge project, should I post the > diff under patches? > > > > On Tue, Oct 3, 2017 at 12:59 PM Eric Ludlam <Eri...@ma...> > wrote: > > Sounds reasonable to me. > > > > When you are happy with your changes, post a diff and hopefully Uwe can > install it. > > > > Thanks > > Eric > > > > *From:* Nathaniel Chodosh [mailto:nch...@an...] > > *Sent:* Tuesday, October 03, 2017 12:26 PM > *To:* Eric Ludlam <Eri...@ma...>; > mat...@li... > *Subject:* Re: [Matlab-emacs-discuss] Removing extra lines from > collect-command-output > > > > That's what I thought the purpose of the newline is, but the documentation > for comint-simple-send states that it automatically appends a newline to > the command, so it's not needed. > > As an aside I think that in the current version of emacs the while loop in > the same function needs to be wrapped in a with-local-quit to avoid raising > an error (or at least the accept-process-output call does). > > Best, > > Nate > > > > On Mon, Oct 2, 2017 at 4:14 PM Eric Ludlam <Eri...@ma...> > wrote: > > I wrote that a long time ago, but my vague recollection is that the > newline was needed to make the subprocess execute the command. Is it > adding a 2nd newline to the end of ‘command’ resulting in the spare line? > > > > Eric > > > > *From:* Nathaniel Chodosh [mailto:nch...@an...] > *Sent:* Monday, October 02, 2017 1:27 PM > *To:* mat...@li... > *Subject:* [Matlab-emacs-discuss] Removing extra lines from > collect-command-output > > > > Hello, > > I've noticed that calling 'matlab-shell-collect-command-output' can result > in extra new lines being sent to the *MATLAB* buffer which aren't deleted. > When using company-mode to complete text this behavior is pretty annoying > since as I'm typing lines are being inserted above the prompt. I believe > that the cause of this is the line: > (comint-simple-send (get-buffer-process (current-buffer)) > > (concat command "\n")) > > The newline added to the end of the command causes an extra line to be > printed since it's interpreted as execute 'command' and then send a > newline. Removing the newline fixes the problem. > > This seems like a suspiciously simple fix so I'm wondering why the newline > was being appended to the command. > > Thanks, > > Nate > > P.S I am new to using mailing lists so if I've committed any faux pas in > this email please let me know > > |
From: Uwe B. <ou...@ma...> - 2017-11-06 18:07:21
|
>>> "Eric" == Eric Ludlam <Eri...@ma...> writes: > It looks like an echoing feature is turned on, where input into ML is > echo'd back out again. There's a variable for describing what ML does > since the echo depends on platform or some-such. I think it's been 't' > for a long time. Hm thanks I checked and set (setq matlab-shell-echoes nil) It does not change #+begin_src matlab :results output latex :exports results :eval never-export f=@(t,y)[-t*y^2]; [t,y]=ode45(f,[0 1],1); t=[t(1),t(end)]; y=[y(1),y(end)]; disp('\begin{align*}') fprintf('t = [%g \\qquad %g \\quad %g] \\\\\n', t) fprintf('y = [%g \\qquad %g \\qquad %g] \n', y) disp('\end{align*}') #+end_src Results in #+RESULTS: #+BEGIN_EXPORT latex >> f=@(t,y)[-t*y^2]; >> [t,y]=ode45(f,[0 1],1); >> t=[t(1),t(end)]; >> y=[y(1),y(end)]; >> disp('\begin{align*}') \begin{align*} >> fprintf('t = [%g \\qquad %g \\quad %g] \\\\\n', t) t = [0 \qquad 1 \quad >> fprintf('y = [%g \\qquad %g \\qquad %g] \n', y) y = [1 \qquad 0.666667 \qquad >> disp('\end{align*}') \end{align*} #+END_EXPORT However I wrote a trivial cleaning function which just deletes the lines starting with >> and I obtain the following #+RESULTS: #+BEGIN_EXPORT latex \begin{align*} t = [0 \qquad 1 \quad >> fprintf('y = [%g \\qquad %g \\qquad %g] \n', y) y = [1 \qquad 0.666667 \qquad >> disp('\end{align*}') \end{align*} #+END_EXPORT Which is precisely what I want. I am not able to combine the cleaning function with the new org-babel-execute:matlab-shell Function because (matlab-shell-collect-command-output code))) Returns >> y=[0 5]\n>> Etc so everything is in one line (with \n) that results when inserted in newlines of course but running the cleaning function (flush-lines "^>>" nil nil t)) would delete everything For me this solution is ok but if somebody comes up with a better solution, please go ahead, the 2 new functions are (defun org-babel-execute:matlab-shell (body params) (interactive "P") (let* ((current-file (buffer-file-name)) (code (org-element-property :value (org-element-context))) (result-params (cdr (assoc :result-params params)))) (let ((results (matlab-shell-collect-command-output code))) (org-babel-result-cond result-params results)))) (defun clean-org-matlab-region-output () (interactive) (flush-lines "^>>" nil nil t)) But this is anyhow more relevant for org mode users. I brought up the issue on their mailing list as well but there was not much interest. Uwe |
From: Eric L. <Eri...@ma...> - 2017-11-06 17:49:50
|
It looks like an echoing feature is turned on, where input into ML is echo'd back out again. There's a variable for describing what ML does since the echo depends on platform or some-such. I think it's been 't' for a long time. Maybe in your cleaned code, put all the code on one line with no CRs, and sub in a , when there is no line ending. Then you could clean out the input code. Alternately, put it into a tmp file as before, and run that, and clean out the name of the tmp command. I don't have a Linux box to test my MATLABs on to fiddle around with echo features. Sorry. Eric From: Uwe Brauer [mailto:ou...@ma...] Sent: Saturday, November 04, 2017 11:35 AM To: Eric Ludlam <Eri...@ma...> Cc: matlab-emacs-discuss <mat...@li...> Subject: almost doneRe: [Matlab-emacs-discuss] executing matlab in org mode files (using the matlab-shell) On 11/03/2017 03:47 PM, Eric Ludlam wrote: Ah, sorry I can't be more help. It has been many years since I worked on that code, and I don't use Emacs much anymore. There are accommodations in the function's I referenced for the ML command line to make sure it doesn't interrupting anything a user might be typing in that would be important for your use case. Ok fair enough. I think I made some progress but still have a small problem, maybe you might remember and help. :-D John's code consists of: - cleaning the matlab code in orgmode mode: (font lock stuff etc) and collect it. - create a temporally file and insert the clean matlab commands. - run a external matlab process via "/usr/local/bin/matlab " "-nodesktop <" m-file - clean the result and insert it in the original buffer. So my solution is to use the matlab-shell-collect-command-output function. So my code is: - cleaning the matlab code in orgmode mode: (font lock stuff etc) and collect it. - run (matlab-shell-collect-command-output code) where code corresponds to the clean code from step one which John inserts in temp buffer. - clean the result and insert it in the original buffer. The only problem is that the output of the /usr/local/bin/matlab -nodesktop < m-file And (matlab-shell-collect-command-output code) is slightly different. Take the following example. f=@(t,y)[-t*y^2]; [t,y]=ode45(f,[0 1],1); t=[t(1),t(end)]; y=[y(1),y(end)]; disp('\begin{align*}') fprintf('t = [%g \\quad<file://quad> %g] \\\\\n<file://n>', t) fprintf('y = [%g \\qquad<file://qquad> %g] \n', y) disp('\end{align*}') The external matlab command does not include the fprintf in his output. I have collected the output of both approaches including the result of the cleaning function. So there are two possibilities. - Modify matlab-shell-collect-command-output so that it behaves closer to /usr/local/bin/matlab -nodesktop < m-file - modify the cleaning function (which I don't understand but could ask John about it). (when results ;; strip out >> (setq results (replace-regexp-in-string ">> " "" results)) ;; remove first 10 lines that are the header. (setq results (mapconcat 'identity (nthcdr 10 (split-string results "\n")) "\n"))) Any comment is more than welcome. Here is the output of both commands Uwe 1 Matlab and the cleaning 1.1 Result Matlab (John) Result: "\n< M A T L A B (R) >\nCopyright 1984-2012 The MathWorks, Inc.\nR2012a (7.14.0.739) 32-bit (glnx86)\nFebruary 9, 2012\n\n\nToget started, type one of these: helpwin, helpdesk, or demo.\nForproduct information, visit www.mathworks.com.\n\n<http://www.mathworks.com./n/n>>> >> >> >> >> \\begin{align*}\n<file://begin%7balign*%7d/n>>> t = [0 \\quad1<file://quad1>] \\\\\n<file://n>>> y = [1 \\qquad0.666667<file://qquad0.666667>] \n>> \\end{align*}\n<file://end%7balign*%7d/n>>> " Stop [2 times] Result: "\n< M A T L A B (R) >\nCopyright 1984-2012 The MathWorks, Inc.\nR2012a (7.14.0.739) 32-bit (glnx86)\nFebruary 9, 2012\n\n\nToget started, type one of these: helpwin, helpdesk, or demo.\nForproduct information, visit www.mathworks.com.\n\n<http://www.mathworks.com./n/n>>> >> >> >> >> \\begin{align*}\n<file://begin%7balign*%7d/n>>> t = [0 \\quad1<file://quad1>] \\\\\n<file://n>>> y = [1 \\qquad0.666667<file://qquad0.666667>] \n>> \\end{align*}\n<file://end%7balign*%7d/n>>> " [3 times] Result: "\n< M A T L A B (R) >\nCopyright 1984-2012 The MathWorks, Inc.\nR2012a (7.14.0.739) 32-bit (glnx86)\nFebruary 9, 2012\n\n\nToget started, type one of these: helpwin, helpdesk, or demo.\nForproduct information, visit www.mathworks.com.\n\n<http://www.mathworks.com./n/n>>> >> >> >> >> \\begin{align*}\n<file://begin%7balign*%7d/n>>> t = [0 \\quad1<file://quad1>] \\\\\n<file://n>>> y = [1 \\qquad0.666667<file://qquad0.666667>] \n>> \\end{align*}\n<file://end%7balign*%7d/n>>> " Result: "\n< M A T L A B (R) >\nCopyright 1984-2012 The MathWorks, Inc.\nR2012a (7.14.0.739) 32-bit (glnx86)\nFebruary 9, 2012\n\n\nToget started, type one of these: helpwin, helpdesk, or demo.\nForproduct information, visit www.mathworks.com.\n\n\\begin<http://www.mathworks.com./n/n/begin>{align*}\nt= [0 \\quad1<file://quad1>] \\\\\ny<file://ny>= [1 \\qquad0.666667<file://qquad0.666667>] \n\\end{align*}\n" Result: "\n< M A T L A B (R) >\nCopyright 1984-2012 The MathWorks, Inc.\nR2012a (7.14.0.739) 32-bit (glnx86)\nFebruary 9, 2012\n\n\nToget started, type one of these: helpwin, helpdesk, or demo.\nForproduct information, visit www.mathworks.com.\n\n\\begin<http://www.mathworks.com./n/n/begin>{align*}\nt= [0 \\quad1<file://quad1>] \\\\\ny<file://ny>= [1 \\qquad0.666667<file://qquad0.666667>] \n\\end{align*}\n" [5 times] Result: "\n< M A T L A B (R) >\nCopyright 1984-2012 The MathWorks, Inc.\nR2012a (7.14.0.739) 32-bit (glnx86)\nFebruary 9, 2012\n\n\nToget started, type one of these: helpwin, helpdesk, or demo.\nForproduct information, visit www.mathworks.com.\n\n\\begin<http://www.mathworks.com./n/n/begin>{align*}\nt= [0 \\quad1<file://quad1>] \\\\\ny<file://ny>= [1 \\qquad0.666667<file://qquad0.666667>] \n\\end{align*}\n" Result: (#1="" " < M A T L A B (R) >" " Copyright 1984-2012 The MathWorks, Inc." " R2012a (7.14.0.739) 32-bit (glnx86)" " February 9, 2012" #1# " " "To get started, type one of these: helpwin, helpdesk, or demo." "For product information, visit www.mathworks.com<http://www.mathworks.com>." " " "\\begin{align*}<file://begin%7balign*%7d>" "t = [0 \\quad1<file://quad1>] \\\\" "y = [1 \\qquad0.666667<file://qquad0.666667>] " "\\end{align*}<file://end%7balign*%7d>" #1#) 1.2 Result cleaning (John) Result: ("\\begin{align*}<file://begin%7balign*%7d>" "t = [0 \\quad1<file://quad1>] \\\\" "y = [1 \\qquad0.666667<file://qquad0.666667>] " "\\end{align*}<file://end%7balign*%7d>" "") Result: "\\begin{align*}\nt= [0 \\quad1] \\\\\ny= [1 \\qquad0.666667] \n\\end{align*}\n<file://begin%7balign*%7d/nt=%20%5b0%20/quad1%5d%20/ny=%20%5b1%20/qquad0.666667%5d%20/n/end%7balign*%7d/n>" Result: "\\begin{align*}\nt= [0 \\quad1] \\\\\ny= [1 \\qquad0.666667] \n\\end{align*}\n<file://begin%7balign*%7d/nt=%20%5b0%20/quad1%5d%20/ny=%20%5b1%20/qquad0.666667%5d%20/n/end%7balign*%7d/n>" Result: "\\begin{align*}\nt= [0 \\quad1] \\\\\ny= [1 \\qquad0.666667] \n\\end{align*}\n<file://begin%7balign*%7d/nt=%20%5b0%20/quad1%5d%20/ny=%20%5b1%20/qquad0.666667%5d%20/n/end%7balign*%7d/n>" [2 times] Result: ("replace" "output" "latex") Result: "\\begin{align*}\nt= [0 \\quad1] \\\\\ny= [1 \\qquad0.666667] \n\\end{align*}\n<file://begin%7balign*%7d/nt=%20%5b0%20/quad1%5d%20/ny=%20%5b1%20/qquad0.666667%5d%20/n/end%7balign*%7d/n>" Result: "\\begin{align*}\nt= [0 \\quad1] \\\\\ny= [1 \\qquad0.666667] \n\\end{align*}\n<file://begin%7balign*%7d/nt=%20%5b0%20/quad1%5d%20/ny=%20%5b1%20/qquad0.666667%5d%20/n/end%7balign*%7d/n>" Result: "\\begin{align*}\nt= [0 \\quad1] \\\\\ny= [1 \\qquad0.666667] \n\\end{align*}\n<file://begin%7balign*%7d/nt=%20%5b0%20/quad1%5d%20/ny=%20%5b1%20/qquad0.666667%5d%20/n/end%7balign*%7d/n>" Result: "\\begin{align*}\nt= [0 \\quad1] \\\\\ny= [1 \\qquad0.666667] \n\\end{align*}\n<file://begin%7balign*%7d/nt=%20%5b0%20/quad1%5d%20/ny=%20%5b1%20/qquad0.666667%5d%20/n/end%7balign*%7d/n>" 1.3 Result Matlab (Shell) Result: "f=@(t,y)[-t*y2];\n[t,y]=ode45(f,[0 1],1);\nt=[t(1),t(end)];\ny=[y(1),y(end)];\ndisp('\\begin{align*}')\nfprintf('t = [%g \\\\quad%g] \\\\\\\\\\n', t)\nfprintf('y = [%g \\\\qquad%g] \\n', y)\ndisp('\\end{align*}')\n" Result: ">> [t,y]=ode45(f,[0 1],1);\n>> t=[t(1),t(end)];\n>> y=[y(1),y(end)];\n>> disp('\\begin{align*}')\n\\begin{align*}\n>> fprintf('t = [%g \\\\quad%g<file://quad%25g>] \\\\\\\\\\n<file://n>', t)\nt= [0 \\quad1<file://quad1>] \\\\\n<file://n>>> fprintf('y = [%g \\\\qquad%g<file://qquad%25g>] \\n<file://n>', y)\ny= [1 \\qquad0.666667<file://qquad0.666667>] \n>> disp('\\end{align*}')\n\\end{align*}\n>> \n>> \n" [2 times] Result: ">> [t,y]=ode45(f,[0 1],1);\n>> t=[t(1),t(end)];\n>> y=[y(1),y(end)];\n>> disp('\\begin{align*}')\n\\begin{align*}\n>> fprintf('t = [%g \\\\quad%g<file://quad%25g>] \\\\\\\\\\n<file://n>', t)\nt= [0 \\quad1<file://quad1>] \\\\\n<file://n>>> fprintf('y = [%g \\\\qquad%g<file://qquad%25g>] \\n<file://n>', y)\ny= [1 \\qquad0.666667<file://qquad0.666667>] \n>> disp('\\end{align*}')\n\\end{align*}\n>> \n>> \n" [3 times] Result: ">> [t,y]=ode45(f,[0 1],1);\n>> t=[t(1),t(end)];\n>> y=[y(1),y(end)];\n>> disp('\\begin{align*}')\n\\begin{align*}\n>> fprintf('t = [%g \\\\quad%g<file://quad%25g>] \\\\\\\\\\n<file://n>', t)\nt= [0 \\quad1<file://quad1>] \\\\\n<file://n>>> fprintf('y = [%g \\\\qquad%g<file://qquad%25g>] \\n<file://n>', y)\ny= [1 \\qquad0.666667<file://qquad0.666667>] \n>> disp('\\end{align*}')\n\\end{align*}\n>> \n>> \n" Result: "[t,y]=ode45(f,[0 1],1);\nt=[t(1),t(end)];\ny=[y(1),y(end)];\ndisp('\\begin{align*}')\n\\begin{align*}\nfprintf('t = [%g \\\\quad%g<file://quad%25g>] \\\\\\\\\\n<file://n>', t)\nt= [0 \\quad1<file://quad1>] \\\\\nfprintf('y<file://nfprintf('y> = [%g \\\\qquad%g<file://qquad%25g>] \\n<file://n>', y)\ny= [1 \\qquad0.666667<file://qquad0.666667>] \ndisp('\\end{align*}')\n\\end{align*}\n\n\n" Result: "[t,y]=ode45(f,[0 1],1);\nt=[t(1),t(end)];\ny=[y(1),y(end)];\ndisp('\\begin{align*}')\n\\begin{align*}\nfprintf('t = [%g \\\\quad%g<file://quad%25g>] \\\\\\\\\\n<file://n>', t)\nt= [0 \\quad1<file://quad1>] \\\\\nfprintf('y<file://nfprintf('y> = [%g \\\\qquad%g<file://qquad%25g>] \\n<file://n>', y)\ny= [1 \\qquad0.666667<file://qquad0.666667>] \ndisp('\\end{align*}')\n\\end{align*}\n\n\n" [5 times] Result: "[t,y]=ode45(f,[0 1],1);\nt=[t(1),t(end)];\ny=[y(1),y(end)];\ndisp('\\begin{align*}')\n\\begin{align*}\nfprintf('t = [%g \\\\quad%g<file://quad%25g>] \\\\\\\\\\n<file://n>', t)\nt= [0 \\quad1<file://quad1>] \\\\\nfprintf('y<file://nfprintf('y> = [%g \\\\qquad%g<file://qquad%25g>] \\n<file://n>', y)\ny= [1 \\qquad0.666667<file://qquad0.666667>] \ndisp('\\end{align*}')\n\\end{align*}\n\n\n" Result: ("[t,y]=ode45(f,[0 1],1);" "t=[t(1),t(end)];" "y=[y(1),y(end)];" "disp('\\begin{align*}')" "\\begin{align*}<file://begin%7balign*%7d>" "fprintf('t = [%g \\\\quad%g<file://quad%25g>] \\\\\\\\\\n<file://n>', t)" "t = [0 \\quad1<file://quad1>] \\\\" "fprintf('y = [%g \\\\qquad%g<file://qquad%25g>] \\n<file://n>', y)" "y = [1 \\qquad0.666667<file://qquad0.666667>] " "disp('\\end{align*}')" "\\end{align*}<file://end%7balign*%7d>" #1="" #1# #1#) 1.4 Result cleaning Result: ("t=[t(1),t(end)];" "y=[y(1),y(end)];" "disp('\\begin{align*}')" "\\begin{align*}<file://begin%7balign*%7d>" "fprintf('t = [%g \\\\quad%g<file://quad%25g>] \\\\\\\\\\n<file://n>', t)" "t = [0 \\quad1<file://quad1>] \\\\" "fprintf('y = [%g \\\\qquad%g<file://qquad%25g>] \\n<file://n>', y)" "y = [1 \\qquad0.666667<file://qquad0.666667>] " "disp('\\end{align*}')" "\\end{align*}<file://end%7balign*%7d>" #1="" #1# #1#) Result: "t=[t(1),t(end)];\ny=[y(1),y(end)];\ndisp('\\begin{align*}')\n\\begin{align*}\nfprintf('t = [%g \\\\quad%g<file://quad%25g>] \\\\\\\\\\n<file://n>', t)\nt= [0 \\quad1<file://quad1>] \\\\\nfprintf('y<file://nfprintf('y> = [%g \\\\qquad%g<file://qquad%25g>] \\n<file://n>', y)\ny= [1 \\qquad0.666667<file://qquad0.666667>] \ndisp('\\end{align*}')\n\\end{align*}\n\n\n" Result: "t=[t(1),t(end)];\ny=[y(1),y(end)];\ndisp('\\begin{align*}')\n\\begin{align*}\nfprintf('t = [%g \\\\quad%g<file://quad%25g>] \\\\\\\\\\n<file://n>', t)\nt= [0 \\quad1<file://quad1>] \\\\\nfprintf('y<file://nfprintf('y> = [%g \\\\qquad%g<file://qquad%25g>] \\n<file://n>', y)\ny= [1 \\qquad0.666667<file://qquad0.666667>] \ndisp('\\end{align*}')\n\\end{align*}\n\n\n" Result: "t=[t(1),t(end)];\ny=[y(1),y(end)];\ndisp('\\begin{align*}')\n\\begin{align*}\nfprintf('t = [%g \\\\quad%g<file://quad%25g>] \\\\\\\\\\n<file://n>', t)\nt= [0 \\quad1<file://quad1>] \\\\\nfprintf('y<file://nfprintf('y> = [%g \\\\qquad%g<file://qquad%25g>] \\n<file://n>', y)\ny= [1 \\qquad0.666667<file://qquad0.666667>] \ndisp('\\end{align*}')\n\\end{align*}\n\n\n" Created: 2017-11-04 Sat 15:26 Validate<http://validator.w3.org/check?uri=referer> 1 Matlab and the cleaning 1.1 Result Matlab (John) Result: "\n< M A T L A B (R) >\nCopyright 1984-2012 The MathWorks, Inc.\nR2012a (7.14.0.739) 32-bit (glnx86)\nFebruary 9, 2012\n\n\nToget started, type one of these: helpwin, helpdesk, or demo.\nForproduct information, visit www.mathworks.com.\n\n<http://www.mathworks.com./n/n>>> >> >> >> >> \\begin{align*}\n<file://begin%7balign*%7d/n>>> t = [0 \\quad1<file://quad1>] \\\\\n<file://n>>> y = [1 \\qquad0.666667<file://qquad0.666667>] \n>> \\end{align*}\n<file://end%7balign*%7d/n>>> " Stop [2 times] Result: "\n< M A T L A B (R) >\nCopyright 1984-2012 The MathWorks, Inc.\nR2012a (7.14.0.739) 32-bit (glnx86)\nFebruary 9, 2012\n\n\nToget started, type one of these: helpwin, helpdesk, or demo.\nForproduct information, visit www.mathworks.com.\n\n<http://www.mathworks.com./n/n>>> >> >> >> >> \\begin{align*}\n<file://begin%7balign*%7d/n>>> t = [0 \\quad1<file://quad1>] \\\\\n<file://n>>> y = [1 \\qquad0.666667<file://qquad0.666667>] \n>> \\end{align*}\n<file://end%7balign*%7d/n>>> " [3 times] Result: "\n< M A T L A B (R) >\nCopyright 1984-2012 The MathWorks, Inc.\nR2012a (7.14.0.739) 32-bit (glnx86)\nFebruary 9, 2012\n\n\nToget started, type one of these: helpwin, helpdesk, or demo.\nForproduct information, visit www.mathworks.com.\n\n<http://www.mathworks.com./n/n>>> >> >> >> >> \\begin{align*}\n<file://begin%7balign*%7d/n>>> t = [0 \\quad1<file://quad1>] \\\\\n<file://n>>> y = [1 \\qquad0.666667<file://qquad0.666667>] \n>> \\end{align*}\n<file://end%7balign*%7d/n>>> " Result: "\n< M A T L A B (R) >\nCopyright 1984-2012 The MathWorks, Inc.\nR2012a (7.14.0.739) 32-bit (glnx86)\nFebruary 9, 2012\n\n\nToget started, type one of these: helpwin, helpdesk, or demo.\nForproduct information, visit www.mathworks.com.\n\n\\begin<http://www.mathworks.com./n/n/begin>{align*}\nt= [0 \\quad1<file://quad1>] \\\\\ny<file://ny>= [1 \\qquad0.666667<file://qquad0.666667>] \n\\end{align*}\n" Result: "\n< M A T L A B (R) >\nCopyright 1984-2012 The MathWorks, Inc.\nR2012a (7.14.0.739) 32-bit (glnx86)\nFebruary 9, 2012\n\n\nToget started, type one of these: helpwin, helpdesk, or demo.\nForproduct information, visit www.mathworks.com.\n\n\\begin<http://www.mathworks.com./n/n/begin>{align*}\nt= [0 \\quad1<file://quad1>] \\\\\ny<file://ny>= [1 \\qquad0.666667<file://qquad0.666667>] \n\\end{align*}\n" [5 times] Result: "\n< M A T L A B (R) >\nCopyright 1984-2012 The MathWorks, Inc.\nR2012a (7.14.0.739) 32-bit (glnx86)\nFebruary 9, 2012\n\n\nToget started, type one of these: helpwin, helpdesk, or demo.\nForproduct information, visit www.mathworks.com.\n\n\\begin<http://www.mathworks.com./n/n/begin>{align*}\nt= [0 \\quad1<file://quad1>] \\\\\ny<file://ny>= [1 \\qquad0.666667<file://qquad0.666667>] \n\\end{align*}\n" Result: (#1="" " < M A T L A B (R) >" " Copyright 1984-2012 The MathWorks, Inc." " R2012a (7.14.0.739) 32-bit (glnx86)" " February 9, 2012" #1# " " "To get started, type one of these: helpwin, helpdesk, or demo." "For product information, visit www.mathworks.com<http://www.mathworks.com>." " " "\\begin{align*}<file://begin%7balign*%7d>" "t = [0 \\quad1<file://quad1>] \\\\" "y = [1 \\qquad0.666667<file://qquad0.666667>] " "\\end{align*}<file://end%7balign*%7d>" #1#) 1.2 Result cleaning (John) Result: ("\\begin{align*}<file://begin%7balign*%7d>" "t = [0 \\quad1<file://quad1>] \\\\" "y = [1 \\qquad0.666667<file://qquad0.666667>] " "\\end{align*}<file://end%7balign*%7d>" "") Result: "\\begin{align*}\nt= [0 \\quad1] \\\\\ny= [1 \\qquad0.666667] \n\\end{align*}\n<file://begin%7balign*%7d/nt=%20%5b0%20/quad1%5d%20/ny=%20%5b1%20/qquad0.666667%5d%20/n/end%7balign*%7d/n>" Result: "\\begin{align*}\nt= [0 \\quad1] \\\\\ny= [1 \\qquad0.666667] \n\\end{align*}\n<file://begin%7balign*%7d/nt=%20%5b0%20/quad1%5d%20/ny=%20%5b1%20/qquad0.666667%5d%20/n/end%7balign*%7d/n>" Result: "\\begin{align*}\nt= [0 \\quad1] \\\\\ny= [1 \\qquad0.666667] \n\\end{align*}\n<file://begin%7balign*%7d/nt=%20%5b0%20/quad1%5d%20/ny=%20%5b1%20/qquad0.666667%5d%20/n/end%7balign*%7d/n>" [2 times] Result: ("replace" "output" "latex") Result: "\\begin{align*}\nt= [0 \\quad1] \\\\\ny= [1 \\qquad0.666667] \n\\end{align*}\n<file://begin%7balign*%7d/nt=%20%5b0%20/quad1%5d%20/ny=%20%5b1%20/qquad0.666667%5d%20/n/end%7balign*%7d/n>" Result: "\\begin{align*}\nt= [0 \\quad1] \\\\\ny= [1 \\qquad0.666667] \n\\end{align*}\n<file://begin%7balign*%7d/nt=%20%5b0%20/quad1%5d%20/ny=%20%5b1%20/qquad0.666667%5d%20/n/end%7balign*%7d/n>" Result: "\\begin{align*}\nt= [0 \\quad1] \\\\\ny= [1 \\qquad0.666667] \n\\end{align*}\n<file://begin%7balign*%7d/nt=%20%5b0%20/quad1%5d%20/ny=%20%5b1%20/qquad0.666667%5d%20/n/end%7balign*%7d/n>" Result: "\\begin{align*}\nt= [0 \\quad1] \\\\\ny= [1 \\qquad0.666667] \n\\end{align*}\n<file://begin%7balign*%7d/nt=%20%5b0%20/quad1%5d%20/ny=%20%5b1%20/qquad0.666667%5d%20/n/end%7balign*%7d/n>" 1.3 Result Matlab (Shell) Result: "f=@(t,y)[-t*y2];\n[t,y]=ode45(f,[0 1],1);\nt=[t(1),t(end)];\ny=[y(1),y(end)];\ndisp('\\begin{align*}')\nfprintf('t = [%g \\\\quad%g] \\\\\\\\\\n', t)\nfprintf('y = [%g \\\\qquad%g] \\n', y)\ndisp('\\end{align*}')\n" Result: ">> [t,y]=ode45(f,[0 1],1);\n>> t=[t(1),t(end)];\n>> y=[y(1),y(end)];\n>> disp('\\begin{align*}')\n\\begin{align*}\n>> fprintf('t = [%g \\\\quad%g<file://quad%25g>] \\\\\\\\\\n<file://n>', t)\nt= [0 \\quad1<file://quad1>] \\\\\n<file://n>>> fprintf('y = [%g \\\\qquad%g<file://qquad%25g>] \\n<file://n>', y)\ny= [1 \\qquad0.666667<file://qquad0.666667>] \n>> disp('\\end{align*}')\n\\end{align*}\n>> \n>> \n" [2 times] Result: ">> [t,y]=ode45(f,[0 1],1);\n>> t=[t(1),t(end)];\n>> y=[y(1),y(end)];\n>> disp('\\begin{align*}')\n\\begin{align*}\n>> fprintf('t = [%g \\\\quad%g<file://quad%25g>] \\\\\\\\\\n<file://n>', t)\nt= [0 \\quad1<file://quad1>] \\\\\n<file://n>>> fprintf('y = [%g \\\\qquad%g<file://qquad%25g>] \\n<file://n>', y)\ny= [1 \\qquad0.666667<file://qquad0.666667>] \n>> disp('\\end{align*}')\n\\end{align*}\n>> \n>> \n" [3 times] Result: ">> [t,y]=ode45(f,[0 1],1);\n>> t=[t(1),t(end)];\n>> y=[y(1),y(end)];\n>> disp('\\begin{align*}')\n\\begin{align*}\n>> fprintf('t = [%g \\\\quad%g<file://quad%25g>] \\\\\\\\\\n<file://n>', t)\nt= [0 \\quad1<file://quad1>] \\\\\n<file://n>>> fprintf('y = [%g \\\\qquad%g<file://qquad%25g>] \\n<file://n>', y)\ny= [1 \\qquad0.666667<file://qquad0.666667>] \n>> disp('\\end{align*}')\n\\end{align*}\n>> \n>> \n" Result: "[t,y]=ode45(f,[0 1],1);\nt=[t(1),t(end)];\ny=[y(1),y(end)];\ndisp('\\begin{align*}')\n\\begin{align*}\nfprintf('t = [%g \\\\quad%g<file://quad%25g>] \\\\\\\\\\n<file://n>', t)\nt= [0 \\quad1<file://quad1>] \\\\\nfprintf('y<file://nfprintf('y> = [%g \\\\qquad%g<file://qquad%25g>] \\n<file://n>', y)\ny= [1 \\qquad0.666667<file://qquad0.666667>] \ndisp('\\end{align*}')\n\\end{align*}\n\n\n" Result: "[t,y]=ode45(f,[0 1],1);\nt=[t(1),t(end)];\ny=[y(1),y(end)];\ndisp('\\begin{align*}')\n\\begin{align*}\nfprintf('t = [%g \\\\quad%g<file://quad%25g>] \\\\\\\\\\n<file://n>', t)\nt= [0 \\quad1<file://quad1>] \\\\\nfprintf('y<file://nfprintf('y> = [%g \\\\qquad%g<file://qquad%25g>] \\n<file://n>', y)\ny= [1 \\qquad0.666667<file://qquad0.666667>] \ndisp('\\end{align*}')\n\\end{align*}\n\n\n" [5 times] Result: "[t,y]=ode45(f,[0 1],1);\nt=[t(1),t(end)];\ny=[y(1),y(end)];\ndisp('\\begin{align*}')\n\\begin{align*}\nfprintf('t = [%g \\\\quad%g<file://quad%25g>] \\\\\\\\\\n<file://n>', t)\nt= [0 \\quad1<file://quad1>] \\\\\nfprintf('y<file://nfprintf('y> = [%g \\\\qquad%g<file://qquad%25g>] \\n<file://n>', y)\ny= [1 \\qquad0.666667<file://qquad0.666667>] \ndisp('\\end{align*}')\n\\end{align*}\n\n\n" Result: ("[t,y]=ode45(f,[0 1],1);" "t=[t(1),t(end)];" "y=[y(1),y(end)];" "disp('\\begin{align*}')" "\\begin{align*}<file://begin%7balign*%7d>" "fprintf('t = [%g \\\\quad%g<file://quad%25g>] \\\\\\\\\\n<file://n>', t)" "t = [0 \\quad1<file://quad1>] \\\\" "fprintf('y = [%g \\\\qquad%g<file://qquad%25g>] \\n<file://n>', y)" "y = [1 \\qquad0.666667<file://qquad0.666667>] " "disp('\\end{align*}')" "\\end{align*}<file://end%7balign*%7d>" #1="" #1# #1#) 1.4 Result cleaning Result: ("t=[t(1),t(end)];" "y=[y(1),y(end)];" "disp('\\begin{align*}')" "\\begin{align*}<file://begin%7balign*%7d>" "fprintf('t = [%g \\\\quad%g<file://quad%25g>] \\\\\\\\\\n<file://n>', t)" "t = [0 \\quad1<file://quad1>] \\\\" "fprintf('y = [%g \\\\qquad%g<file://qquad%25g>] \\n<file://n>', y)" "y = [1 \\qquad0.666667<file://qquad0.666667>] " "disp('\\end{align*}')" "\\end{align*}<file://end%7balign*%7d>" #1="" #1# #1#) Result: "t=[t(1),t(end)];\ny=[y(1),y(end)];\ndisp('\\begin{align*}')\n\\begin{align*}\nfprintf('t = [%g \\\\quad%g<file://quad%25g>] \\\\\\\\\\n<file://n>', t)\nt= [0 \\quad1<file://quad1>] \\\\\nfprintf('y<file://nfprintf('y> = [%g \\\\qquad%g<file://qquad%25g>] \\n<file://n>', y)\ny= [1 \\qquad0.666667<file://qquad0.666667>] \ndisp('\\end{align*}')\n\\end{align*}\n\n\n" Result: "t=[t(1),t(end)];\ny=[y(1),y(end)];\ndisp('\\begin{align*}')\n\\begin{align*}\nfprintf('t = [%g \\\\quad%g<file://quad%25g>] \\\\\\\\\\n<file://n>', t)\nt= [0 \\quad1<file://quad1>] \\\\\nfprintf('y<file://nfprintf('y> = [%g \\\\qquad%g<file://qquad%25g>] \\n<file://n>', y)\ny= [1 \\qquad0.666667<file://qquad0.666667>] \ndisp('\\end{align*}')\n\\end{align*}\n\n\n" Result: "t=[t(1),t(end)];\ny=[y(1),y(end)];\ndisp('\\begin{align*}')\n\\begin{align*}\nfprintf('t = [%g \\\\quad%g<file://quad%25g>] \\\\\\\\\\n<file://n>', t)\nt= [0 \\quad1<file://quad1>] \\\\\nfprintf('y<file://nfprintf('y> = [%g \\\\qquad%g<file://qquad%25g>] \\n<file://n>', y)\ny= [1 \\qquad0.666667<file://qquad0.666667>] \ndisp('\\end{align*}')\n\\end{align*}\n\n\n" Created: 2017-11-04 Sat 15:26 Validate<http://validator.w3.org/check?uri=referer> |
From: Uwe B. <ou...@ma...> - 2017-11-04 15:35:00
|
<html> <head> <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type"> <style type="text/css">body p { margin-bottom: 0cm; margin-top: 0pt; } </style> </head> <body bidimailui-detected-decoding-type="latin-charset" bgcolor="#FFFFFF" text="#000000"> <div class="moz-cite-prefix">On 11/03/2017 03:47 PM, Eric Ludlam wrote:<br> </div> <blockquote cite="mid:MWH...@MW..." type="cite"> <pre wrap="">Ah, sorry I can't be more help. It has been many years since I worked on that code, and I don't use Emacs much anymore. There are accommodations in the function's I referenced for the ML command line to make sure it doesn't interrupting anything a user might be typing in that would be important for your use case. </pre> </blockquote> <br> Ok fair enough. I think I made some progress but still have a small<br> problem, maybe you might remember and help. :-D<br> <br> John's code consists of:<br> <br> - cleaning the matlab code in orgmode mode: (font lock stuff etc)<br> and collect it.<br> <br> - create a temporally file and insert the clean matlab commands.<br> <br> - run a external matlab process via<br> "/usr/local/bin/matlab " "-nodesktop <" m-file<br> <br> - clean the result and insert it in the original buffer.<br> <br> So my solution is to use the matlab-shell-collect-command-output<br> function. So my code is:<br> <br> - cleaning the matlab code in orgmode mode: (font lock stuff etc)<br> and collect it.<br> <br> - run (matlab-shell-collect-command-output code) where code<br> corresponds to the clean code from step one which John inserts in<br> temp buffer.<br> <br> - clean the result and insert it in the original buffer.<br> <br> <br> The only problem is that the output of the<br> /usr/local/bin/matlab -nodesktop < m-file<br> <br> And (matlab-shell-collect-command-output code)<br> is slightly different.<br> Take the following example.<br> <br> f=@(t,y)[-t*y^2];<br> [t,y]=ode45(f,[0 1],1);<br> t=[t(1),t(end)];<br> y=[y(1),y(end)];<br> disp('\begin{align*}')<br> fprintf('t = [%g \\quad %g] \\\\\n', t)<br> fprintf('y = [%g \\qquad %g] \n', y)<br> disp('\end{align*}')<br> <br> The external matlab command does not include the fprintf in his output.<br> I have collected the output of both approaches including the result of<br> the cleaning function.<br> <br> So there are two possibilities. <br> <br> - Modify matlab-shell-collect-command-output so that it behaves closer to<br> /usr/local/bin/matlab -nodesktop < m-file<br> <br> - modify the cleaning function (which I don't understand but could<br> ask John about it).<br> <br> (when results<br> ;; strip out >><br> (setq results (replace-regexp-in-string ">> " "" results))<br> ;; remove first 10 lines that are the header.<br> (setq results (mapconcat 'identity<br> (nthcdr 10 (split-string results "\n"))<br> "\n")))<br> <br> <br> Any comment is more than welcome. Here is the output of both commands<br> <br> <br> <br> Uwe<br> <br> <div id="content"> <div id="outline-container-org102ba5b" class="outline-2"> <h2 id="org102ba5b"><span class="section-number-2">1</span> Matlab and the cleaning</h2> <div class="outline-text-2" id="text-1"> </div> <div id="outline-container-org7653ede" class="outline-3"> <h3 id="org7653ede"><span class="section-number-3">1.1</span> Result Matlab (John)</h3> <div class="outline-text-3" id="text-1-1"> <p> Result: "\n< M A T L A B (R) >\nCopyright 1984-2012 The MathWorks, Inc.\nR2012a (7.14.0.739) 32-bit (glnx86)\nFebruary 9, 2012\n\n\nToget started, type one of these: helpwin, helpdesk, or demo.\nForproduct information, visit <a class="moz-txt-link-abbreviated" href="http://www.mathworks.com.\n\n">www.mathworks.com.\n\n</a>>> >> >> >> >> \\begin{align*}\n>> t = [0 \\quad1] \\\\\n>> y = [1 \\qquad0.666667] \n>> \\end{align*}\n>> "<br> Stop<br> [2 times]<br> Result: "\n< M A T L A B (R) >\nCopyright 1984-2012 The MathWorks, Inc.\nR2012a (7.14.0.739) 32-bit (glnx86)\nFebruary 9, 2012\n\n\nToget started, type one of these: helpwin, helpdesk, or demo.\nForproduct information, visit <a class="moz-txt-link-abbreviated" href="http://www.mathworks.com.\n\n">www.mathworks.com.\n\n</a>>> >> >> >> >> \\begin{align*}\n>> t = [0 \\quad1] \\\\\n>> y = [1 \\qquad0.666667] \n>> \\end{align*}\n>> "<br> [3 times]<br> Result: "\n< M A T L A B (R) >\nCopyright 1984-2012 The MathWorks, Inc.\nR2012a (7.14.0.739) 32-bit (glnx86)\nFebruary 9, 2012\n\n\nToget started, type one of these: helpwin, helpdesk, or demo.\nForproduct information, visit <a class="moz-txt-link-abbreviated" href="http://www.mathworks.com.\n\n">www.mathworks.com.\n\n</a>>> >> >> >> >> \\begin{align*}\n>> t = [0 \\quad1] \\\\\n>> y = [1 \\qquad0.666667] \n>> \\end{align*}\n>> "<br> </p> <p> Result: "\n< M A T L A B (R) >\nCopyright 1984-2012 The MathWorks, Inc.\nR2012a (7.14.0.739) 32-bit (glnx86)\nFebruary 9, 2012\n\n\nToget started, type one of these: helpwin, helpdesk, or demo.\nForproduct information, visit <a class="moz-txt-link-abbreviated" href="http://www.mathworks.com.\n\n\\begin">www.mathworks.com.\n\n\\begin</a>{align*}\nt= [0 \\quad1] \\\\\ny= [1 \\qquad0.666667] \n\\end{align*}\n"<br> </p> <p> Result: "\n< M A T L A B (R) >\nCopyright 1984-2012 The MathWorks, Inc.\nR2012a (7.14.0.739) 32-bit (glnx86)\nFebruary 9, 2012\n\n\nToget started, type one of these: helpwin, helpdesk, or demo.\nForproduct information, visit <a class="moz-txt-link-abbreviated" href="http://www.mathworks.com.\n\n\\begin">www.mathworks.com.\n\n\\begin</a>{align*}\nt= [0 \\quad1] \\\\\ny= [1 \\qquad0.666667] \n\\end{align*}\n"<br> [5 times]<br> Result: "\n< M A T L A B (R) >\nCopyright 1984-2012 The MathWorks, Inc.\nR2012a (7.14.0.739) 32-bit (glnx86)\nFebruary 9, 2012\n\n\nToget started, type one of these: helpwin, helpdesk, or demo.\nForproduct information, visit <a class="moz-txt-link-abbreviated" href="http://www.mathworks.com.\n\n\\begin">www.mathworks.com.\n\n\\begin</a>{align*}\nt= [0 \\quad1] \\\\\ny= [1 \\qquad0.666667] \n\\end{align*}\n"<br> </p> <p> Result: (#1="" " < M A T L A B (R) >" " Copyright 1984-2012 The MathWorks, Inc." " R2012a (7.14.0.739) 32-bit (glnx86)" " February 9, 2012" #1# " " "To get started, type one of these: helpwin, helpdesk, or demo." "For product information, visit <a class="moz-txt-link-abbreviated" href="http://www.mathworks.com">www.mathworks.com</a>." " " "\\begin{align*}" "t = [0 \\quad1] \\\\" "y = [1 \\qquad0.666667] " "\\end{align*}" #1#)<br> </p> </div> </div> <div id="outline-container-org1203d4a" class="outline-3"> <h3 id="org1203d4a"><span class="section-number-3">1.2</span> Result cleaning (John)</h3> <div class="outline-text-3" id="text-1-2"> <p> Result: ("\\begin{align*}" "t = [0 \\quad1] \\\\" "y = [1 \\qquad0.666667] " "\\end{align*}" "")<br> </p> <p> Result: "\\begin{align*}\nt= [0 \\quad1] \\\\\ny= [1 \\qquad0.666667] \n\\end{align*}\n"<br> </p> <p> Result: "\\begin{align*}\nt= [0 \\quad1] \\\\\ny= [1 \\qquad0.666667] \n\\end{align*}\n"<br> </p> <p> Result: "\\begin{align*}\nt= [0 \\quad1] \\\\\ny= [1 \\qquad0.666667] \n\\end{align*}\n"<br> [2 times]<br> Result: ("replace" "output" "latex")<br> </p> <p> Result: "\\begin{align*}\nt= [0 \\quad1] \\\\\ny= [1 \\qquad0.666667] \n\\end{align*}\n"<br> </p> <p> Result: "\\begin{align*}\nt= [0 \\quad1] \\\\\ny= [1 \\qquad0.666667] \n\\end{align*}\n"<br> </p> <p> Result: "\\begin{align*}\nt= [0 \\quad1] \\\\\ny= [1 \\qquad0.666667] \n\\end{align*}\n"<br> </p> <p> Result: "\\begin{align*}\nt= [0 \\quad1] \\\\\ny= [1 \\qquad0.666667] \n\\end{align*}\n"<br> </p> </div> </div> <div id="outline-container-org417a7b3" class="outline-3"> <h3 id="org417a7b3"><span class="section-number-3">1.3</span> Result Matlab (Shell)</h3> <div class="outline-text-3" id="text-1-3"> <p> Result: "f=@(t,y)[-t*y<sup>2</sup>];\n[t,y]=ode45(f,[0 1],1);\nt=[t(1),t(end)];\ny=[y(1),y(end)];\ndisp('\\begin{align*}')\nfprintf('t = [%g \\\\quad%g] \\\\\\\\\\n', t)\nfprintf('y = [%g \\\\qquad%g] \\n', y)\ndisp('\\end{align*}')\n"<br> </p> <p> Result: ">> [t,y]=ode45(f,[0 1],1);\n>> t=[t(1),t(end)];\n>> y=[y(1),y(end)];\n>> disp('\\begin{align*}')\n\\begin{align*}\n>> fprintf('t = [%g \\\\quad%g] \\\\\\\\\\n', t)\nt= [0 \\quad1] \\\\\n>> fprintf('y = [%g \\\\qquad%g] \\n', y)\ny= [1 \\qquad0.666667] \n>> disp('\\end{align*}')\n\\end{align*}\n>> \n>> \n"<br> [2 times]<br> Result: ">> [t,y]=ode45(f,[0 1],1);\n>> t=[t(1),t(end)];\n>> y=[y(1),y(end)];\n>> disp('\\begin{align*}')\n\\begin{align*}\n>> fprintf('t = [%g \\\\quad%g] \\\\\\\\\\n', t)\nt= [0 \\quad1] \\\\\n>> fprintf('y = [%g \\\\qquad%g] \\n', y)\ny= [1 \\qquad0.666667] \n>> disp('\\end{align*}')\n\\end{align*}\n>> \n>> \n"<br> [3 times]<br> Result: ">> [t,y]=ode45(f,[0 1],1);\n>> t=[t(1),t(end)];\n>> y=[y(1),y(end)];\n>> disp('\\begin{align*}')\n\\begin{align*}\n>> fprintf('t = [%g \\\\quad%g] \\\\\\\\\\n', t)\nt= [0 \\quad1] \\\\\n>> fprintf('y = [%g \\\\qquad%g] \\n', y)\ny= [1 \\qquad0.666667] \n>> disp('\\end{align*}')\n\\end{align*}\n>> \n>> \n"<br> </p> <p> Result: "[t,y]=ode45(f,[0 1],1);\nt=[t(1),t(end)];\ny=[y(1),y(end)];\ndisp('\\begin{align*}')\n\\begin{align*}\nfprintf('t = [%g \\\\quad%g] \\\\\\\\\\n', t)\nt= [0 \\quad1] \\\\\nfprintf('y = [%g \\\\qquad%g] \\n', y)\ny= [1 \\qquad0.666667] \ndisp('\\end{align*}')\n\\end{align*}\n\n\n"<br> </p> <p> Result: "[t,y]=ode45(f,[0 1],1);\nt=[t(1),t(end)];\ny=[y(1),y(end)];\ndisp('\\begin{align*}')\n\\begin{align*}\nfprintf('t = [%g \\\\quad%g] \\\\\\\\\\n', t)\nt= [0 \\quad1] \\\\\nfprintf('y = [%g \\\\qquad%g] \\n', y)\ny= [1 \\qquad0.666667] \ndisp('\\end{align*}')\n\\end{align*}\n\n\n"<br> [5 times]<br> Result: "[t,y]=ode45(f,[0 1],1);\nt=[t(1),t(end)];\ny=[y(1),y(end)];\ndisp('\\begin{align*}')\n\\begin{align*}\nfprintf('t = [%g \\\\quad%g] \\\\\\\\\\n', t)\nt= [0 \\quad1] \\\\\nfprintf('y = [%g \\\\qquad%g] \\n', y)\ny= [1 \\qquad0.666667] \ndisp('\\end{align*}')\n\\end{align*}\n\n\n"<br> </p> <p> Result: ("[t,y]=ode45(f,[0 1],1);" "t=[t(1),t(end)];" "y=[y(1),y(end)];" "disp('\\begin{align*}')" "\\begin{align*}" "fprintf('t = [%g \\\\quad%g] \\\\\\\\\\n', t)" "t = [0 \\quad1] \\\\" "fprintf('y = [%g \\\\qquad%g] \\n', y)" "y = [1 \\qquad0.666667] " "disp('\\end{align*}')" "\\end{align*}" #1="" #1# #1#)<br> </p> </div> </div> <div id="outline-container-org40deade" class="outline-3"> <h3 id="org40deade"><span class="section-number-3">1.4</span> Result cleaning</h3> <div class="outline-text-3" id="text-1-4"> <p> Result: ("t=[t(1),t(end)];" "y=[y(1),y(end)];" "disp('\\begin{align*}')" "\\begin{align*}" "fprintf('t = [%g \\\\quad%g] \\\\\\\\\\n', t)" "t = [0 \\quad1] \\\\" "fprintf('y = [%g \\\\qquad%g] \\n', y)" "y = [1 \\qquad0.666667] " "disp('\\end{align*}')" "\\end{align*}" #1="" #1# #1#)<br> </p> <p> Result: "t=[t(1),t(end)];\ny=[y(1),y(end)];\ndisp('\\begin{align*}')\n\\begin{align*}\nfprintf('t = [%g \\\\quad%g] \\\\\\\\\\n', t)\nt= [0 \\quad1] \\\\\nfprintf('y = [%g \\\\qquad%g] \\n', y)\ny= [1 \\qquad0.666667] \ndisp('\\end{align*}')\n\\end{align*}\n\n\n"<br> </p> <p> Result: "t=[t(1),t(end)];\ny=[y(1),y(end)];\ndisp('\\begin{align*}')\n\\begin{align*}\nfprintf('t = [%g \\\\quad%g] \\\\\\\\\\n', t)\nt= [0 \\quad1] \\\\\nfprintf('y = [%g \\\\qquad%g] \\n', y)\ny= [1 \\qquad0.666667] \ndisp('\\end{align*}')\n\\end{align*}\n\n\n"<br> </p> <p> Result: "t=[t(1),t(end)];\ny=[y(1),y(end)];\ndisp('\\begin{align*}')\n\\begin{align*}\nfprintf('t = [%g \\\\quad%g] \\\\\\\\\\n', t)\nt= [0 \\quad1] \\\\\nfprintf('y = [%g \\\\qquad%g] \\n', y)\ny= [1 \\qquad0.666667] \ndisp('\\end{align*}')\n\\end{align*}\n\n\n"<br> </p> </div> </div> </div> </div> <div id="postamble" class="status"> <p class="date">Created: 2017-11-04 Sat 15:26</p> <p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p> </div> <br> <div id="content"> <div id="outline-container-org102ba5b" class="outline-2"> <h2 id="org102ba5b"><span class="section-number-2">1</span> Matlab and the cleaning</h2> <div class="outline-text-2" id="text-1"> </div> <div id="outline-container-org7653ede" class="outline-3"> <h3 id="org7653ede"><span class="section-number-3">1.1</span> Result Matlab (John)</h3> <div class="outline-text-3" id="text-1-1"> <p> Result: "\n< M A T L A B (R) >\nCopyright 1984-2012 The MathWorks, Inc.\nR2012a (7.14.0.739) 32-bit (glnx86)\nFebruary 9, 2012\n\n\nToget started, type one of these: helpwin, helpdesk, or demo.\nForproduct information, visit <a class="moz-txt-link-abbreviated" href="http://www.mathworks.com.\n\n">www.mathworks.com.\n\n</a>>> >> >> >> >> \\begin{align*}\n>> t = [0 \\quad1] \\\\\n>> y = [1 \\qquad0.666667] \n>> \\end{align*}\n>> "<br> Stop<br> [2 times]<br> Result: "\n< M A T L A B (R) >\nCopyright 1984-2012 The MathWorks, Inc.\nR2012a (7.14.0.739) 32-bit (glnx86)\nFebruary 9, 2012\n\n\nToget started, type one of these: helpwin, helpdesk, or demo.\nForproduct information, visit <a class="moz-txt-link-abbreviated" href="http://www.mathworks.com.\n\n">www.mathworks.com.\n\n</a>>> >> >> >> >> \\begin{align*}\n>> t = [0 \\quad1] \\\\\n>> y = [1 \\qquad0.666667] \n>> \\end{align*}\n>> "<br> [3 times]<br> Result: "\n< M A T L A B (R) >\nCopyright 1984-2012 The MathWorks, Inc.\nR2012a (7.14.0.739) 32-bit (glnx86)\nFebruary 9, 2012\n\n\nToget started, type one of these: helpwin, helpdesk, or demo.\nForproduct information, visit <a class="moz-txt-link-abbreviated" href="http://www.mathworks.com.\n\n">www.mathworks.com.\n\n</a>>> >> >> >> >> \\begin{align*}\n>> t = [0 \\quad1] \\\\\n>> y = [1 \\qquad0.666667] \n>> \\end{align*}\n>> "<br> </p> <p> Result: "\n< M A T L A B (R) >\nCopyright 1984-2012 The MathWorks, Inc.\nR2012a (7.14.0.739) 32-bit (glnx86)\nFebruary 9, 2012\n\n\nToget started, type one of these: helpwin, helpdesk, or demo.\nForproduct information, visit <a class="moz-txt-link-abbreviated" href="http://www.mathworks.com.\n\n\\begin">www.mathworks.com.\n\n\\begin</a>{align*}\nt= [0 \\quad1] \\\\\ny= [1 \\qquad0.666667] \n\\end{align*}\n"<br> </p> <p> Result: "\n< M A T L A B (R) >\nCopyright 1984-2012 The MathWorks, Inc.\nR2012a (7.14.0.739) 32-bit (glnx86)\nFebruary 9, 2012\n\n\nToget started, type one of these: helpwin, helpdesk, or demo.\nForproduct information, visit <a class="moz-txt-link-abbreviated" href="http://www.mathworks.com.\n\n\\begin">www.mathworks.com.\n\n\\begin</a>{align*}\nt= [0 \\quad1] \\\\\ny= [1 \\qquad0.666667] \n\\end{align*}\n"<br> [5 times]<br> Result: "\n< M A T L A B (R) >\nCopyright 1984-2012 The MathWorks, Inc.\nR2012a (7.14.0.739) 32-bit (glnx86)\nFebruary 9, 2012\n\n\nToget started, type one of these: helpwin, helpdesk, or demo.\nForproduct information, visit <a class="moz-txt-link-abbreviated" href="http://www.mathworks.com.\n\n\\begin">www.mathworks.com.\n\n\\begin</a>{align*}\nt= [0 \\quad1] \\\\\ny= [1 \\qquad0.666667] \n\\end{align*}\n"<br> </p> <p> Result: (#1="" " < M A T L A B (R) >" " Copyright 1984-2012 The MathWorks, Inc." " R2012a (7.14.0.739) 32-bit (glnx86)" " February 9, 2012" #1# " " "To get started, type one of these: helpwin, helpdesk, or demo." "For product information, visit <a class="moz-txt-link-abbreviated" href="http://www.mathworks.com">www.mathworks.com</a>." " " "\\begin{align*}" "t = [0 \\quad1] \\\\" "y = [1 \\qquad0.666667] " "\\end{align*}" #1#)<br> </p> </div> </div> <div id="outline-container-org1203d4a" class="outline-3"> <h3 id="org1203d4a"><span class="section-number-3">1.2</span> Result cleaning (John)</h3> <div class="outline-text-3" id="text-1-2"> <p> Result: ("\\begin{align*}" "t = [0 \\quad1] \\\\" "y = [1 \\qquad0.666667] " "\\end{align*}" "")<br> </p> <p> Result: "\\begin{align*}\nt= [0 \\quad1] \\\\\ny= [1 \\qquad0.666667] \n\\end{align*}\n"<br> </p> <p> Result: "\\begin{align*}\nt= [0 \\quad1] \\\\\ny= [1 \\qquad0.666667] \n\\end{align*}\n"<br> </p> <p> Result: "\\begin{align*}\nt= [0 \\quad1] \\\\\ny= [1 \\qquad0.666667] \n\\end{align*}\n"<br> [2 times]<br> Result: ("replace" "output" "latex")<br> </p> <p> Result: "\\begin{align*}\nt= [0 \\quad1] \\\\\ny= [1 \\qquad0.666667] \n\\end{align*}\n"<br> </p> <p> Result: "\\begin{align*}\nt= [0 \\quad1] \\\\\ny= [1 \\qquad0.666667] \n\\end{align*}\n"<br> </p> <p> Result: "\\begin{align*}\nt= [0 \\quad1] \\\\\ny= [1 \\qquad0.666667] \n\\end{align*}\n"<br> </p> <p> Result: "\\begin{align*}\nt= [0 \\quad1] \\\\\ny= [1 \\qquad0.666667] \n\\end{align*}\n"<br> </p> </div> </div> <div id="outline-container-org417a7b3" class="outline-3"> <h3 id="org417a7b3"><span class="section-number-3">1.3</span> Result Matlab (Shell)</h3> <div class="outline-text-3" id="text-1-3"> <p> Result: "f=@(t,y)[-t*y<sup>2</sup>];\n[t,y]=ode45(f,[0 1],1);\nt=[t(1),t(end)];\ny=[y(1),y(end)];\ndisp('\\begin{align*}')\nfprintf('t = [%g \\\\quad%g] \\\\\\\\\\n', t)\nfprintf('y = [%g \\\\qquad%g] \\n', y)\ndisp('\\end{align*}')\n"<br> </p> <p> Result: ">> [t,y]=ode45(f,[0 1],1);\n>> t=[t(1),t(end)];\n>> y=[y(1),y(end)];\n>> disp('\\begin{align*}')\n\\begin{align*}\n>> fprintf('t = [%g \\\\quad%g] \\\\\\\\\\n', t)\nt= [0 \\quad1] \\\\\n>> fprintf('y = [%g \\\\qquad%g] \\n', y)\ny= [1 \\qquad0.666667] \n>> disp('\\end{align*}')\n\\end{align*}\n>> \n>> \n"<br> [2 times]<br> Result: ">> [t,y]=ode45(f,[0 1],1);\n>> t=[t(1),t(end)];\n>> y=[y(1),y(end)];\n>> disp('\\begin{align*}')\n\\begin{align*}\n>> fprintf('t = [%g \\\\quad%g] \\\\\\\\\\n', t)\nt= [0 \\quad1] \\\\\n>> fprintf('y = [%g \\\\qquad%g] \\n', y)\ny= [1 \\qquad0.666667] \n>> disp('\\end{align*}')\n\\end{align*}\n>> \n>> \n"<br> [3 times]<br> Result: ">> [t,y]=ode45(f,[0 1],1);\n>> t=[t(1),t(end)];\n>> y=[y(1),y(end)];\n>> disp('\\begin{align*}')\n\\begin{align*}\n>> fprintf('t = [%g \\\\quad%g] \\\\\\\\\\n', t)\nt= [0 \\quad1] \\\\\n>> fprintf('y = [%g \\\\qquad%g] \\n', y)\ny= [1 \\qquad0.666667] \n>> disp('\\end{align*}')\n\\end{align*}\n>> \n>> \n"<br> </p> <p> Result: "[t,y]=ode45(f,[0 1],1);\nt=[t(1),t(end)];\ny=[y(1),y(end)];\ndisp('\\begin{align*}')\n\\begin{align*}\nfprintf('t = [%g \\\\quad%g] \\\\\\\\\\n', t)\nt= [0 \\quad1] \\\\\nfprintf('y = [%g \\\\qquad%g] \\n', y)\ny= [1 \\qquad0.666667] \ndisp('\\end{align*}')\n\\end{align*}\n\n\n"<br> </p> <p> Result: "[t,y]=ode45(f,[0 1],1);\nt=[t(1),t(end)];\ny=[y(1),y(end)];\ndisp('\\begin{align*}')\n\\begin{align*}\nfprintf('t = [%g \\\\quad%g] \\\\\\\\\\n', t)\nt= [0 \\quad1] \\\\\nfprintf('y = [%g \\\\qquad%g] \\n', y)\ny= [1 \\qquad0.666667] \ndisp('\\end{align*}')\n\\end{align*}\n\n\n"<br> [5 times]<br> Result: "[t,y]=ode45(f,[0 1],1);\nt=[t(1),t(end)];\ny=[y(1),y(end)];\ndisp('\\begin{align*}')\n\\begin{align*}\nfprintf('t = [%g \\\\quad%g] \\\\\\\\\\n', t)\nt= [0 \\quad1] \\\\\nfprintf('y = [%g \\\\qquad%g] \\n', y)\ny= [1 \\qquad0.666667] \ndisp('\\end{align*}')\n\\end{align*}\n\n\n"<br> </p> <p> Result: ("[t,y]=ode45(f,[0 1],1);" "t=[t(1),t(end)];" "y=[y(1),y(end)];" "disp('\\begin{align*}')" "\\begin{align*}" "fprintf('t = [%g \\\\quad%g] \\\\\\\\\\n', t)" "t = [0 \\quad1] \\\\" "fprintf('y = [%g \\\\qquad%g] \\n', y)" "y = [1 \\qquad0.666667] " "disp('\\end{align*}')" "\\end{align*}" #1="" #1# #1#)<br> </p> </div> </div> <div id="outline-container-org40deade" class="outline-3"> <h3 id="org40deade"><span class="section-number-3">1.4</span> Result cleaning</h3> <div class="outline-text-3" id="text-1-4"> <p> Result: ("t=[t(1),t(end)];" "y=[y(1),y(end)];" "disp('\\begin{align*}')" "\\begin{align*}" "fprintf('t = [%g \\\\quad%g] \\\\\\\\\\n', t)" "t = [0 \\quad1] \\\\" "fprintf('y = [%g \\\\qquad%g] \\n', y)" "y = [1 \\qquad0.666667] " "disp('\\end{align*}')" "\\end{align*}" #1="" #1# #1#)<br> </p> <p> Result: "t=[t(1),t(end)];\ny=[y(1),y(end)];\ndisp('\\begin{align*}')\n\\begin{align*}\nfprintf('t = [%g \\\\quad%g] \\\\\\\\\\n', t)\nt= [0 \\quad1] \\\\\nfprintf('y = [%g \\\\qquad%g] \\n', y)\ny= [1 \\qquad0.666667] \ndisp('\\end{align*}')\n\\end{align*}\n\n\n"<br> </p> <p> Result: "t=[t(1),t(end)];\ny=[y(1),y(end)];\ndisp('\\begin{align*}')\n\\begin{align*}\nfprintf('t = [%g \\\\quad%g] \\\\\\\\\\n', t)\nt= [0 \\quad1] \\\\\nfprintf('y = [%g \\\\qquad%g] \\n', y)\ny= [1 \\qquad0.666667] \ndisp('\\end{align*}')\n\\end{align*}\n\n\n"<br> </p> <p> Result: "t=[t(1),t(end)];\ny=[y(1),y(end)];\ndisp('\\begin{align*}')\n\\begin{align*}\nfprintf('t = [%g \\\\quad%g] \\\\\\\\\\n', t)\nt= [0 \\quad1] \\\\\nfprintf('y = [%g \\\\qquad%g] \\n', y)\ny= [1 \\qquad0.666667] \ndisp('\\end{align*}')\n\\end{align*}\n\n\n"<br> </p> </div> </div> </div> </div> <div id="postamble" class="status"> <p class="date">Created: 2017-11-04 Sat 15:26</p> <p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p> </div> <br> </body> </html> |
From: Eric L. <Eri...@ma...> - 2017-11-03 15:16:54
|
Sorry for not being more precise. Inside 'matlab-shell-save-and-go' is infrastructure for building something custom for org-mode. For example, how it looks for a shell buffer and creates on only if needed, and how it updates the history (which you could remove) and how it executes the string. It is similar to run-region in how it works w/ the shell buffer. In a different part of the thread, you wanted to capture the output to insert into org-mode. 'matlab-shell-run-command' will capture the output to display in a help buffer. You could probably use its mechanisms to capture the output from the shell to display where you need it. If you want to capture images from any figures created, there is nothing for that. You'd need to add something the matlab-emacs toolbox for capturing and saving images in a way that Emacs could then pick up the files. Eric -----Original Message----- From: Uwe Brauer [mailto:ou...@ma...] Sent: Tuesday, October 31, 2017 5:27 PM To: Eric Ludlam <Eri...@ma...> Cc: Uwe Brauer <ou...@ma...>; matlab-emacs-discuss <mat...@li...> Subject: Re: [Matlab-emacs-discuss] executing matlab in org mode files (using the matlab-shell) >>> "Eric" == Eric Ludlam <Eri...@ma...> writes: > MATLAB mode has a command to execute region in the MATLAB Shell from a > .M file. I see no reason why you couldn't re-use that. > It may be it needs updating to also start the shell, or to chdir if > there is a function, or something like that. Hm suppose the shell is running. The core of his function are the following lines (let ((results (shell-command-to-string (concat "/usr/local/bin/matlab " "-nodesktop -nojvm -nosplash -nodisplay <" m-file)))) So are you saying I should try (switch-to-buffer m-file) (find-file m-file) ;? None worked (let ((results (matlab-shell-save-and-go) (delete-file m-file) rest of code))) Hm this did not work, so most likely I am not taking care of something elementary here. Uwe |
From: Eric L. <Eri...@ma...> - 2017-11-03 15:03:49
|
Ah, sorry I can't be more help. It has been many years since I worked on that code, and I don't use Emacs much anymore. There are accommodations in the function's I referenced for the ML command line to make sure it doesn't interrupting anything a user might be typing in that would be important for your use case. It might be worth trying the Matlab help stuff in matlab-mode/matlab-shell to see if it still works. This is code that will call help, and put output into a separate buffer. I haven't tested it in ages, so if it isn't working in ML shell, that might explain any issues you're bumping into with org mode. Eric -----Original Message----- From: Uwe Brauer [mailto:ou...@ma...] Sent: Friday, November 03, 2017 10:39 AM To: Eric Ludlam <Eri...@ma...> Cc: Uwe Brauer <ou...@ma...>; matlab-emacs-discuss <mat...@li...> Subject: Re: [Matlab-emacs-discuss] executing matlab in org mode files (using the matlab-shell) >>> "Eric" == Eric Ludlam <Eri...@ma...> writes: > Sorry for not being more precise. > Inside 'matlab-shell-save-and-go' is infrastructure for building > something custom for org-mode. For example, how it looks for a shell > buffer and creates on only if needed, and how it updates the history > (which you could remove) and how it executes the string. It is similar > to run-region in how it works w/ the shell buffer. Yeah I tried to debug it and to understand its structure. The matlab-shell-command is, at least for me, maybe the most complex part of the code. On the other hand the crucial parts of John's code are the lines (let ((results (shell-command-to-string (concat "/usr/local/bin/matlab " "-nodesktop -nojvm -nosplash -nodisplay <" m-file)))) So I hoped somebody with a better understanding of the matlab-shell-command could give me a hint, but it seems that the merge between John's code and matlab-shell is much more complicated. > In a different part of the thread, you wanted to capture the output to > insert into org-mode. 'matlab-shell-run-command' will capture the > output to display in a help buffer. You could probably use its > mechanisms to capture the output from the shell to display where you > need it. Yes I did and John's code does precisely this. I asked the same question on the orgmode list and John replied. The only problem with his code is that it uses the command line matlab command and so starts every time matlab, when the code is executed. > If you want to capture images from any figures created, there is > nothing for that. You'd need to add something the matlab-emacs toolbox > for capturing and saving images in a way that Emacs could then pick up > the files. No that is ok, I hoped orgmode could take that part as well but all my attempts failed. Uwe |
From: Eric L. <Eri...@ma...> - 2017-11-03 14:41:48
|
Hi Nate, Could your provide a diff that provides context (a context diff) ? It isn’t clear how to merge the patch into code where the line numbers may have changed. Ideally, the diff could be intput into the ‘patch’ command. Thanks Eric From: nchodosh [mailto:nch...@an...] Sent: Tuesday, October 17, 2017 11:44 AM To: Eric Ludlam <Eri...@ma...>; mat...@li... Subject: Re: [Matlab-emacs-discuss] Removing extra lines from collect-command-output Hi, Sorry about the delay, I had a busy few weeks. Here's the diff for matlab.el, I also included one for company-matlab-shell.el which enables predictions while editing the middle of a line. Best, Nate On Tue, Oct 3, 2017 at 3:24 PM Eric Ludlam <Eri...@ma...<mailto:Eri...@ma...>> wrote: Ah, this is a good reminder I need to poke the source forge site to point at the new github location that Uwe is using. Start with the mailing list. I’m not sure what process would work best for Uwe. Eric From: Nathaniel Chodosh [mailto:nch...@an...<mailto:nch...@an...>] Sent: Tuesday, October 03, 2017 1:18 PM To: Eric Ludlam <Eri...@ma...<mailto:Eri...@ma...>>; mat...@li...<mailto:mat...@li...> Subject: Re: [Matlab-emacs-discuss] Removing extra lines from collect-command-output Great. I've never contributed to a sourceforge project, should I post the diff under patches? On Tue, Oct 3, 2017 at 12:59 PM Eric Ludlam <Eri...@ma...<mailto:Eri...@ma...>> wrote: Sounds reasonable to me. When you are happy with your changes, post a diff and hopefully Uwe can install it. Thanks Eric From: Nathaniel Chodosh [mailto:nch...@an...<mailto:nch...@an...>] Sent: Tuesday, October 03, 2017 12:26 PM To: Eric Ludlam <Eri...@ma...<mailto:Eri...@ma...>>; mat...@li...<mailto:mat...@li...> Subject: Re: [Matlab-emacs-discuss] Removing extra lines from collect-command-output That's what I thought the purpose of the newline is, but the documentation for comint-simple-send states that it automatically appends a newline to the command, so it's not needed. As an aside I think that in the current version of emacs the while loop in the same function needs to be wrapped in a with-local-quit to avoid raising an error (or at least the accept-process-output call does). Best, Nate On Mon, Oct 2, 2017 at 4:14 PM Eric Ludlam <Eri...@ma...<mailto:Eri...@ma...>> wrote: I wrote that a long time ago, but my vague recollection is that the newline was needed to make the subprocess execute the command. Is it adding a 2nd newline to the end of ‘command’ resulting in the spare line? Eric From: Nathaniel Chodosh [mailto:nch...@an...<mailto:nch...@an...>] Sent: Monday, October 02, 2017 1:27 PM To: mat...@li...<mailto:mat...@li...> Subject: [Matlab-emacs-discuss] Removing extra lines from collect-command-output Hello, I've noticed that calling 'matlab-shell-collect-command-output' can result in extra new lines being sent to the *MATLAB* buffer which aren't deleted. When using company-mode to complete text this behavior is pretty annoying since as I'm typing lines are being inserted above the prompt. I believe that the cause of this is the line: (comint-simple-send (get-buffer-process (current-buffer)) (concat command "\n")) The newline added to the end of the command causes an extra line to be printed since it's interpreted as execute 'command' and then send a newline. Removing the newline fixes the problem. This seems like a suspiciously simple fix so I'm wondering why the newline was being appended to the command. Thanks, Nate P.S I am new to using mailing lists so if I've committed any faux pas in this email please let me know |
From: Uwe B. <ou...@ma...> - 2017-11-03 14:39:07
|
>>> "Eric" == Eric Ludlam <Eri...@ma...> writes: > Sorry for not being more precise. > Inside 'matlab-shell-save-and-go' is infrastructure for building > something custom for org-mode. For example, how it looks for a shell > buffer and creates on only if needed, and how it updates the history > (which you could remove) and how it executes the string. It is similar > to run-region in how it works w/ the shell buffer. Yeah I tried to debug it and to understand its structure. The matlab-shell-command is, at least for me, maybe the most complex part of the code. On the other hand the crucial parts of John's code are the lines (let ((results (shell-command-to-string (concat "/usr/local/bin/matlab " "-nodesktop -nojvm -nosplash -nodisplay <" m-file)))) So I hoped somebody with a better understanding of the matlab-shell-command could give me a hint, but it seems that the merge between John's code and matlab-shell is much more complicated. > In a different part of the thread, you wanted to capture the output to > insert into org-mode. 'matlab-shell-run-command' will capture the > output to display in a help buffer. You could probably use its > mechanisms to capture the output from the shell to display where you > need it. Yes I did and John's code does precisely this. I asked the same question on the orgmode list and John replied. The only problem with his code is that it uses the command line matlab command and so starts every time matlab, when the code is executed. > If you want to capture images from any figures created, there is > nothing for that. You'd need to add something the matlab-emacs toolbox > for capturing and saving images in a way that Emacs could then pick up > the files. No that is ok, I hoped orgmode could take that part as well but all my attempts failed. Uwe |
From: Eric L. <Eri...@ma...> - 2017-10-31 21:43:03
|
MATLAB mode has a command to execute region in the MATLAB Shell from a .M file. I see no reason why you couldn't re-use that. It may be it needs updating to also start the shell, or to chdir if there is a function, or something like that. Eric -----Original Message----- From: Uwe Brauer [mailto:ou...@ma...] Sent: Tuesday, October 24, 2017 4:54 PM To: matlab-emacs-discuss <mat...@li...> Subject: [Matlab-emacs-discuss] executing matlab in org mode files (using the matlab-shell) Hi I am using more and more org mode, a long with auctex and matlab.el. Orgmode comes in handy if I write a document which contains (matlab) code which I want to execute, but the rest of the file maybe text, which I can then export to latex. So a typical file looks like Given \droppoints \begin{displaymath} \begin{cases} \frac{du}{dt}&= -t u^2,\\ u(0)&=1, \end{cases} \end{displaymath} Solve using ... #+BEGIN_solution #+begin_src matlab :results output latex :exports results :eval never-export f=@(t,y)[-t*y^2]; [t,y]=mieuler(f,[0 1],1,2); disp('\begin{align*}') fprintf('t = [%g \\qquad %g \\quad %g] \\\\\n', t) fprintf('y = [%g \\qquad %g \\qquad %g] \n', y) disp('\end{align*}') #+end_src Now I can execute the matlab code in that org file using C-c C-c ( org-ctrl-c-ctrl-c, the *one-ring-to-rule-them-all* function in orgmode. Thanks thanks to a function provided to me by John Kitchin it executes matlab. It is as follows: (defun org-babel-execute:matlab (body params) (interactive "P") (let* ((current-file (buffer-file-name)) (code (org-element-property :value (org-element-context))) (result-params (cdr (assoc :result-params params))) m-file md5-hash) (with-temp-buffer (insert code) (setq md5-hash (md5 (buffer-string)) mbuffer (format "*m-%s*" md5-hash) m-file (format "m-%s.m" md5-hash))) ;; create the file to run (with-temp-file m-file (insert code)) (let ((results (shell-command-to-string (concat "/usr/local/bin/matlab " "-nodesktop -nojvm -nosplash -nodisplay <" m-file)))) (delete-file m-file) (when results ;; strip out >> (setq results (replace-regexp-in-string ">> " "" results)) ;; remove first 10 lines that are the header. ;; matlab license seem to expire soon, so 5 warning lines are added ;; change first 10 to first 15 lines (setq results (mapconcat 'identity (nthcdr 10 (split-string results "\n")) "\n"))) (org-babel-result-cond result-params results)))) The problem of that code is that it starts matlab every time I execute C-c C-c . There seems to be a python based kernel around which avoids this, but I thought that maybe with a bit of hacking one could use the elisp based matlab-shell and the corresponding functions. Anybody has an idea, Eric? Needless to say that I played a bit around but did get it to work.... Regards Uwe Brauer ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Matlab-emacs-discuss mailing list Mat...@li... https://lists.sourceforge.net/lists/listinfo/matlab-emacs-discuss |
From: Uwe B. <ou...@ma...> - 2017-10-31 21:27:13
|
>>> "Eric" == Eric Ludlam <Eri...@ma...> writes: > MATLAB mode has a command to execute region in the MATLAB Shell from a > .M file. I see no reason why you couldn't re-use that. > It may be it needs updating to also start the shell, or to chdir if > there is a function, or something like that. Hm suppose the shell is running. The core of his function are the following lines (let ((results (shell-command-to-string (concat "/usr/local/bin/matlab " "-nodesktop -nojvm -nosplash -nodisplay <" m-file)))) So are you saying I should try (switch-to-buffer m-file) (find-file m-file) ;? None worked (let ((results (matlab-shell-save-and-go) (delete-file m-file) rest of code))) Hm this did not work, so most likely I am not taking care of something elementary here. Uwe |
From: Uwe B. <ou...@ma...> - 2017-10-25 09:29:37
|
>>> "Cumhur" == Cumhur Erkut <cum...@gm...> writes: > Hi, > Assuming that matlab-mode and matlab-shell are working, org-babel > natively supports matlab code execution. > Your org-babel-execute:matlab overrides the org-babel defaults in > ob-octave.el, which can be inspected there. > I enable the babel support in .emacs as > (org-babel-do-load-languages > 'org-babel-load-languages > '( > (setq org-babel-default-header-args:matlab > '((:session . "*MATLAB*") > (:results . "silent") > ) > ) > More an org answer than matlab.el, but I hope these help. Right: your code uses the matlab-shell, which writes its results in the *MATLAB* shell buffer, but I want the result (at least optional) to be written in the org buffer. So a typical org file after executing matlab looks like ,---- | | \droppoints | \begin{displaymath} | \begin{cases} | \frac{du}{dt}&= -t u^2,\\ | u(0)&=1, | \end{cases} | \end{displaymath} | | Solve using ... | | | #+BEGIN_solution | #+begin_src matlab :results output latex :exports results :eval never-export | f=@(t,y)[-t*y^2]; | [t,y]=mieuler(f,[0 1],1,2); | disp('\begin{align*}') | fprintf('t = [%g \\qquad %g \\quad %g] \\\\\n', t) | fprintf('y = [%g \\qquad %g \\qquad %g] \n', y) | disp('\end{align*}') | #+end_src | | #+RESULTS: | #+BEGIN_EXPORT latex | \begin{align*} | t = [0 \qquad 0.5 \quad 1] \\ | y = [1 \qquad 1 \qquad 0.75] | \end{align*} | #+END_EXPORT | `---- This is what the hack does and it does it nicely, the only problem is that every time I execute the code matlab is started again, and for more recent versions of matlab this can take some time. So the question is whether the hack I used, could use the matlab-shell. Uwe Brauer |