From owner-bug-octave at bevo dot che dot wisc dot edu Thu Nov 9 12:25:25 1995 Subject: Indent in new octave-mode From: John Eaton To: Eyal Doron Cc: bug-octave at bevo dot che dot wisc dot edu Date: Thu, 9 Nov 1995 12:25:23 -0600 Eyal Doron wrote: : The new octave-mode has severe problems with indentation. It's not perfect, but it's a start. The reason this isn't based on the existing matlab-mode is because the distribution terms for that program are incompatible with the GPL. : In particular, it fails to recognize e.g. endfor if its not on a : separate line, Noted. : and in general indentation seems wronf throughout. Can you say precisely what the problems are? Better yet, can you fix them? :-) I am (obviously) not yet a very good Emacs Lisp programmer. : Two convenience points: : 1) matlab-mode.el can be told to auto-indent after newlines. It would be : very convenient to put that into octave-mode as well. Try using LFD or C-j, or binding octave-indent-new-line to whatever key you like. : 2) It would be convenient to be able to switch off indentation of the : function...endfunction block. Not everybody uses endfunction, especially : if they want the routine to work in Matlab as well, so that is : a superfluous indentation level in that case. Ok, I'll consider doing this. It will probably happen sooneer if someone sent a patch for it. : Also, I haven't checked, but the old Matlab mode had problems with "%" : inside strings, sometimes recognizing that as a comment character. The : new matlab-mode fixes (or rather kludges) that. Do you take care of that : problem if the comment character is set to "%"? I don't think this is a problem with the octave mode. : Question - any chance of having just plain "end" work like the specialized : "endif", etc with regards to matching the beginning of the block? Thats : really useful. And pretty hard to do reliably, I think. If someone sends a reasonable patch, I'll consider installing it. : Finally, it would be cool if Octave could be run as a parser. Then one : could "compile" the .m files from within Emacs, and perhaps auto-step : to parse errors. You can do this now, but the error messages are probably not quite in the right format. If foo.m is a function file (starts with `function' and defines only one function) then octave -q foo.m will run it through the parser, possibly printing error messages, but not trying to execute the function. This will actually work with any file that just defines functions, but it doesn't work if there are commands to execute. I've added this to the PROJECTS file: * Add a command-line option to tell Octave to just do syntax checking and not execute statements. Thanks, jwe