From: Eric L. <Eri...@ma...> - 2011-12-09 13:49:38
|
Hi, for (1), there is a function called : matlab-with-emacs-link you can use. (if (matlab-with-emacs-link) (define-key ...) (define-key...) for (2), that's the way it has always worked. The keybindings, however, work in any MATLAB buffer as long as matlab-shell-enable-gud-flag is set, which is t by default. for (3), I think I've seen that reported, but not seen it myself. Your repro steps, however, were good so now I see the problem. On line 4925 the variable 'limitpos' is being set to something based on characters in the line, including the period. That means if you complete: mystruct.plotmat <TAB> it will complete ok without saying mystruct.plotmatmystruct.plotmatrix Unfortunately, when you complete for edit, the return completed file name has a . in it. To fix this, we'd have to add a little hack to know it was completing for 'edit' specifically, and to ignore the . I suppose an alternative would be to take the completion string, and search for the matching substring in the replacement string, and replace only that. I don't think there is a utility in Emacs that matches like that. (4) - the figure focus thing is annoying. The problem here is just MATLAB doesn't know where the command line is, so can't give focus back. I don't know how to fix that. (5) - matlab-shell-run-region runs the region, but gud-print I think picks some symbol under point to evaluate. I use run region to highlight a bunch of lines to run. Eric From: David Chappaz [mailto:dav...@fr...] Sent: Friday, December 09, 2011 5:08 AM To: Eric Ludlam; mat...@li... Subject: RE: [Matlab-emacs-discuss] Matlab-Shell & Sun Grid Engine Hi Eric, You should really be thanked for all the hard work you made, and for improving matlab-emacs in the last couple of years since EmacsLink has disappeared. I happen to be working next door to a Mathworks development site, and I regularly meet some of the Mathworks folks... They always try hard to convince me to move the new Matlab releases, but for now I'm sticking with R2008b because I think EmacsLink is invaluable. I do have R2011b but just don't use it.... Anyway, many thanks for your feedback and possible directions to have "visual breakpoints". It does sound tricky, and way beyond my very limited elisp skills. I'd be prepared to spend some time looking at it, if I thought it was within my abilities, but I'm afraid it's not. I can't deny I am reluctant to give up EmacsLink, but I'm willing to give matlab-emacs a good go. For now I have a few minor issues which hopefully the community can help me solve: 1/ Because I mostly use EmacsLink, I have configured "Visual Sudio like" key bindings for debugging, e.g.: (define-key matlab-mode-map [f9] 'matlab-eei-breakpoint-set-clear) (define-key matlab-mode-map [f10] 'matlab-eei-step) (define-key matlab-mode-map [f11] 'matlab-eei-step-in) But now with matlab-emacs, I would have to redefine the bindings to something like: (define-key matlab-mode-map [f9] 'gud-break) (define-key matlab-mode-map [f10] 'gud-step) (define-key matlab-mode-map [f11] 'gud-next) Ideally I would like my key bindings to work both with EmacsLink and matlab-emacs. Is there a simple way to detect which "mode" is currently used, e.g. something like: (define-key matlab-mode-map [f9] '(lambda () (interactive) (if (EmacsLink) (matlab-eei-breakpoint-set-clear) (gud-break)))) (define-key matlab-mode-map [f10] '(lambda () (interactive) (if (EmacsLink) (matlab-eei-step) (gud-step)))) (define-key matlab-mode-map [f11] '(lambda () (interactive) (if (EmacsLink) (matlab-eei-step-in) (gud-next)))) 2/ The GUD toolbar doesn't automatically show up in my m source files, unless I manually set a breakpoint (e.g. with M-x gud-break), and effectively *** execute *** the function. The same must be repeated for ALL m files, one by one. Is this the way it is expected to be ? Or should the GUD toolbar show up automatically in all opened m files ? 3/ I also have a problem with auto-complete. Say I type "edit plot" and at this point hit TAB. As expected I get the list of all possible completions... Now say I want to edit "plot.m", so I further type "." and hit TAB again Then auto-complete gives me the following: edit plot.plot.m Can anyone reproduce this ? Or is there something wrong with my config ? 4/ Something which I find really (I mean really) annoying with matlab-emacs is that figures do steal focus. At the matlab shell prompt, I can't just type "figure", hit ENTER, and continue typing... I have to take my mouse, and return the focus to the matlab shell.... Any workaround for this problem ? 5/ This is more a question than a problem really, but can anyone explain the difference (if any) between matlab-shell-run-region (as in the matlab menu) and gud-print-expression (as in the GUD toolbar) ? Many thanks in advance to anyone who can help !! Cheers, David. ________________________________ From: Eric Ludlam [mailto:Eri...@ma...] Sent: 08 December 2011 15:52 To: David Chappaz; mat...@li... Subject: RE: [Matlab-emacs-discuss] Matlab-Shell & Sun Grid Engine Hi, Good Luck getting your matlab shell working. It sounds like a tricky environment. EmacsLink depended on some Java APIs that aren't available any more. Most of what you may think of as EmacsLink, however, is the same as matlab-emacs except that matlab-emacs on SourceForge has a bunch of misc bug fixes. The matlab-shell command was an EmacsLink predecessor, and fortunately, still works. The breakpoint feature was one of the things not available. I would be possible to fake it out by reading commands that set breakpoints, and using linemark to remember them, but I imagine that would be quite tricky. It would probably work to have some command for matlab-shell that calls dbstatus, reads the breakpoints, and dumps out a lisp struct that could be read in to populate a linemark database. I picture a couple pages of code for that. You'd have to run the command to show the BP though. If someone would like to give it a try, I'll be happy to give some pointers. Eric From: David Chappaz [mailto:dav...@fr...] Sent: Thursday, December 08, 2011 10:23 AM To: Eric Ludlam; mat...@li... Subject: RE: [Matlab-emacs-discuss] Matlab-Shell & Sun Grid Engine Hi Eric, Many thanks for your swift reply !! In fact I've just realised things are more complicated than that... Eventually I did manage to submit matlab as a Sun Grid Engine job, but then, the communication between emacs and matlab is broken because the two processes do not necessarily run on the same machine.... So it looks like the only way is to submit emacs as a job first, and start matlab normally from there (on the same machine !). On a slightly different note, I've been using EmacsLink for years, but only now am I starting to look at matlab-emacs. Undoubtedly there are a few things I need to learn and to get used to, but one thing that I miss terribly is the ability to "see" where my breakpoints are in the source code, pretty much in the same way as mlint warnings are reported (with linemark.el). Is this feature not supported ? Or is something broken in my configuration ? Cheers, David. ________________________________ From: Eric Ludlam [mailto:Eri...@ma...] Sent: 08 December 2011 15:07 To: David Chappaz; mat...@li... Subject: RE: [Matlab-emacs-discuss] Matlab-Shell & Sun Grid Engine Hi, The variable 'matlab-shell-command' needs to be a string that represents a single executable. In your case, you want it to just be "qrsh". You would then set 'matlab-shell-command-switches' to be '("-b" "y" "-q" "single" "-V" ...) with all your switches spelled out. It seems outlook is messing with my 'quote' marks, so you will need to type it in and not copy what I typed here. Good Luck Eric From: David Chappaz [mailto:dav...@fr...] Sent: Thursday, December 08, 2011 7:51 AM To: mat...@li... Subject: [Matlab-emacs-discuss] Matlab-Shell & Sun Grid Engine Hi everyone, I'm having a simple problem configuring matlab-shell-command. The thing is I actually never run matlab locally on the machine I am logged on, but matlab is submitted as a job to a large pool of linux machines with the Sun Grid Engine. In other words, I don't use the "matlab" command at the shell prompt, but instead I use something like: qrsh -b y -q single -V -cwd -noshell matlab Now, everything works fine by default, if I set matlab-shell-command to "matlab". But if I set matlab-shell-command to "qrsh -b y -q single -V -cwd -noshell matlab", a problem occurs in matlab.el (matlab-shell function), and more specifically on this line : (switch-to-buffer (apply 'make-comint matlab-shell-buffer-name matlab-shell-command nil matlab-shell-command-switches)) which returns the error message Searching for program: no such file or directory, qrsh -b y -q single -V -cwd -noshell matlab As a workaround, I have tried defining an alias in my .cshrc, something like: alias sge_matlab 'qrsh -b y -q single -V -cwd -noshell matlab' and this works to manually start matlab from the shell. But again if I set matlab-shell-command to "sge_matlab", then I get apply: Searching for program: no such file or directory, sge_matlab So what is the proper way to get everything to work in my case ? Many thanks in advance ! Cheers, David. |