diff --git a/matlab-shell.el b/matlab-shell.el index e95cc95..f41c8f6 100644 --- a/matlab-shell.el +++ b/matlab-shell.el @@ -728,7 +728,9 @@ Returns a list of the form: limit t) (save-excursion - (setq beginning (match-beginning 0)) + (setq beginning (save-excursion (goto-char (match-beginning 0)) + (back-to-indentation) + (point))) (goto-char (match-end 0)) (dolist (EXP matlab-shell-error-location-expression) (when (looking-at EXP) diff --git a/tests/buggy.m b/tests/buggy.m index 05a25b5..cda8483 100644 --- a/tests/buggy.m +++ b/tests/buggy.m @@ -23,7 +23,18 @@ function buggy(input,n) else buggy('stack',n-1); end + + case 'indented' + % Test errors that are captured, but then reported up + % but indented. + disp(' In buggy.m (TestPoint_foo) at 36') end end + +function TestPoint_foo + + message('A test point'); + +end \ No newline at end of file