(matlab-indent-function-body, matlab-functions-have-end): Make safe local variable (needed in tests.) (matlab-line-count-open-blocks, matlab-line-count-closed-blocks): DELETE - replaced by ... (matlab-line-count-block-change): New. Return + or - num based on num of opened or closed blocks that don't cancel eachother out. Cuts keyword search on line in half. (matlab-next-line-indentation): Use `matlab-line-count-block-change' replacing old calls. Simplify how functions w/ no indent works. Simplify indent based on indenting block starts and ends. Simplify number of local variables. tests/metest.el: Add new test file for detect and indent. tests/mfuncnofuncindent.m: New file with functions with ends but no indent. Setting w/ local variable. Verify this mode works.
32 lines
564 B
Matlab
32 lines
564 B
Matlab
function mfuncnofuncindent( )
|
|
% Test function that has ends for each function. !!0
|
|
% !!0
|
|
% Used with test harness to validate indentation and end detection. !!0
|
|
% !!0
|
|
% %%%function function nil
|
|
|
|
fcn_call(); %!!0
|
|
|
|
if condition %!!0
|
|
fcn_call(); %!!4
|
|
fcn_call ... !!4
|
|
(); %!!8
|
|
end %!!0
|
|
|
|
end%!!0 - also no space after end
|
|
|
|
function a=fcn_call(inp) %!!0
|
|
|
|
while inp > 0 %!!0
|
|
fcn_call(inp-1); %!!4
|
|
a = [ 1 2 ... !!4
|
|
3 4 ]; %!!10
|
|
end %!!0
|
|
|
|
end %!!0
|
|
|
|
%{
|
|
% Local Variables:
|
|
% matlab-indent-function-body: nil
|
|
% End:
|
|
%} |