From: Eric L. <Eri...@ma...> - 2011-07-29 13:16:24
|
Hi, When you start MATLAB in the matlab-shell in Emacs, it causes Matlab to run 'emacsinit'. In Emacs init, it sets up emacsclient as the default editor. If your Emacs uses 'server-start' the, typing 'edit' in Matlab will cause the file to open in Emacs. Eric -----Original Message----- From: Laurent Jacques [mailto:lau...@uc...] Sent: Friday, July 29, 2011 8:29 AM To: mat...@li... Subject: Re: [Matlab-emacs-discuss] fprintf/disp output to another emacs buffer ? Dear all, Based on the previous exchange of emails with Eric, I would like now to standardize a bit this ability to redirect fprintf output to a shell. In particular, I'd like to design the equivalent of a figure in matlab but for text, let's call it a "message box", so that text messages are sent to it. More clearly, I'd like to achieve something like %% Opening a new buffer in emacs with a shell running inside >> open_msg_box %% get the current message box opened (a label to it) >> gc_msg_box ans = 'ttys0' %% print a message from matlab to this shell >> message("Hello World"); Here is my related question: Do you know if there is a way (e.g. with emacsclient) to open a new emacs buffer from matlab (running inside emacs in matlab-shell) and to run something inside (like "shell") ? Best, Laurent On 26/07/11 15:13, Laurent Jacques wrote: > This works great! Thanks Eric. > > Under Mac OS, once a terminal is open through emacs or not (say in > /dev/ttys001) > I can do now, inside a matlab script, > > fid=fopen('/dev/ttys001','w'); > fprintf(fid,'hello world\n'); > > and this message is truly printed in this terminal! > This is nothing but the stdout redirection I was looking for. > > Best, > Laurent > > On 26/07/11 14:54, Eric Ludlam wrote: >> I used to do this back in 1996 or so, and it worked like this: >> >> Use: >> M-x shell RET >> >> to create a shell, or create a shell with a name by using C-u prefix to the shell command. >> >> In the shell, you can find out which terminal it used. Sometimes it is an environment variable. I found I can use the 'tty' command on my linux box today. >> >> You can fopen that file name and write to it as long as permissions are set ok. >> >> I tried this in my emacs today with >> >> echo "moose">> /dev/pts/4 >> >> and that worked to get to my other shell window. >> >> Good Luck >> Eric >> >> -----Original Message----- >> From: Laurent Jacques [mailto:lau...@uc...] >> Sent: Tuesday, July 26, 2011 6:41 AM >> To: mat...@li... >> Subject: [Matlab-emacs-discuss] fprintf/disp output to another emacs buffer ? >> >> Dear all, >> >> Question: Do you know if it is possible to redirect the output of a matlab disp()/fprintf() (possibly using another command) to another emacs buffer than the one running matlab-shell ? >> >> Objective: When running a "cell" inside a matlab script, this possibility would allow me to display some computation messages or results without to be disturbed by the script code that is always recopied in the matlab shell with the fprintf/disp output. >> >> >> Best regards, >> Laurent >> >> >> >> >> -- >> Dr. Laurent JACQUES >> Postdoctoral Researcher, Return Grant, BELSPO, Belgium >> >> Institute of Information and Communication Technologies, >> Electronics and Applied Mathematics (ICTEAM-TELE) University of >> Louvain Batiment Stévin Place du Levant 2, PO Box L5.04.04 >> 1348 Louvain-la-Neuve, Belgium >> >> Office: a.133 >> Tel: +32 10 47 81 24 >> Fax: +32 10 47 20 89 >> http://perso.uclouvain.be/laurent.jacques >> >> >> --------------------------------------------------------------------- >> --------- Magic Quadrant for Content-Aware Data Loss Prevention >> Research study explores the data loss prevention market. Includes in-depth analysis on the changes within the DLP market, and the criteria used to evaluate the strengths and weaknesses of these DLP solutions. >> http://www.accelacomm.com/jaw/sfnl/114/51385063/ >> _______________________________________________ >> Matlab-emacs-discuss mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matlab-emacs-discuss > -- Dr. Laurent JACQUES Postdoctoral Researcher, Return Grant, BELSPO, Belgium Institute of Information and Communication Technologies, Electronics and Applied Mathematics (ICTEAM-TELE) University of Louvain Batiment Stévin Place du Levant 2, PO Box L5.04.04 1348 Louvain-la-Neuve, Belgium Office: a.133 Tel: +32 10 47 81 24 Fax: +32 10 47 20 89 http://perso.uclouvain.be/laurent.jacques ------------------------------------------------------------------------------ Got Input? Slashdot Needs You. Take our quick survey online. Come on, we don't ask for help often. Plus, you'll get a chance to win $100 to spend on ThinkGeek. http://p.sf.net/sfu/slashdot-survey _______________________________________________ Matlab-emacs-discuss mailing list Mat...@li... https://lists.sourceforge.net/lists/listinfo/matlab-emacs-discuss |