branch: externals/matlab-mode
commit 389e8a5e730d933e9f5c568386992909196bfc10
Author: John Ciolfi <[email protected]>
Commit: John Ciolfi <[email protected]>
matlab-ts-mode: updated to latest treesit gammer, other fixes
1. Update to use latest matlab tree-sitter gammer
https://github.com/acristoffers/tree-sitter-matlab/commit/8c370ba2a32c0e8f46d209361cfd5da254442d10
2. Update release Version 7.2.0 (from 7.1.2) to reflect that matlab-ts-mode
works much better
3. Fix: Don't try to fix function names on save when there's a syntax
error. If we were to prompt to
the fix the function name when there's a syntax error, we could change
the name of something
else, e.g. an input variable to a function.
---
NEWS.org | 10 +
contributing/wsl_debian_setup.org | 1 +
doc/install-matlab-tree-sitter-grammar.org | 28 ++-
matlab-mode.el | 2 +-
matlab-ts-mode.el | 15 +-
matlab.el | 2 +-
tests/t-utils.el | 11 +-
.../font_lock_0X_and_0B_issue100.skip.txt | 1 -
.../font_lock_0X_and_0B_issue100_expected.txt | 7 +
.../font_lock_binary_op_continued_issue107.m | 30 +++
..._lock_binary_op_continued_issue107_expected.txt | 30 +++
...classdef_end_override_issue98_subclass.skip.txt | 1 -
...sdef_end_override_issue98_subclass_expected.txt | 8 +
...ck_classdef_end_override_issue98_super.skip.txt | 1 -
...lassdef_end_override_issue98_super_expected.txt | 12 +
..._with_trailing_whitespace_fcn1_issue94.skip.txt | 1 -
...h_trailing_whitespace_fcn1_issue94_expected.txt | 8 +
...mmand_with_trailing_whitespace_issue94.skip.txt | 1 -
...d_with_trailing_whitespace_issue94_expected.txt | 14 ++
.../font_lock_continue_to_empty_issue104.skip.txt | 1 -
...nt_lock_continue_to_empty_issue104_expected.txt | 11 +
...t_lock_continued_metaclass_op_issue103.skip.txt | 1 -
...ck_continued_metaclass_op_issue103_expected.txt | 11 +
.../font_lock_d_style_floats_issue95.skip.txt | 1 -
.../font_lock_d_style_floats_issue95_expected.txt | 6 +
.../font_lock_dot_comments_issue96.skip.txt | 1 -
.../font_lock_dot_comments_issue96_expected.txt | 18 ++
.../font_lock_end_continued_issue108.m | 3 +
.../font_lock_end_continued_issue108.skip.txt | 1 -
.../font_lock_end_continued_issue108_expected.txt | 12 +
.../font_lock_methods_in_namespace.skip.txt | 1 -
....m => font_lock_methods_in_namespace_issue97.m} | 0
..._lock_methods_in_namespace_issue97_expected.txt | 10 +
...mbers_with_word_size_in_cell_issue_106.skip.txt | 1 -
...s_with_word_size_in_cell_issue_106_expected.txt | 29 +++
...k_struct_function_field_colon_issue102.skip.txt | 1 -
...ruct_function_field_colon_issue102_expected.txt | 23 ++
.../font_lock_try_on_one_line_issue99.skip.txt | 1 -
.../font_lock_try_on_one_line_issue99_expected.txt | 5 +
.../font_lock_two_ends_on_a_single_line_issue105.m | 10 +
...two_ends_on_a_single_line_issue105_expected.txt | 10 +
...nt_lock_unnecessary_semicolon_issue101.skip.txt | 1 -
...ock_unnecessary_semicolon_issue101_expected.txt | 10 +
.../indent_cell_expected_msgs.m | 4 +-
.../indent_fcn_ellipsis.skip.typing.txt | 100 ++++++++
.../indent_line_continuation_row_expected_msgs.m | 4 +-
.../indent_matrix_expected_msgs.m | 4 +-
.../indent_old_indents_expected_msgs.m | 6 +-
.../indent_old_indents_for_typing_expected_msgs.m | 6 +-
.../indent_string_concat_continued.m | 7 +
.../indent_string_concat_continued_expected.m | 7 +
.../indent_string_concat_continued_expected_msgs.m | 7 +
.../indent_two_ends_on_a_line_issue105.skip.txt | 1 -
.../indent_two_ends_on_a_line_issue105_expected.m | 10 +
...ent_two_ends_on_a_line_issue105_expected_msgs.m | 10 +
.../indent_xr_classdef3_expected.org | 28 ++-
.../indent_xr_fun5.m | 6 +
.../indent_xr_fun5_expected.org | 267 +++++++++++----------
.../indent_xr_i_cont_incomplete2.m | 14 +-
.../indent_xr_i_cont_incomplete2_expected.org | 125 ++++++----
.../indent_xr_i_cont_incomplete3.m | 16 +-
.../indent_xr_i_cont_incomplete3_expected.org | 139 ++++++-----
.../indent_xr_if_cond.m | 2 +-
.../indent_xr_if_cond_expected.org | 94 +++++---
.../on_save_no_fix_syntax_error.m | 9 +
.../on_save_no_fix_syntax_error_expected.org | 15 ++
...ser_binary_operator_continued_issue107.skip.txt | 1 -
...binary_operator_continued_issue107_expected.txt | 63 +++++
tests/test-package-version.el | 3 +
69 files changed, 971 insertions(+), 328 deletions(-)
diff --git a/NEWS.org b/NEWS.org
index b72a0e513d..0f9fa0e677 100644
--- a/NEWS.org
+++ b/NEWS.org
@@ -3,6 +3,16 @@
# Copyright (C) 2025 Free Software Foundation, Inc.
+* Release 7.2.0 Oct 29, 2025
+
+1. Updated matlab-ts-mode to use latest matlab tree-sitter v1.2.3 branch
[[https://github.com/acristoffers/tree-sitter-matlab/tree/abi/14][abi/14]] at
[[https://github.com/acristoffers/tree-sitter-matlab/tree/9a4e65df4bb08e2b019ca2ef16b2d8f3d95ce978][9a4e65d]].
This
+ fixes parse on a number of MATLAB language constructs, which is visible
behavior improvements,
+ so bumping revision to 7.2.0.
+
+2. In matlab-ts-mode, don't offer to fix function/classdef names when there
are syntax errors
+ because this can lead to changing the name of other identifiers and not the
function/classdef
+ name.
+
* Release 7.1.2 Oct 16, 2025
1. matlab-is-matlab-file: This function identifies when the content of a *.m
file
diff --git a/contributing/wsl_debian_setup.org
b/contributing/wsl_debian_setup.org
index 03da7f2c73..a10775f77b 100644
--- a/contributing/wsl_debian_setup.org
+++ b/contributing/wsl_debian_setup.org
@@ -69,6 +69,7 @@ me, MATLAB R2025a ran well enough to leverage it in Emacs
matlab-shell.
sudo apt install git
sudo apt install -t bookworm-backports emacs
sudo apt install -t bookworm-backports emacs-el
+ sudo apt install -t bookworm-backports emacs-common-non-dfsg
sudo apt install chromium
sudo apt install shellcheck
#+end_src
diff --git a/doc/install-matlab-tree-sitter-grammar.org
b/doc/install-matlab-tree-sitter-grammar.org
index 068d751393..c3841d0419 100644
--- a/doc/install-matlab-tree-sitter-grammar.org
+++ b/doc/install-matlab-tree-sitter-grammar.org
@@ -49,19 +49,9 @@ For Emacs 30, you need to build the MATLAB tree-sitter
grammar for ABI 14 becaus
version 14 of the tree-sitter application binary interface and as of Sep-2025,
the latest
tree-sitter ABI is 15. There are different methods for installing this.
-** Method 1 - Install pre-built binaries
+** Method 1 - Install from abi/14 branch
- *Does not work* as of Sep-2025 because the grammar build is too old. Please
use one of the other
- methods.
-
- Install the pre-built binaries from
http://github.com/emacs-tree-sitter/tree-sitter-langs
- using the following after installing the MATLAB package from
[[file:../README.org][MELPA]]:
-
- : M-x matlab-ts-langs-install
-
- and install matlab (and other languages tree-sitter shared objects if you'd
like).
-
-** Method 2 - Install from abi/14 branch
+ Oct-29-2025 matlab-ts-mode is known to work with matlab tree-sitter v1.2.3
branch
[[https://github.com/acristoffers/tree-sitter-matlab/tree/abi/14][abi/14]] at
[[https://github.com/acristoffers/tree-sitter-matlab/tree/9a4e65df4bb08e2b019ca2ef16b2d8f3d95ce978][9a4e65d]].
+ _Unix_
@@ -116,7 +106,7 @@ tree-sitter ABI is 15. There are different methods for
installing this.
cl /LD /I src\tree_sitter src\parser.c src\scanner.c /link
/out:%HOME%\.emacs.d\tree-sitter\libtree-sitter-matlab.dll
#+end_src
-** Method 3 - Generate the grammar for ABI 14 and install
+** Method 2 - Generate the grammar for ABI 14 and install
1. Install C/C++ compiler if not installed. See Method 2 for tips on
installing the C/C++ compiler.
@@ -176,6 +166,18 @@ tree-sitter ABI is 15. There are different methods for
installing this.
Follow the same Windows build step as in Method 2.
+** Method 3 - Install pre-built binaries
+
+ *Does not work* as of Sep-2025 because the grammar build is too old. Please
use one of the other
+ methods.
+
+ Install the pre-built binaries from
http://github.com/emacs-tree-sitter/tree-sitter-langs
+ using the following after installing the MATLAB package from
[[file:../README.org][MELPA]]:
+
+ : M-x matlab-ts-langs-install
+
+ and install matlab (and other languages tree-sitter shared objects if you'd
like).
+
* Setup Emacs to use the MATLAB tree-sitter grammar
Tell Emacs to use *matlab-ts-mode* for MATLAB files by adding the following to
your
diff --git a/matlab-mode.el b/matlab-mode.el
index c85bffde6b..d605217363 100644
--- a/matlab-mode.el
+++ b/matlab-mode.el
@@ -1,6 +1,6 @@
;;; matlab-mode.el --- Major mode for MATLAB(R) dot-m files -*-
lexical-binding: t -*-
-;; Version: 7.1.2
+;; Version: 7.2.0
;; URL: https://github.com/mathworks/Emacs-MATLAB-Mode
;; SPDX-License-Identifier: GPL-3.0-or-later
diff --git a/matlab-ts-mode.el b/matlab-ts-mode.el
index 4968c7113b..a201dcd960 100644
--- a/matlab-ts-mode.el
+++ b/matlab-ts-mode.el
@@ -1,6 +1,6 @@
;;; matlab-ts-mode.el --- MATLAB(R) Tree-Sitter Mode -*- lexical-binding: t -*-
-;; Version: 7.1.2
+;; Version: 7.2.0
;; URL: https://github.com/mathworks/Emacs-MATLAB-Mode
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
@@ -2049,6 +2049,8 @@ Prev-siblings:
(setq parent last-child-of-error-node))
(when (or last-child-of-error-node
+ ;; Is node, parent, or grandparent an error? We could look to
other ancestors,
+ ;; but that would indicate many syntax errors and result in
unexpected indent.
(and node (string= (treesit-node-type node) "ERROR"))
(string-match-p (rx (seq bos (or "ERROR" "\n") eos))
(treesit-node-type parent))
(equal (treesit-node-type (treesit-node-parent parent)) "ERROR"))
@@ -3122,6 +3124,7 @@ Returns t if tree-sitter NODE defines an outline heading."
(defun matlab-ts-mode-on-save-fix-name (&optional no-prompt)
"If file name and function/classdef name are different, offer to fix.
If optional NO-PROMPT is t, fix the name if needed without prompting."
+ ;; See ./tests/test-matlab-ts-mode-on-save-fixes.el
(interactive)
(when (or no-prompt (not noninteractive)) ;; can only prompt if in
interactive mode
(let* ((root (treesit-buffer-root-node))
@@ -3132,6 +3135,14 @@ If optional NO-PROMPT is t, fix the name if needed
without prompting."
;; Case: function_definition or class_definition
((string-match-p (rx bos (or "function_definition"
"class_definition") eos)
child-type)
+ (when (treesit-search-subtree child (rx bos "ERROR" eos))
+ ;; Don't try to fix code if there's an error, e.g. don't
change in1:
+ ;; function ...
+ ;; [ ...
+ ;; in1, ... comment about in1
+ ;; See:
test-matlab-ts-mode-on-save-fixes-files/on_save_no_fix_syntax_error.m
+ (cl-return))
+
(let* ((def-name-node (treesit-node-child-by-field-name
child "name"))
(def-name (treesit-node-text def-name-node))
(file-name (file-name-nondirectory (or
(buffer-file-name) (buffer-name))))
@@ -3156,7 +3167,7 @@ If optional NO-PROMPT is t, fix the name if needed
without prompting."
(insert base-name-no-ext))))))
(cl-return))
- ;; Case: any other code means this is a script, so no on
save fix
+ ;; Case: any other code means this is a script, so no "on
save fix name"
((not (string-match-p (rx bos (or "comment"
"line_continuation"
"\n")
diff --git a/matlab.el b/matlab.el
index 944ce5c207..6e721b4678 100644
--- a/matlab.el
+++ b/matlab.el
@@ -1,6 +1,6 @@
;;; matlab.el --- major mode for MATLAB(R) dot-m files -*- lexical-binding: t
-*-
-;; Version: 7.1.2
+;; Version: 7.2.0
;; URL: https://github.com/mathworks/Emacs-MATLAB-Mode
;; SPDX-License-Identifier: GPL-3.0-or-later
diff --git a/tests/t-utils.el b/tests/t-utils.el
index 3f54f83c86..125435e0cd 100644
--- a/tests/t-utils.el
+++ b/tests/t-utils.el
@@ -287,9 +287,16 @@
Optional TEST-DESCRIPTION defaults to \"this test input\"."
(let ((skip-file-contents (with-temp-buffer
(insert-file-contents-literally skip-file)
+ (let ((max-lines-to-show 6)
+ (n-lines (count-lines (point-min)
(point-max))))
+ (when (> n-lines max-lines-to-show)
+ (goto-char (point-min))
+ (forward-line max-lines-to-show)
+ (delete-region (point) (point-max))
+ (goto-char (point-max))
+ (insert "<snip>\n")))
(string-trim-right
- (replace-regexp-in-string "^" " "
- (buffer-string))))))
+ (replace-regexp-in-string "^" " "
(buffer-string))))))
(message "%s:1: warning: skipping %s because %s exists\n%s"
test-file (or test-description "this test input") skip-file
skip-file-contents)))
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_0X_and_0B_issue100.skip.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_0X_and_0B_issue100.skip.txt
deleted file mode 100644
index 3cce3e3c43..0000000000
---
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_0X_and_0B_issue100.skip.txt
+++ /dev/null
@@ -1 +0,0 @@
-See https://github.com/acristoffers/tree-sitter-matlab/issues/100
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_0X_and_0B_issue100_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_0X_and_0B_issue100_expected.txt
new file mode 100644
index 0000000000..cb5d654350
--- /dev/null
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_0X_and_0B_issue100_expected.txt
@@ -0,0 +1,7 @@
+c ccc ccccccccc ccc
+
+c ccc ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
+
+v o nnnnnn
+v o nnnnnn
+
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_binary_op_continued_issue107.m
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_binary_op_continued_issue107.m
new file mode 100644
index 0000000000..5d8056c2c8
--- /dev/null
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_binary_op_continued_issue107.m
@@ -0,0 +1,30 @@
+% -*- matlab-ts -*-
+
+% https://github.com/acristoffers/tree-sitter-matlab/issues/107
+
+v1 = {1 + 2};
+
+v2 = { ...
+ 1 ...
+ + ...
+ 2
+ };
+assert(isequal(v1, v2))
+
+v3 = [1 + 2];
+
+v4 = [ ...
+ 1 ...
+ + ...
+ 2
+ ];
+
+assert(isequal(v3, v4))
+
+v5 = 1 + 2;
+
+v6 = (1 ...
+ + ...
+ 2);
+
+assert(isequal(v5, v6))
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_binary_op_continued_issue107_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_binary_op_continued_issue107_expected.txt
new file mode 100644
index 0000000000..87dd8b892b
--- /dev/null
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_binary_op_continued_issue107_expected.txt
@@ -0,0 +1,30 @@
+c ccc ccccccccc ccc
+
+c ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
+
+vv o bn o nbD
+
+vv o b ccc
+ n ccc
+ o ccc
+ n
+ bD
+BBBBBBbBBBBBBBbddD ddbb
+
+vv o bn o nbD
+
+vv o b ccc
+ n ccc
+ o ccc
+ n
+ bD
+
+BBBBBBbBBBBBBBbddD ddbb
+
+vv o n o nD
+
+vv o bn ccc
+ o ccc
+ nbD
+
+BBBBBBbBBBBBBBbddD ddbb
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_classdef_end_override_issue98_subclass.skip.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_classdef_end_override_issue98_subclass.skip.txt
deleted file mode 100644
index fa2e242793..0000000000
---
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_classdef_end_override_issue98_subclass.skip.txt
+++ /dev/null
@@ -1 +0,0 @@
-see https://github.com/acristoffers/tree-sitter-matlab/issues/98
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_classdef_end_override_issue98_subclass_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_classdef_end_override_issue98_subclass_expected.txt
new file mode 100644
index 0000000000..6cc70345e2
--- /dev/null
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_classdef_end_override_issue98_subclass_expected.txt
@@ -0,0 +1,8 @@
+c ccc ccccccccc ccc
+
+kkkkkkkk ffffffffffffffffffffffffffffffffffffffffffffffff o
fffffffffffffffffffffffffffffffffffff
+ kkkkkkk
+ kkkkkkkk vvv o kkkbvvvD vD vb
+ kkk
+ kkk
+kkk
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_classdef_end_override_issue98_super.skip.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_classdef_end_override_issue98_super.skip.txt
deleted file mode 100644
index fa2e242793..0000000000
---
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_classdef_end_override_issue98_super.skip.txt
+++ /dev/null
@@ -1 +0,0 @@
-see https://github.com/acristoffers/tree-sitter-matlab/issues/98
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_classdef_end_override_issue98_super_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_classdef_end_override_issue98_super_expected.txt
new file mode 100644
index 0000000000..fca46d649c
--- /dev/null
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_classdef_end_override_issue98_super_expected.txt
@@ -0,0 +1,12 @@
+c ccc ccccccccc ccc
+
+c ccc cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
+
+c ccc ccccccccc ccc ccc cccccccc
+c
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
+
+kkkkkkkk bttttttttb fffffffffffffffffffffffffffffffffffff
+ kkkkkkk
+ ddd o dddbdddD dD dbD
+ kkk
+kkk
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_command_with_trailing_whitespace_fcn1_issue94.skip.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_command_with_trailing_whitespace_fcn1_issue94.skip.txt
deleted file mode 100644
index 5da68d56f0..0000000000
---
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_command_with_trailing_whitespace_fcn1_issue94.skip.txt
+++ /dev/null
@@ -1 +0,0 @@
-See: https://github.com/acristoffers/tree-sitter-matlab/issues/94
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_command_with_trailing_whitespace_fcn1_issue94_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_command_with_trailing_whitespace_fcn1_issue94_expected.txt
new file mode 100644
index 0000000000..41bf1a25b4
--- /dev/null
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_command_with_trailing_whitespace_fcn1_issue94_expected.txt
@@ -0,0 +1,8 @@
+c ccc ccccccccc ccc
+
+c cccc cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
+
+c cccccccccc ccccc cccc
+dddd
+v o ddddbSsssSD BBBBBD ccc
+ SsssSD BBBBb
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_command_with_trailing_whitespace_issue94.skip.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_command_with_trailing_whitespace_issue94.skip.txt
deleted file mode 100644
index b2d988915e..0000000000
---
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_command_with_trailing_whitespace_issue94.skip.txt
+++ /dev/null
@@ -1 +0,0 @@
-See https://github.com/acristoffers/tree-sitter-matlab/issues/94
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_command_with_trailing_whitespace_issue94_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_command_with_trailing_whitespace_issue94_expected.txt
new file mode 100644
index 0000000000..a9dc6b6c96
--- /dev/null
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_command_with_trailing_whitespace_issue94_expected.txt
@@ -0,0 +1,14 @@
+c ccc ccccccccc ccc
+
+
+c ccc cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
+
+
+kk d
+ kkk
+ BBBBBBBBBBBB
+ kkkkk dd
+ kkk
+ c cccccccc ccccc ccccc ccccccccccccc
+ BBBBBBBBBBBBB
+kkk
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_continue_to_empty_issue104.skip.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_continue_to_empty_issue104.skip.txt
deleted file mode 100644
index ac2ed4d83c..0000000000
---
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_continue_to_empty_issue104.skip.txt
+++ /dev/null
@@ -1 +0,0 @@
-see https://github.com/acristoffers/tree-sitter-matlab/issues/104
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_continue_to_empty_issue104_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_continue_to_empty_issue104_expected.txt
new file mode 100644
index 0000000000..0ebdd8ddd4
--- /dev/null
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_continue_to_empty_issue104_expected.txt
@@ -0,0 +1,11 @@
+c ccc ccccccccc ccc
+
+c ccc ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
+
+v o SsSD
+kkkkkk d
+ kkkk SsS ccc
+
+ BBBBbSssssSbD
+kkk
+
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_continued_metaclass_op_issue103.skip.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_continued_metaclass_op_issue103.skip.txt
deleted file mode 100644
index 159546da1f..0000000000
---
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_continued_metaclass_op_issue103.skip.txt
+++ /dev/null
@@ -1 +0,0 @@
-see https://github.com/acristoffers/tree-sitter-matlab/issues/103
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_continued_metaclass_op_issue103_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_continued_metaclass_op_issue103_expected.txt
new file mode 100644
index 0000000000..54cf98a7ff
--- /dev/null
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_continued_metaclass_op_issue103_expected.txt
@@ -0,0 +1,11 @@
+c ccc ccccccccc ccc
+
+c ccc ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
+
+kkkkkkkk fffffffffffffffffffffffffffffffffffffffff
+ kkkkkkkkkk bttttttttt o bodddDBBBccc
+ Ddbb
+ PP
+ kkk
+kkk
+
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_d_style_floats_issue95.skip.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_d_style_floats_issue95.skip.txt
deleted file mode 100644
index b63fc7b36a..0000000000
---
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_d_style_floats_issue95.skip.txt
+++ /dev/null
@@ -1 +0,0 @@
-See https://github.com/acristoffers/tree-sitter-matlab/issues/95
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_d_style_floats_issue95_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_d_style_floats_issue95_expected.txt
new file mode 100644
index 0000000000..a09f9efe31
--- /dev/null
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_d_style_floats_issue95_expected.txt
@@ -0,0 +1,6 @@
+c ccc ccccccccc ccc
+
+c ccc cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
+
+v o nnnnnnnD
+v o nnnnnnnD
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_dot_comments_issue96.skip.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_dot_comments_issue96.skip.txt
deleted file mode 100644
index fc9d4e1854..0000000000
---
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_dot_comments_issue96.skip.txt
+++ /dev/null
@@ -1 +0,0 @@
-see https://github.com/acristoffers/tree-sitter-matlab/issues/96
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_dot_comments_issue96_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_dot_comments_issue96_expected.txt
new file mode 100644
index 0000000000..f156723ca6
--- /dev/null
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_dot_comments_issue96_expected.txt
@@ -0,0 +1,18 @@
+c ccc ccccccccc ccc
+
+c ccc cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
+
+kkkkkkkk fffbvvvb
+
+ ccccc ccccc ccccc cccc
+
+ kk ddd o n
+ BBBBbSsSb
+ kkkkkk ddd oo n
+ BBBBbSsSbD
+ kkk
+
+ ccccc ccccc ccc cccc
+
+kkk
+
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_end_continued_issue108.m
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_end_continued_issue108.m
index a5982fa399..cce119d788 100644
---
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_end_continued_issue108.m
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_end_continued_issue108.m
@@ -1,4 +1,7 @@
% -*- matlab-ts -*-
+
+% https://github.com/acristoffers/tree-sitter-matlab/issues/108
+
foo = 1;
E = 2;
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_end_continued_issue108.skip.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_end_continued_issue108.skip.txt
deleted file mode 100644
index 316b858bfb..0000000000
---
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_end_continued_issue108.skip.txt
+++ /dev/null
@@ -1 +0,0 @@
-https://github.com/acristoffers/tree-sitter-matlab/issues/108
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_end_continued_issue108_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_end_continued_issue108_expected.txt
new file mode 100644
index 0000000000..b9beaa842f
--- /dev/null
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_end_continued_issue108_expected.txt
@@ -0,0 +1,12 @@
+c ccc ccccccccc ccc
+
+c ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
+
+vvv o nD
+v o nD
+
+kk ddd
+ v o dD
+kkk ccc ccccccc
+
+vonD
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_methods_in_namespace.skip.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_methods_in_namespace.skip.txt
deleted file mode 100644
index d108163ce1..0000000000
---
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_methods_in_namespace.skip.txt
+++ /dev/null
@@ -1 +0,0 @@
-see https://github.com/acristoffers/tree-sitter-matlab/issues/97
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_methods_in_namespace.m
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_methods_in_namespace_issue97.m
similarity index 100%
rename from
tests/test-matlab-ts-mode-font-lock-files/font_lock_methods_in_namespace.m
rename to
tests/test-matlab-ts-mode-font-lock-files/font_lock_methods_in_namespace_issue97.m
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_methods_in_namespace_issue97_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_methods_in_namespace_issue97_expected.txt
new file mode 100644
index 0000000000..c5f91c3911
--- /dev/null
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_methods_in_namespace_issue97_expected.txt
@@ -0,0 +1,10 @@
+c ccc ccccccccc ccc
+
+c ccc cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
+
+kkkkkkkk ffffffffffffffffffffffffffffff
+ kkkkkkk
+ kkkkkkkk vvvvvvvvvvv o dddddddDddddddddbvvvvvvvvvvb
+ kkk
+ kkk
+kkk
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_numbers_with_word_size_in_cell_issue_106.skip.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_numbers_with_word_size_in_cell_issue_106.skip.txt
deleted file mode 100644
index 8bdedb13a7..0000000000
---
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_numbers_with_word_size_in_cell_issue_106.skip.txt
+++ /dev/null
@@ -1 +0,0 @@
-See: https://github.com/acristoffers/tree-sitter-matlab/issues/106
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_numbers_with_word_size_in_cell_issue_106_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_numbers_with_word_size_in_cell_issue_106_expected.txt
new file mode 100644
index 0000000000..fee2d9dbf1
--- /dev/null
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_numbers_with_word_size_in_cell_issue_106_expected.txt
@@ -0,0 +1,29 @@
+c ccc ccccccccc ccc
+
+c cccc ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
+
+c ccc
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
+c
+c cc ccccccc cccccccc ccc cccc cccc ccc cccccc ccccccc cccccc ccc ccc cccccccc
ccc cccc cccc ccc cccc
+c cc ccccccc cccccc ccc cccc cccc ccc cccccc ccccccc cccccc ccc ccc cccccccc
ccc cccc cccc ccc cccc
+
+v o bnnnnnnD nb
+v o bnnnnnnnD nb
+v o bnnnnnnnD nb
+v o bnnnnnnnD nb
+
+v o bnnnnnnD nb
+v o bnnnnnnnD nb
+v o bnnnnnnnD nb
+v o bnnnnnnnD nb
+
+V o bnnnnnnnnD nb
+V o bnnnnnnnnnD nb
+v o bnnnnnnnnnD nb
+v o bnnnnnnnnnD nb
+
+v o bnnnnnnnnD nb
+v o bnnnnnnnnnD nb
+v o bnnnnnnnnnD nb
+v o bnnnnnnnnnD nb
+
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_struct_function_field_colon_issue102.skip.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_struct_function_field_colon_issue102.skip.txt
deleted file mode 100644
index 37b10f1e65..0000000000
---
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_struct_function_field_colon_issue102.skip.txt
+++ /dev/null
@@ -1 +0,0 @@
-see https://github.com/acristoffers/tree-sitter-matlab/issues/102
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_struct_function_field_colon_issue102_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_struct_function_field_colon_issue102_expected.txt
new file mode 100644
index 0000000000..52e1fba037
--- /dev/null
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_struct_function_field_colon_issue102_expected.txt
@@ -0,0 +1,23 @@
+c ccc ccccccccc ccc
+
+c ccc ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
+
+dDdddddddd o bnD nD ccc
+ nD nbD
+
+v o bdDkkkkkkkkbDDnbb
+
+dDkkkkkkkkbDDnb
+
+v o dDkkkkkkkkbnDnbD
+
+v o bdDkkkkkkkkbnDnbbD
+
+c ccccccccccccccccccccccccccccccc
+c cccccccc c c ccc
+c c c cc
+c ccc
+
+v o bddddddddddDddddddddddccc
+ Ddddb
+
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_try_on_one_line_issue99.skip.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_try_on_one_line_issue99.skip.txt
deleted file mode 100644
index 52259a0d36..0000000000
---
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_try_on_one_line_issue99.skip.txt
+++ /dev/null
@@ -1 +0,0 @@
-see https://github.com/acristoffers/tree-sitter-matlab/issues/99
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_try_on_one_line_issue99_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_try_on_one_line_issue99_expected.txt
new file mode 100644
index 0000000000..e20b9057a4
--- /dev/null
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_try_on_one_line_issue99_expected.txt
@@ -0,0 +1,5 @@
+c ccc ccccccccc ccc
+c ccc cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
+kkk VonDn
+ kkk BBBbdddddddddddD BBBBBBBBbdddddbD BBBBBBBBbdddddonbbD kkkkk kkkkkD kkk
+kkk
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_two_ends_on_a_single_line_issue105.m
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_two_ends_on_a_single_line_issue105.m
new file mode 100644
index 0000000000..109251e20b
--- /dev/null
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_two_ends_on_a_single_line_issue105.m
@@ -0,0 +1,10 @@
+% -*- matlab-ts -*-
+
+% https://github.com/acristoffers/tree-sitter-matlab/issues/105
+
+classdef font_lock_two_ends_on_a_single_line_issue105
+ methods
+ function b=foo(a)
+ b=a;
+ end end
+end
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_two_ends_on_a_single_line_issue105_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_two_ends_on_a_single_line_issue105_expected.txt
new file mode 100644
index 0000000000..6026dd51af
--- /dev/null
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_two_ends_on_a_single_line_issue105_expected.txt
@@ -0,0 +1,10 @@
+c ccc ccccccccc ccc
+
+c ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
+
+kkkkkkkk ffffffffffffffffffffffffffffffffffffffffffff
+ kkkkkkk
+ kkkkkkkk vofffbvb
+ vodD
+ kkk kkk
+kkk
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_unnecessary_semicolon_issue101.skip.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_unnecessary_semicolon_issue101.skip.txt
deleted file mode 100644
index 5a766dc7aa..0000000000
---
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_unnecessary_semicolon_issue101.skip.txt
+++ /dev/null
@@ -1 +0,0 @@
-see https://github.com/acristoffers/tree-sitter-matlab/issues/101
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_unnecessary_semicolon_issue101_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_unnecessary_semicolon_issue101_expected.txt
new file mode 100644
index 0000000000..fb1b38d67c
--- /dev/null
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_unnecessary_semicolon_issue101_expected.txt
@@ -0,0 +1,10 @@
+c ccc ccccccccc ccc
+
+c ccc ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
+
+kkkkkkkk ffffffffffffffffffffffffffffffffffffffffbvvvb
+ D
+ kk ddd
+ BBBBbSsssSb
+ kkk
+kkk
diff --git a/tests/test-matlab-ts-mode-indent-files/indent_cell_expected_msgs.m
b/tests/test-matlab-ts-mode-indent-files/indent_cell_expected_msgs.m
index 12249a9e68..cb9baba879 100644
--- a/tests/test-matlab-ts-mode-indent-files/indent_cell_expected_msgs.m
+++ b/tests/test-matlab-ts-mode-indent-files/indent_cell_expected_msgs.m
@@ -2,8 +2,8 @@
function [a1, a2, a3, a4, long_variable_a] = indent_cell % <{Matched rule:
((lambda (node parent _bol &rest _) (and node (not (string= (treesit-node-type
node) "line_continuation")) (equal (treesit-node-type parent) "source_file")))
(lambda (_node _parent bol &rest _) (save-excursion (goto-char bol)
(line-beginning-position))) 0)}>
a1 = { ... % <{Matched rule: ((parent-is "\\`function_definition\\'")
parent matlab-ts-mode--set-function-indent-level-for-gp)}>
1 ... % <{Matched rule: ((parent-is "\\`\\(?:cell\\|matrix\\)\\'")
parent 2)}>
- + ... % <{Matched rule: ((parent-is
"\\`\\(?:function_output\\|row\\)\\'") parent 0)}>
- 2 % <{Matched rule: (matlab-ts-mode--i-cont-matcher parent
matlab-ts-mode--i-cont-offset)}>
+ + ... % <{Matched rule: ((parent-is "\\`binary_operator\\'")
parent 0)}>
+ 2 % <{Matched rule: ((parent-is "\\`binary_operator\\'") parent
0)}>
}; % <{Matched rule: ((node-is "\\`[])}]\\'") parent 0)}>
a2 = { 1 ... % <{Matched rule: ((parent-is "\\`block\\'") parent 0)}>
diff --git
a/tests/test-matlab-ts-mode-indent-files/indent_fcn_ellipsis.skip.typing.txt
b/tests/test-matlab-ts-mode-indent-files/indent_fcn_ellipsis.skip.typing.txt
new file mode 100644
index 0000000000..b7e289b850
--- /dev/null
+++ b/tests/test-matlab-ts-mode-indent-files/indent_fcn_ellipsis.skip.typing.txt
@@ -0,0 +1,100 @@
+# -*- org -*-
+
+Don't seem to have enough info to get typing via line-by-line.
+Given foo.m containg, TAB on the 3rd line using the following patch works.
+
+#+begin_src matlab
+ function ...
+ [ ...
+ a, ...
+#+end_src
+
+which has parse tree
+
+#+begin_example
+(function_definition function name: (line_continuation)
+ (ERROR [)
+ (line_continuation) (identifier) , (line_continuation) \n)
+#+end_example
+
+If we then add a 4th line
+#+begin_src matlab
+ function ...
+ [ ...
+ a, ...
+ b ...
+#+end_src
+
+We don't have enough info to indent (TAB on 4th line). For the 4 lines, we
have parse tree:
+
+#+begin_example
+(function_definition function name: (line_continuation)
+ (ERROR [)
+ (line_continuation) (identifier) , (line_continuation)
+ (block (identifier) (line_continuation) \n \n))
+#+end_example
+
+#+begin_src diff
+--- matlab-ts-mode.el 2025-10-29 11:56:39.000000000 -0400
++++ matlab-ts-mode-fcn-cont.el 2025-10-29 11:55:24.447575406 -0400
+@@ -2015,6 +2015,23 @@
+
+ (cons prev-sibling-to-check prev-sibling-error-node)))
+
++(defun matlab-ts-mode--is-near-ancestor-an-error (node parent)
++ "Is NODE or PARENT an error node or within a near error node?"
++ ;; Is node, parent, or grandparent an error? We could look to other
ancestors,
++ ;; but that would indicate many syntax errors and result in unexpected
indent.
++ (or (and node (string= (treesit-node-type node) "ERROR"))
++ (string-match-p (rx (seq bos (or "ERROR" "\n") eos)) (treesit-node-type
parent))
++ (equal (treesit-node-type (treesit-node-parent parent)) "ERROR")))
++
++(defun matlab-ts-mode--is-near-sibling-an-error (node)
++ "Is NODE near sibling an error node, if so return the error node."
++ (let ((prev-sibling (treesit-node-prev-sibling node)))
++ (while (and prev-sibling
++ (string= (treesit-node-type prev-sibling)
"line_continuation"))
++ (setq prev-sibling (treesit-node-prev-sibling prev-sibling)))
++ (when (string= (treesit-node-type prev-sibling) "ERROR")
++ prev-sibling)))
++
+ (cl-defun matlab-ts-mode--i-next-line-matcher (node parent bol &rest _)
+ "Matcher for indent on a newline being inserted when in presence of errors.
+ If so, set `matlab-ts-mode--i-next-line-pair'.
+@@ -2049,11 +2066,8 @@
+ (setq parent last-child-of-error-node))
+
+ (when (or last-child-of-error-node
+- ;; Is node, parent, or grandparent an error? We could look to
other ancestors,
+- ;; but that would indicate many syntax errors and result in
unexpected indent.
+- (and node (string= (treesit-node-type node) "ERROR"))
+- (string-match-p (rx (seq bos (or "ERROR" "\n") eos))
(treesit-node-type parent))
+- (equal (treesit-node-type (treesit-node-parent parent))
"ERROR"))
++ (matlab-ts-mode--is-near-ancestor-an-error node parent)
++ (matlab-ts-mode--is-near-sibling-an-error node))
+
+ (let ((node-to-check (or last-child-of-error-node node parent))
+ ancestor-error-node ;; is node, parent, or one of it's ancestors
an ERROR?
+@@ -2090,7 +2104,11 @@
+ ;; We use regular matching rules when there is NO error.
+ (when (and (not ancestor-error-node)
+ (not prev-sibling-error-node))
+- (cl-return-from matlab-ts-mode--i-next-line-matcher nil))
++ (when prev-sibling-to-check
++ (setq ancestor-to-check nil
++ prev-sibling-error-node
(matlab-ts-mode--is-near-sibling-an-error node)))
++ (when (not prev-sibling-error-node)
++ (cl-return-from matlab-ts-mode--i-next-line-matcher nil)))
+
+ (let ((anchor-node (or ancestor-to-check
+ prev-sibling-to-check)))
+@@ -3142,7 +3160,7 @@
+ ;; in1, ... comment about in1
+ ;; See:
test-matlab-ts-mode-on-save-fixes-files/on_save_no_fix_syntax_error.m
+ (cl-return))
+-
++
+ (let* ((def-name-node (treesit-node-child-by-field-name
child "name"))
+ (def-name (treesit-node-text def-name-node))
+ (file-name (file-name-nondirectory (or
(buffer-file-name) (buffer-name))))
+#+end_src
diff --git
a/tests/test-matlab-ts-mode-indent-files/indent_line_continuation_row_expected_msgs.m
b/tests/test-matlab-ts-mode-indent-files/indent_line_continuation_row_expected_msgs.m
index fe47bb0521..64e5973e75 100644
---
a/tests/test-matlab-ts-mode-indent-files/indent_line_continuation_row_expected_msgs.m
+++
b/tests/test-matlab-ts-mode-indent-files/indent_line_continuation_row_expected_msgs.m
@@ -2,7 +2,7 @@
function a = indent_line_continuation_row % <{Matched rule: ((lambda (node
parent _bol &rest _) (and node (not (string= (treesit-node-type node)
"line_continuation")) (equal (treesit-node-type parent) "source_file")))
(lambda (_node _parent bol &rest _) (save-excursion (goto-char bol)
(line-beginning-position))) 0)}>
a = { ... % <{Matched rule: ((parent-is "\\`function_definition\\'")
parent matlab-ts-mode--set-function-indent-level-for-gp)}>
1 ... % <{Matched rule: ((parent-is "\\`\\(?:cell\\|matrix\\)\\'")
parent 2)}>
- + ... % <{Matched rule: ((parent-is
"\\`\\(?:function_output\\|row\\)\\'") parent 0)}>
- 2 ... % <{Matched rule: (matlab-ts-mode--i-cont-matcher parent
matlab-ts-mode--i-cont-offset)}>
+ + ... % <{Matched rule: ((parent-is "\\`binary_operator\\'") parent
0)}>
+ 2 ... % <{Matched rule: ((parent-is "\\`binary_operator\\'") parent
0)}>
}; % <{Matched rule: ((node-is "\\`[])}]\\'") parent 0)}>
end % <{Matched rule: ((node-is
"\\`\\(?:catch_clause\\|e\\(?:lse\\(?:\\(?:if\\)?_clause\\)\\|nd\\)\\)\\'")
parent 0)}>
diff --git
a/tests/test-matlab-ts-mode-indent-files/indent_matrix_expected_msgs.m
b/tests/test-matlab-ts-mode-indent-files/indent_matrix_expected_msgs.m
index d0870bf083..540f37169d 100644
--- a/tests/test-matlab-ts-mode-indent-files/indent_matrix_expected_msgs.m
+++ b/tests/test-matlab-ts-mode-indent-files/indent_matrix_expected_msgs.m
@@ -2,8 +2,8 @@
function indent_matrix % <{Matched rule: ((lambda (node parent _bol &rest _)
(and node (not (string= (treesit-node-type node) "line_continuation")) (equal
(treesit-node-type parent) "source_file"))) (lambda (_node _parent bol &rest _)
(save-excursion (goto-char bol) (line-beginning-position))) 0)}>
a = [ ... % <{Matched rule: ((parent-is "\\`function_definition\\'")
parent matlab-ts-mode--set-function-indent-level-for-gp)}>
1 ... % <{Matched rule: ((parent-is "\\`\\(?:cell\\|matrix\\)\\'")
parent 2)}>
- + ... % <{Matched rule: ((parent-is
"\\`\\(?:function_output\\|row\\)\\'") parent 0)}>
- 2 % <{Matched rule: (matlab-ts-mode--i-cont-matcher parent
matlab-ts-mode--i-cont-offset)}>
+ + ... % <{Matched rule: ((parent-is "\\`binary_operator\\'") parent
0)}>
+ 2 % <{Matched rule: ((parent-is "\\`binary_operator\\'") parent 0)}>
]; % <{Matched rule: ((node-is "\\`[])}]\\'") parent 0)}>
disp(a); % <{Matched rule: ((parent-is "\\`block\\'") parent 0)}>
diff --git
a/tests/test-matlab-ts-mode-indent-files/indent_old_indents_expected_msgs.m
b/tests/test-matlab-ts-mode-indent-files/indent_old_indents_expected_msgs.m
index f18394a058..8843a4ef0e 100644
--- a/tests/test-matlab-ts-mode-indent-files/indent_old_indents_expected_msgs.m
+++ b/tests/test-matlab-ts-mode-indent-files/indent_old_indents_expected_msgs.m
@@ -92,7 +92,7 @@ function B = ends_in_comments_and_strings() % <{Matched
rule: ((lambda (node pa
A = C; % <{Matched rule: ((node-is
"\\`\\(?:arguments_statement\\|block\\|e\\(?:num\\(?:eration\\)?\\|vents\\)\\|function_definition\\|methods\\|propert\\(?:ies\\|y\\)\\)\\'")
parent 4)}>
end; B = [ 1 2 ... % is this the end? % <{Matched rule: ((node-is
"\\`\\(?:catch_clause\\|e\\(?:lse\\(?:\\(?:if\\)?_clause\\)\\|nd\\)\\)\\'")
parent 0)}>
- 3 4 ]; % !!15 % <{Matched rule: ((parent-is
"\\`\\(?:function_output\\|row\\)\\'") parent 0)}>
+ 3 4 ]; % !!15 % <{Matched rule:
(matlab-ts-mode--i-row-matcher matlab-ts-mode--i-row-anchor 0)}>
% !!4 % <{Matched rule: ((parent-is "\\`block\\'") parent 0)}>
@@ -144,7 +144,7 @@ function out = array_constant_decls() % <{Matched rule:
((lambda (node parent _
multinest = { [ 1 2 %!!4 % <{Matched rule: ((parent-is
"\\`block\\'") parent 0)}>
3 4 ]; %!!20 % <{Matched rule:
(matlab-ts-mode--i-row-matcher matlab-ts-mode--i-row-anchor 0)}>
{ 5 6 7 ... %!!18 % <{Matched rule:
(matlab-ts-mode--i-row-matcher matlab-ts-mode--i-row-anchor 0)}>
- 8 9 10 ... %!!20 % <{Matched rule: ((parent-is
"\\`\\(?:function_output\\|row\\)\\'") parent 0)}>
+ 8 9 10 ... %!!20 % <{Matched rule:
(matlab-ts-mode--i-row-matcher matlab-ts-mode--i-row-anchor 0)}>
}; %!!18 % <{Matched rule: ((node-is
"\\`[])}]\\'") parent 0)}>
fcncall(10, ... %!!18 % <{Matched rule:
(matlab-ts-mode--i-row-matcher matlab-ts-mode--i-row-anchor 0)}>
12, ... %!!26 % <{Matched rule: ((parent-is
"\\`arguments\\'") parent 0)}>
@@ -157,7 +157,7 @@ function out = array_constant_decls() % <{Matched rule:
((lambda (node parent _
[ ... %!!8 % <{Matched rule: ((parent-is
"\\`\\(?:cell\\|matrix\\)\\'") parent 2)}>
2 3 %!!10 % <{Matched rule: ((parent-is
"\\`\\(?:cell\\|matrix\\)\\'") parent 2)}>
] ... %!!8 % <{Matched rule: ((node-is "\\`[])}]\\'") parent
0)}>
- 3 %!!8 % <{Matched rule: ((parent-is
"\\`\\(?:function_output\\|row\\)\\'") parent 0)}>
+ 3 %!!8 % <{Matched rule: ((parent-is
"\\`\\(?:cell\\|matrix\\)\\'") parent 2)}>
}; %!!11 % <{Matched rule: ((node-is "\\`[])}]\\'") parent 0)}>
cascade_long_name = ... %!!4 % <{Matched rule: ((parent-is "\\`block\\'")
parent 0)}>
diff --git
a/tests/test-matlab-ts-mode-indent-files/indent_old_indents_for_typing_expected_msgs.m
b/tests/test-matlab-ts-mode-indent-files/indent_old_indents_for_typing_expected_msgs.m
index 250655babf..8262597a31 100644
---
a/tests/test-matlab-ts-mode-indent-files/indent_old_indents_for_typing_expected_msgs.m
+++
b/tests/test-matlab-ts-mode-indent-files/indent_old_indents_for_typing_expected_msgs.m
@@ -94,7 +94,7 @@ function B = ends_in_comments_and_strings() % <{Matched
rule: ((lambda (node pa
A = C; % <{Matched rule: ((node-is
"\\`\\(?:arguments_statement\\|block\\|e\\(?:num\\(?:eration\\)?\\|vents\\)\\|function_definition\\|methods\\|propert\\(?:ies\\|y\\)\\)\\'")
parent 4)}>
end; B = [ 1 2 ... % is this the end? % <{Matched rule: ((node-is
"\\`\\(?:catch_clause\\|e\\(?:lse\\(?:\\(?:if\\)?_clause\\)\\|nd\\)\\)\\'")
parent 0)}>
- 3 4 ]; % !!15 % <{Matched rule: ((parent-is
"\\`\\(?:function_output\\|row\\)\\'") parent 0)}>
+ 3 4 ]; % !!15 % <{Matched rule:
(matlab-ts-mode--i-row-matcher matlab-ts-mode--i-row-anchor 0)}>
% !!4 % <{Matched rule: ((parent-is "\\`block\\'") parent 0)}>
@@ -146,7 +146,7 @@ function out = array_constant_decls() % <{Matched rule:
((lambda (node parent _
multinest = { [ 1 2 %!!4 % <{Matched rule: ((parent-is
"\\`block\\'") parent 0)}>
3 4 ]; %!!20 % <{Matched rule:
(matlab-ts-mode--i-row-matcher matlab-ts-mode--i-row-anchor 0)}>
{ 5 6 7 ... %!!18 % <{Matched rule:
(matlab-ts-mode--i-row-matcher matlab-ts-mode--i-row-anchor 0)}>
- 8 9 10 ... %!!20 % <{Matched rule: ((parent-is
"\\`\\(?:function_output\\|row\\)\\'") parent 0)}>
+ 8 9 10 ... %!!20 % <{Matched rule:
(matlab-ts-mode--i-row-matcher matlab-ts-mode--i-row-anchor 0)}>
}; %!!18 % <{Matched rule: ((node-is
"\\`[])}]\\'") parent 0)}>
fcncall(10, ... %!!18 % <{Matched rule:
(matlab-ts-mode--i-row-matcher matlab-ts-mode--i-row-anchor 0)}>
12, ... %!!26 % <{Matched rule: ((parent-is
"\\`arguments\\'") parent 0)}>
@@ -159,7 +159,7 @@ function out = array_constant_decls() % <{Matched rule:
((lambda (node parent _
[ ... %!!8 % <{Matched rule: ((parent-is
"\\`\\(?:cell\\|matrix\\)\\'") parent 2)}>
2 3 %!!10 % <{Matched rule: ((parent-is
"\\`\\(?:cell\\|matrix\\)\\'") parent 2)}>
] ... %!!8 % <{Matched rule: ((node-is "\\`[])}]\\'") parent
0)}>
- 3 %!!8 % <{Matched rule: ((parent-is
"\\`\\(?:function_output\\|row\\)\\'") parent 0)}>
+ 3 %!!8 % <{Matched rule: ((parent-is
"\\`\\(?:cell\\|matrix\\)\\'") parent 2)}>
}; %!!11 % <{Matched rule: ((node-is "\\`[])}]\\'") parent 0)}>
cascade_long_name = ... %!!4 % <{Matched rule: ((parent-is "\\`block\\'")
parent 0)}>
diff --git
a/tests/test-matlab-ts-mode-indent-files/indent_string_concat_continued.m
b/tests/test-matlab-ts-mode-indent-files/indent_string_concat_continued.m
new file mode 100644
index 0000000000..9db491130a
--- /dev/null
+++ b/tests/test-matlab-ts-mode-indent-files/indent_string_concat_continued.m
@@ -0,0 +1,7 @@
+% -*- matlab-ts -*-
+
+someStr = "[" + ...
+ "[[""A"", 1], [""B"", 2]]," + ...
+ "[[""C"", 3]]," + ...
+ "[[""D"", 4], [""E"", 5], [""F"", 6]]" + ...
+ "]";
diff --git
a/tests/test-matlab-ts-mode-indent-files/indent_string_concat_continued_expected.m
b/tests/test-matlab-ts-mode-indent-files/indent_string_concat_continued_expected.m
new file mode 100644
index 0000000000..6288863efa
--- /dev/null
+++
b/tests/test-matlab-ts-mode-indent-files/indent_string_concat_continued_expected.m
@@ -0,0 +1,7 @@
+% -*- matlab-ts -*-
+
+someStr = "[" + ...
+ "[[""A"", 1], [""B"", 2]]," + ...
+ "[[""C"", 3]]," + ...
+ "[[""D"", 4], [""E"", 5], [""F"", 6]]" + ...
+ "]";
diff --git
a/tests/test-matlab-ts-mode-indent-files/indent_string_concat_continued_expected_msgs.m
b/tests/test-matlab-ts-mode-indent-files/indent_string_concat_continued_expected_msgs.m
new file mode 100644
index 0000000000..9b2375af63
--- /dev/null
+++
b/tests/test-matlab-ts-mode-indent-files/indent_string_concat_continued_expected_msgs.m
@@ -0,0 +1,7 @@
+% -*- matlab-ts -*- % <{Matched rule: ((lambda (node parent _bol &rest _)
(and node (not (string= (treesit-node-type node) "line_continuation")) (equal
(treesit-node-type parent) "source_file"))) (lambda (_node _parent bol &rest _)
(save-excursion (goto-char bol) (line-beginning-position))) 0)}>
+
+someStr = "[" + ... % <{Matched rule: ((lambda (node parent _bol &rest _)
(and node (not (string= (treesit-node-type node) "line_continuation")) (equal
(treesit-node-type parent) "source_file"))) (lambda (_node _parent bol &rest _)
(save-excursion (goto-char bol) (line-beginning-position))) 0)}>
+ "[[""A"", 1], [""B"", 2]]," + ... % <{Matched rule: ((parent-is
"\\`binary_operator\\'") parent 0)}>
+ "[[""C"", 3]]," + ... % <{Matched rule: ((parent-is
"\\`binary_operator\\'") parent 0)}>
+ "[[""D"", 4], [""E"", 5], [""F"", 6]]" + ... % <{Matched rule:
((parent-is "\\`binary_operator\\'") parent 0)}>
+ "]"; % <{Matched rule: ((parent-is "\\`binary_operator\\'") parent
0)}>
diff --git
a/tests/test-matlab-ts-mode-indent-files/indent_two_ends_on_a_line_issue105.skip.txt
b/tests/test-matlab-ts-mode-indent-files/indent_two_ends_on_a_line_issue105.skip.txt
deleted file mode 100644
index 45faa03bd8..0000000000
---
a/tests/test-matlab-ts-mode-indent-files/indent_two_ends_on_a_line_issue105.skip.txt
+++ /dev/null
@@ -1 +0,0 @@
-See https://github.com/acristoffers/tree-sitter-matlab/issues/105
diff --git
a/tests/test-matlab-ts-mode-indent-files/indent_two_ends_on_a_line_issue105_expected.m
b/tests/test-matlab-ts-mode-indent-files/indent_two_ends_on_a_line_issue105_expected.m
new file mode 100644
index 0000000000..c8ab9ba150
--- /dev/null
+++
b/tests/test-matlab-ts-mode-indent-files/indent_two_ends_on_a_line_issue105_expected.m
@@ -0,0 +1,10 @@
+% -*- matlab-ts -*-
+
+% See https://github.com/acristoffers/tree-sitter-matlab/issues/105
+
+classdef myclass
+ methods
+ function b=foo(a)
+ b=a;
+ end end
+end
diff --git
a/tests/test-matlab-ts-mode-indent-files/indent_two_ends_on_a_line_issue105_expected_msgs.m
b/tests/test-matlab-ts-mode-indent-files/indent_two_ends_on_a_line_issue105_expected_msgs.m
new file mode 100644
index 0000000000..f9619a82b2
--- /dev/null
+++
b/tests/test-matlab-ts-mode-indent-files/indent_two_ends_on_a_line_issue105_expected_msgs.m
@@ -0,0 +1,10 @@
+% -*- matlab-ts -*- % <{Matched rule: ((lambda (node parent _bol &rest _)
(and node (not (string= (treesit-node-type node) "line_continuation")) (equal
(treesit-node-type parent) "source_file"))) (lambda (_node _parent bol &rest _)
(save-excursion (goto-char bol) (line-beginning-position))) 0)}>
+
+% See https://github.com/acristoffers/tree-sitter-matlab/issues/105 %
<{Matched rule: ((lambda (node parent _bol &rest _) (and node (not (string=
(treesit-node-type node) "line_continuation")) (equal (treesit-node-type
parent) "source_file"))) (lambda (_node _parent bol &rest _) (save-excursion
(goto-char bol) (line-beginning-position))) 0)}>
+
+classdef myclass % <{Matched rule: ((lambda (node parent _bol &rest _) (and
node (not (string= (treesit-node-type node) "line_continuation")) (equal
(treesit-node-type parent) "source_file"))) (lambda (_node _parent bol &rest _)
(save-excursion (goto-char bol) (line-beginning-position))) 0)}>
+ methods % <{Matched rule: ((node-is
"\\`\\(?:arguments_statement\\|block\\|e\\(?:num\\(?:eration\\)?\\|vents\\)\\|function_definition\\|methods\\|propert\\(?:ies\\|y\\)\\)\\'")
parent 4)}>
+ function b=foo(a) % <{Matched rule: ((node-is
"\\`\\(?:arguments_statement\\|block\\|e\\(?:num\\(?:eration\\)?\\|vents\\)\\|function_definition\\|methods\\|propert\\(?:ies\\|y\\)\\)\\'")
parent 4)}>
+ b=a; % <{Matched rule: ((parent-is "\\`function_definition\\'")
parent matlab-ts-mode--set-function-indent-level-for-gp)}>
+ end end % <{Matched rule: ((node-is
"\\`\\(?:catch_clause\\|e\\(?:lse\\(?:\\(?:if\\)?_clause\\)\\|nd\\)\\)\\'")
parent 0)}>
+end % <{Matched rule: ((node-is
"\\`\\(?:catch_clause\\|e\\(?:lse\\(?:\\(?:if\\)?_clause\\)\\|nd\\)\\)\\'")
parent 0)}>
diff --git
a/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_classdef3_expected.org
b/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_classdef3_expected.org
index 0fed8876bf..0111c3a60a 100644
--- a/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_classdef3_expected.org
+++ b/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_classdef3_expected.org
@@ -973,41 +973,45 @@
- Invoking : "C-m" = newline
Start point : 2056
- Moved to point: 2057
- : 70:0:
- : ^
+ Moved to point: 2069
+ : 70:12:
+ : ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -66,4 +66,4 @@
+@@ -66,4 +66,5 @@
arguments
a
% comment9
- end
\ No newline at end of file
+ end
++
+\ No newline at end of file
#+end_src diff
- Invoking : (insert "end")
- Start point : 2057
- Moved to point: 2060
- : 70:3: end
- : ^
+ Start point : 2069
+ Moved to point: 2072
+ : 70:15: end
+ : ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -67,3 +67,4 @@
+@@ -67,4 +67,4 @@
a
% comment9
end
-+end
+-
+\ No newline at end of file
++ end
\ No newline at end of file
#+end_src diff
- Invoking : "C-m" = newline
- Start point : 2060
+ Start point : 2072
Moved to point: 2077
: 71:8:
: ^
@@ -1019,7 +1023,7 @@
a
% comment9
end
--end
+- end
\ No newline at end of file
+ end
+
diff --git a/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_fun5.m
b/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_fun5.m
index e86c2647a7..65f697f3b8 100644
--- a/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_fun5.m
+++ b/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_fun5.m
@@ -1,6 +1,11 @@
% -*- mode: matlab-ts; matlab-ts-mode-electric-ends: nil -*-
%{
+
+ Note: below we don't indent the "b ... comment for b" line correctly because
the parse tree
+ doesn't support this. See
+ tests/test-matlab-ts-mode-indent-files/indent_fcn_ellipsis.skip.typing.txt
+
Case1:
(t-utils-xr
@@ -20,6 +25,7 @@
(insert "b=2*a;") "C-m"
(insert "end") "C-m"
+ (indent-region (point-min) (point-max))
(re-search-backward "^fun")
(t-utils-xr-print-code (point) (point-max))
)
diff --git
a/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_fun5_expected.org
b/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_fun5_expected.org
index bd3b9bd022..a74f9c4676 100644
--- a/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_fun5_expected.org
+++ b/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_fun5_expected.org
@@ -1,6 +1,6 @@
#+startup: showall
-* Executing commands from indent_xr_fun5.m:5:2:
+* Executing commands from indent_xr_fun5.m:10:2:
Case1: (t-utils-xr
@@ -20,35 +20,36 @@
(insert "b=2*a;") "C-m"
(insert "end") "C-m"
+ (indent-region (point-min) (point-max))
(re-search-backward "^fun")
(t-utils-xr-print-code (point) (point-max))
)
- Invoking : (re-search-forward "%}")
- Start point : 754
- Moved to point: 757
- : 26:2: %}
+ Start point : 997
+ Moved to point: 1000
+ : 32:2: %}
: ^
No buffer modifications
- Invoking : "C-n" = next-line
- Start point : 757
- Moved to point: 758
- : 27:0:
+ Start point : 1000
+ Moved to point: 1001
+ : 33:0:
: ^
No buffer modifications
- Invoking : (insert "
")
- Start point : 758
- Moved to point: 759
- : 28:0:
+ Start point : 1001
+ Moved to point: 1002
+ : 34:0:
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -24,3 +24,4 @@
+@@ -30,3 +30,4 @@
(t-utils-xr-print-code (point) (point-max))
)
%}
@@ -56,22 +57,22 @@
#+end_src diff
- Invoking : "C-b" = backward-char
- Start point : 759
- Moved to point: 758
- : 27:0:
+ Start point : 1002
+ Moved to point: 1001
+ : 33:0:
: ^
No buffer modifications
- Invoking : (insert "function ...")
- Start point : 758
- Moved to point: 770
- : 27:12: function ...
+ Start point : 1001
+ Moved to point: 1013
+ : 33:12: function ...
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -24,4 +24,4 @@
+@@ -30,4 +30,4 @@
(t-utils-xr-print-code (point) (point-max))
)
%}
@@ -80,15 +81,15 @@
#+end_src diff
- Invoking : "C-m" = newline
- Start point : 770
- Moved to point: 775
- : 28:4:
+ Start point : 1013
+ Moved to point: 1018
+ : 34:4:
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -25,3 +25,4 @@
+@@ -31,3 +31,4 @@
)
%}
function ...
@@ -96,15 +97,15 @@
#+end_src diff
- Invoking : (insert "[ ...")
- Start point : 775
- Moved to point: 780
- : 28:9: [ ...
+ Start point : 1018
+ Moved to point: 1023
+ : 34:9: [ ...
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -25,4 +25,4 @@
+@@ -31,4 +31,4 @@
)
%}
function ...
@@ -113,15 +114,15 @@
#+end_src diff
- Invoking : "C-m" = newline
- Start point : 780
- Moved to point: 786
- : 29:5:
+ Start point : 1023
+ Moved to point: 1029
+ : 35:5:
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -26,3 +26,4 @@
+@@ -32,3 +32,4 @@
%}
function ...
[ ...
@@ -129,15 +130,15 @@
#+end_src diff
- Invoking : (insert "b ... comment for b")
- Start point : 786
- Moved to point: 805
- : 29:24: b ... comment for b
+ Start point : 1029
+ Moved to point: 1048
+ : 35:24: b ... comment for b
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -26,4 +26,4 @@
+@@ -32,4 +32,4 @@
%}
function ...
[ ...
@@ -146,134 +147,132 @@
#+end_src diff
- Invoking : "C-m" = newline
- Start point : 805
- Moved to point: 811
- : 30:5:
- : ^
+ Start point : 1048
+ Moved to point: 1052
+ : 36:4:
+ : ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -27,3 +27,4 @@
+@@ -32,4 +32,5 @@
+ %}
function ...
[ ...
- b ... comment for b
-+
+- b ... comment for b
++ b ... comment for b
++
#+end_src diff
- Invoking : (insert "] = ...")
- Start point : 811
- Moved to point: 818
- : 30:12: ] = ...
- : ^
+ Start point : 1052
+ Moved to point: 1059
+ : 36:11: ] = ...
+ : ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -27,4 +27,4 @@
+@@ -33,4 +33,4 @@
function ...
[ ...
- b ... comment for b
--
-+ ] = ...
+ b ... comment for b
+-
++ ] = ...
#+end_src diff
- Invoking : "C-m" = newline
- Start point : 818
- Moved to point: 822
- : 31:4:
+ Start point : 1059
+ Moved to point: 1064
+ : 37:4:
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -27,4 +27,5 @@
- function ...
+@@ -34,3 +34,4 @@
[ ...
- b ... comment for b
-- ] = ...
-+ ] = ...
+ b ... comment for b
+ ] = ...
+
#+end_src diff
- Invoking : (insert "indent_xr_fun5 ...")
- Start point : 822
- Moved to point: 840
- : 31:22: indent_xr_fun5 ...
+ Start point : 1064
+ Moved to point: 1082
+ : 37:22: indent_xr_fun5 ...
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -28,4 +28,4 @@
+@@ -34,4 +34,4 @@
[ ...
- b ... comment for b
+ b ... comment for b
] = ...
-
+ indent_xr_fun5 ...
#+end_src diff
- Invoking : "C-m" = newline
- Start point : 840
- Moved to point: 841
- : 32:0:
- : ^
+ Start point : 1082
+ Moved to point: 1087
+ : 38:4:
+ : ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -29,3 +29,4 @@
- b ... comment for b
+@@ -35,3 +35,4 @@
+ b ... comment for b
] = ...
indent_xr_fun5 ...
-+
++
#+end_src diff
- Invoking : (insert "( ...")
- Start point : 841
- Moved to point: 846
- : 32:5: ( ...
- : ^
+ Start point : 1087
+ Moved to point: 1092
+ : 38:9: ( ...
+ : ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -29,4 +29,4 @@
- b ... comment for b
+@@ -35,4 +35,4 @@
+ b ... comment for b
] = ...
indent_xr_fun5 ...
--
-+( ...
+-
++ ( ...
#+end_src diff
- Invoking : "C-m" = newline
- Start point : 846
- Moved to point: 856
- : 33:5:
+ Start point : 1092
+ Moved to point: 1098
+ : 39:5:
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -29,4 +29,5 @@
- b ... comment for b
+@@ -36,3 +36,4 @@
] = ...
indent_xr_fun5 ...
--( ...
-+ ( ...
+ ( ...
+
#+end_src diff
- Invoking : (insert "a ... comment for a")
- Start point : 856
- Moved to point: 875
- : 33:24: a ... comment for a
+ Start point : 1098
+ Moved to point: 1117
+ : 39:24: a ... comment for a
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -30,4 +30,4 @@
+@@ -36,4 +36,4 @@
] = ...
indent_xr_fun5 ...
( ...
@@ -282,15 +281,15 @@
#+end_src diff
- Invoking : "C-m" = newline
- Start point : 875
- Moved to point: 881
- : 34:5:
+ Start point : 1117
+ Moved to point: 1123
+ : 40:5:
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -31,3 +31,4 @@
+@@ -37,3 +37,4 @@
indent_xr_fun5 ...
( ...
a ... comment for a
@@ -298,15 +297,15 @@
#+end_src diff
- Invoking : (insert ")")
- Start point : 881
- Moved to point: 882
- : 34:6: )
+ Start point : 1123
+ Moved to point: 1124
+ : 40:6: )
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -31,4 +31,4 @@
+@@ -37,4 +37,4 @@
indent_xr_fun5 ...
( ...
a ... comment for a
@@ -315,15 +314,15 @@
#+end_src diff
- Invoking : "C-m" = newline
- Start point : 882
- Moved to point: 886
- : 35:4:
+ Start point : 1124
+ Moved to point: 1128
+ : 41:4:
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -31,4 +31,5 @@
+@@ -37,4 +37,5 @@
indent_xr_fun5 ...
( ...
a ... comment for a
@@ -333,15 +332,15 @@
#+end_src diff
- Invoking : "C-m" = newline
- Start point : 886
- Moved to point: 887
- : 36:4:
+ Start point : 1128
+ Moved to point: 1129
+ : 42:4:
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -32,4 +32,5 @@
+@@ -38,4 +38,5 @@
( ...
a ... comment for a
)
@@ -350,15 +349,15 @@
#+end_src diff
- Invoking : (insert "b=2*a;")
- Start point : 887
- Moved to point: 893
- : 36:10: b=2*a;
+ Start point : 1129
+ Moved to point: 1135
+ : 42:10: b=2*a;
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -33,4 +33,4 @@
+@@ -39,4 +39,4 @@
a ... comment for a
)
@@ -367,15 +366,15 @@
#+end_src diff
- Invoking : "C-m" = newline
- Start point : 893
- Moved to point: 898
- : 37:4:
+ Start point : 1135
+ Moved to point: 1140
+ : 43:4:
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -34,3 +34,4 @@
+@@ -40,3 +40,4 @@
)
b=2*a;
@@ -383,15 +382,15 @@
#+end_src diff
- Invoking : (insert "end")
- Start point : 898
- Moved to point: 901
- : 37:7: end
+ Start point : 1140
+ Moved to point: 1143
+ : 43:7: end
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -34,4 +34,4 @@
+@@ -40,4 +40,4 @@
)
b=2*a;
@@ -400,15 +399,15 @@
#+end_src diff
- Invoking : "C-m" = newline
- Start point : 901
- Moved to point: 898
- : 38:0:
+ Start point : 1143
+ Moved to point: 1140
+ : 44:0:
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -34,4 +34,5 @@
+@@ -40,4 +40,5 @@
)
b=2*a;
@@ -417,15 +416,35 @@
+
#+end_src diff
+- Invoking : (indent-region (point-min) (point-max))
+ Start point : 1140
+ Moved to point: 1141
+ : 44:0:
+ : ^
+ Buffer modified:
+ #+begin_src diff
+--- start_contents
++++ end_contents
+@@ -32,7 +32,7 @@
+ %}
+ function ...
+ [ ...
+- b ... comment for b
++ b ... comment for b
+ ] = ...
+ indent_xr_fun5 ...
+ ( ...
+ #+end_src diff
+
- Invoking : (re-search-backward "^fun")
- Start point : 898
- Moved to point: 758
- : 27:0: function ...
+ Start point : 1141
+ Moved to point: 1001
+ : 33:0: function ...
: ^
No buffer modifications
- Invoking : (t-utils-xr-print-code (point) (point-max))
- Start point : 758
+ Start point : 1001
No point movement
standard-output:
#+begin_src matlab-ts
diff --git
a/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_i_cont_incomplete2.m
b/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_i_cont_incomplete2.m
index bff6c5cddb..cdadd355c9 100644
--- a/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_i_cont_incomplete2.m
+++ b/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_i_cont_incomplete2.m
@@ -2,6 +2,18 @@
%
% See: https://github.com/acristoffers/tree-sitter-matlab/issues/51
%
-% Case1: (t-utils-xr "C-n" "C-e" "C-m" (insert "result = 1 + myfcn(a, b) +
...") "C-m" (insert "b);") (re-search-backward "^fun") (print
(buffer-substring-no-properties (point) (point-max))))
+%{
+ Case1:
+ (t-utils-xr
+
+ (re-search-forward "^fun") "C-e" "C-m"
+ (insert "result = 1 + myfcn(a, b) + ...") "C-m"
+ (insert "b;") "C-i"
+
+ (re-search-backward "^fun")
+ (t-utils-xr-print-code (point) (point-max))
+
+ )
+%}
function result = indent_xr_i_cont_incomplete2(a, b)
end
diff --git
a/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_i_cont_incomplete2_expected.org
b/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_i_cont_incomplete2_expected.org
index 5652bdc970..4371bcae75 100644
---
a/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_i_cont_incomplete2_expected.org
+++
b/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_i_cont_incomplete2_expected.org
@@ -1,50 +1,61 @@
#+startup: showall
-* Executing commands from indent_xr_i_cont_incomplete2.m:5:9:
+* Executing commands from indent_xr_i_cont_incomplete2.m:7:2:
- Case1: (t-utils-xr "C-n" "C-e" "C-m" (insert "result = 1 + myfcn(a, b) +
...") "C-m" (insert "b);") (re-search-backward "^fun") (print
(buffer-substring-no-properties (point) (point-max))))
+ Case1: (t-utils-xr
-- Invoking : "C-n" = next-line
- Start point : 284
- Moved to point: 337
- : 6:52: function result = indent_xr_i_cont_incomplete2(a, b)
- : ^
+ (re-search-forward "^fun") "C-e" "C-m"
+ (insert "result = 1 + myfcn(a, b) + ...") "C-m"
+ (insert "b;") "C-i"
+
+ (re-search-backward "^fun")
+ (t-utils-xr-print-code (point) (point-max))
+
+ )
+
+- Invoking : (re-search-forward "^fun")
+ Start point : 360
+ Moved to point: 367
+ : 18:3: function result = indent_xr_i_cont_incomplete2(a, b)
+ : ^
No buffer modifications
- Invoking : "C-e" = move-end-of-line
- Start point : 337
- No point movement
+ Start point : 367
+ Moved to point: 416
+ : 18:52: function result = indent_xr_i_cont_incomplete2(a, b)
+ : ^
No buffer modifications
- Invoking : "C-m" = newline
- Start point : 337
- Moved to point: 342
- : 7:4:
- : ^
+ Start point : 416
+ Moved to point: 421
+ : 19:4:
+ : ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -4,4 +4,5 @@
- %
- % Case1: (t-utils-xr "C-n" "C-e" "C-m" (insert "result = 1 + myfcn(a, b) +
...") "C-m" (insert "b);") (re-search-backward "^fun") (print
(buffer-substring-no-properties (point) (point-max))))
+@@ -16,4 +16,5 @@
+ )
+ %}
function result = indent_xr_i_cont_incomplete2(a, b)
+
end
#+end_src diff
- Invoking : (insert "result = 1 + myfcn(a, b) + ...")
- Start point : 342
- Moved to point: 372
- : 7:34: result = 1 + myfcn(a, b) + ...
- : ^
+ Start point : 421
+ Moved to point: 451
+ : 19:34: result = 1 + myfcn(a, b) + ...
+ : ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -4,5 +4,5 @@
- %
- % Case1: (t-utils-xr "C-n" "C-e" "C-m" (insert "result = 1 + myfcn(a, b) +
...") "C-m" (insert "b);") (re-search-backward "^fun") (print
(buffer-substring-no-properties (point) (point-max))))
+@@ -16,5 +16,5 @@
+ )
+ %}
function result = indent_xr_i_cont_incomplete2(a, b)
-
+ result = 1 + myfcn(a, b) + ...
@@ -52,55 +63,73 @@
#+end_src diff
- Invoking : "C-m" = newline
- Start point : 372
- Moved to point: 381
- : 8:8:
- : ^
+ Start point : 451
+ Moved to point: 452
+ : 20:0:
+ : ^
+ Buffer modified:
+ #+begin_src diff
+--- start_contents
++++ end_contents
+@@ -17,4 +17,5 @@
+ %}
+ function result = indent_xr_i_cont_incomplete2(a, b)
+ result = 1 + myfcn(a, b) + ...
++
+ end
+ #+end_src diff
+
+- Invoking : (insert "b;")
+ Start point : 452
+ Moved to point: 454
+ : 20:2: b;
+ : ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -5,4 +5,5 @@
- % Case1: (t-utils-xr "C-n" "C-e" "C-m" (insert "result = 1 + myfcn(a, b) +
...") "C-m" (insert "b);") (re-search-backward "^fun") (print
(buffer-substring-no-properties (point) (point-max))))
+@@ -17,5 +17,5 @@
+ %}
function result = indent_xr_i_cont_incomplete2(a, b)
result = 1 + myfcn(a, b) + ...
-+
+-
++b;
end
#+end_src diff
-- Invoking : (insert "b);")
- Start point : 381
- Moved to point: 384
- : 8:11: b);
- : ^
+- Invoking : "C-i" = indent-for-tab-command
+ Start point : 454
+ Moved to point: 467
+ : 20:15: b;
+ : ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -5,5 +5,5 @@
- % Case1: (t-utils-xr "C-n" "C-e" "C-m" (insert "result = 1 + myfcn(a, b) +
...") "C-m" (insert "b);") (re-search-backward "^fun") (print
(buffer-substring-no-properties (point) (point-max))))
+@@ -17,5 +17,5 @@
+ %}
function result = indent_xr_i_cont_incomplete2(a, b)
result = 1 + myfcn(a, b) + ...
--
-+ b);
+-b;
++ b;
end
#+end_src diff
- Invoking : (re-search-backward "^fun")
- Start point : 384
- Moved to point: 285
- : 6:0: function result = indent_xr_i_cont_incomplete2(a, b)
- : ^
+ Start point : 467
+ Moved to point: 364
+ : 18:0: function result = indent_xr_i_cont_incomplete2(a, b)
+ : ^
No buffer modifications
-- Invoking : (print (buffer-substring-no-properties (point) (point-max)))
- Start point : 285
+- Invoking : (t-utils-xr-print-code (point) (point-max))
+ Start point : 364
No point movement
standard-output:
- #+begin_example
+ #+begin_src matlab-ts
function result = indent_xr_i_cont_incomplete2(a, b)
result = 1 + myfcn(a, b) + ...
- b);
+ b;
end
- #+end_example
+ #+end_src
No buffer modifications
diff --git
a/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_i_cont_incomplete3.m
b/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_i_cont_incomplete3.m
index 7f3e5aa57f..df5c62aa49 100644
--- a/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_i_cont_incomplete3.m
+++ b/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_i_cont_incomplete3.m
@@ -1,4 +1,16 @@
% -*- matlab-ts -*-
-% Case1: (t-utils-xr "C-n" "C-e" "C-m" (insert "a = ...") "C-m" (insert "99;")
(re-search-backward "^fun") (print (buffer-substring-no-properties (point)
(point-max))))
-function a = indent_xr_i_cont_incomplete3
+%{
+ Case1:
+ (t-utils-xr
+
+ (re-search-forward "^fun") "C-e" "C-m"
+ (insert "output1 = ...") "C-m"
+ (insert "99;") "C-i"
+
+ (re-search-backward "^fun")
+ (t-utils-xr-print-code (point) (point-max))
+
+ )
+%}
+function output1 = indent_xr_i_cont_incomplete3
end
diff --git
a/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_i_cont_incomplete3_expected.org
b/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_i_cont_incomplete3_expected.org
index 35980c446a..1814ad3761 100644
---
a/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_i_cont_incomplete3_expected.org
+++
b/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_i_cont_incomplete3_expected.org
@@ -1,106 +1,135 @@
#+startup: showall
-* Executing commands from indent_xr_i_cont_incomplete3.m:2:9:
+* Executing commands from indent_xr_i_cont_incomplete3.m:4:2:
- Case1: (t-utils-xr "C-n" "C-e" "C-m" (insert "a = ...") "C-m" (insert "99;")
(re-search-backward "^fun") (print (buffer-substring-no-properties (point)
(point-max))))
+ Case1: (t-utils-xr
-- Invoking : "C-n" = next-line
- Start point : 189
- Moved to point: 231
- : 3:41: function a = indent_xr_i_cont_incomplete3
- : ^
+ (re-search-forward "^fun") "C-e" "C-m"
+ (insert "output1 = ...") "C-m"
+ (insert "99;") "C-i"
+
+ (re-search-backward "^fun")
+ (t-utils-xr-print-code (point) (point-max))
+
+ )
+
+- Invoking : (re-search-forward "^fun")
+ Start point : 252
+ Moved to point: 259
+ : 15:3: function output1 = indent_xr_i_cont_incomplete3
+ : ^
No buffer modifications
- Invoking : "C-e" = move-end-of-line
- Start point : 231
- No point movement
+ Start point : 259
+ Moved to point: 303
+ : 15:47: function output1 = indent_xr_i_cont_incomplete3
+ : ^
No buffer modifications
- Invoking : "C-m" = newline
- Start point : 231
- Moved to point: 236
- : 4:4:
- : ^
+ Start point : 303
+ Moved to point: 308
+ : 16:4:
+ : ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -1,4 +1,5 @@
- % -*- matlab-ts -*-
- % Case1: (t-utils-xr "C-n" "C-e" "C-m" (insert "a = ...") "C-m" (insert
"99;") (re-search-backward "^fun") (print (buffer-substring-no-properties
(point) (point-max))))
- function a = indent_xr_i_cont_incomplete3
+@@ -13,4 +13,5 @@
+ )
+ %}
+ function output1 = indent_xr_i_cont_incomplete3
+
end
#+end_src diff
-- Invoking : (insert "a = ...")
- Start point : 236
- Moved to point: 243
- : 4:11: a = ...
- : ^
+- Invoking : (insert "output1 = ...")
+ Start point : 308
+ Moved to point: 321
+ : 16:17: output1 = ...
+ : ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -1,5 +1,5 @@
- % -*- matlab-ts -*-
- % Case1: (t-utils-xr "C-n" "C-e" "C-m" (insert "a = ...") "C-m" (insert
"99;") (re-search-backward "^fun") (print (buffer-substring-no-properties
(point) (point-max))))
- function a = indent_xr_i_cont_incomplete3
+@@ -13,5 +13,5 @@
+ )
+ %}
+ function output1 = indent_xr_i_cont_incomplete3
-
-+ a = ...
++ output1 = ...
end
#+end_src diff
- Invoking : "C-m" = newline
- Start point : 243
- Moved to point: 252
- : 5:8:
- : ^
+ Start point : 321
+ Moved to point: 322
+ : 17:0:
+ : ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -2,4 +2,5 @@
- % Case1: (t-utils-xr "C-n" "C-e" "C-m" (insert "a = ...") "C-m" (insert
"99;") (re-search-backward "^fun") (print (buffer-substring-no-properties
(point) (point-max))))
- function a = indent_xr_i_cont_incomplete3
- a = ...
-+
+@@ -14,4 +14,5 @@
+ %}
+ function output1 = indent_xr_i_cont_incomplete3
+ output1 = ...
++
end
#+end_src diff
- Invoking : (insert "99;")
- Start point : 252
- Moved to point: 255
- : 5:11: 99;
- : ^
+ Start point : 322
+ Moved to point: 325
+ : 17:3: 99;
+ : ^
+ Buffer modified:
+ #+begin_src diff
+--- start_contents
++++ end_contents
+@@ -14,5 +14,5 @@
+ %}
+ function output1 = indent_xr_i_cont_incomplete3
+ output1 = ...
+-
++99;
+ end
+ #+end_src diff
+
+- Invoking : "C-i" = indent-for-tab-command
+ Start point : 325
+ Moved to point: 333
+ : 17:11: 99;
+ : ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -2,5 +2,5 @@
- % Case1: (t-utils-xr "C-n" "C-e" "C-m" (insert "a = ...") "C-m" (insert
"99;") (re-search-backward "^fun") (print (buffer-substring-no-properties
(point) (point-max))))
- function a = indent_xr_i_cont_incomplete3
- a = ...
--
+@@ -14,5 +14,5 @@
+ %}
+ function output1 = indent_xr_i_cont_incomplete3
+ output1 = ...
+-99;
+ 99;
end
#+end_src diff
- Invoking : (re-search-backward "^fun")
- Start point : 255
- Moved to point: 190
- : 3:0: function a = indent_xr_i_cont_incomplete3
- : ^
+ Start point : 333
+ Moved to point: 256
+ : 15:0: function output1 = indent_xr_i_cont_incomplete3
+ : ^
No buffer modifications
-- Invoking : (print (buffer-substring-no-properties (point) (point-max)))
- Start point : 190
+- Invoking : (t-utils-xr-print-code (point) (point-max))
+ Start point : 256
No point movement
standard-output:
- #+begin_example
-function a = indent_xr_i_cont_incomplete3
- a = ...
+ #+begin_src matlab-ts
+function output1 = indent_xr_i_cont_incomplete3
+ output1 = ...
99;
end
- #+end_example
+ #+end_src
No buffer modifications
diff --git a/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_if_cond.m
b/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_if_cond.m
index c1ec20a679..a5cd62e788 100644
--- a/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_if_cond.m
+++ b/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_if_cond.m
@@ -13,7 +13,7 @@ function indent_xr_if_cond(a, b)
disp('1');
end
- % Case3: (t-utils-xr "C-n" "C-n" "C-i" (insert "b > 1"))
+ % Case3: (t-utils-xr "C-n" "C-n" "C-i" (insert "b > 1") "C-i")
while a > 1 && ...
end
diff --git
a/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_if_cond_expected.org
b/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_if_cond_expected.org
index ed679a435c..85ad3a3322 100644
--- a/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_if_cond_expected.org
+++ b/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_if_cond_expected.org
@@ -18,9 +18,9 @@
- Invoking : "C-m" = newline
Start point : 142
- Moved to point: 160
- : 7:17:
- : ^
+ Moved to point: 143
+ : 7:0:
+ : ^
Buffer modified:
#+begin_src diff
--- start_contents
@@ -29,17 +29,17 @@
% Case1: (t-utils-xr "C-n" "C-e" "C-m" (insert "b > 1") "C-m")
if a > 1 && ...
-+
++
end
% Case2: (t-utils-xr "C-n" "C-n" "C-i" (insert "b > 1"))
#+end_src diff
- Invoking : (insert "b > 1")
- Start point : 160
- Moved to point: 165
- : 7:22: b > 1
- : ^
+ Start point : 143
+ Moved to point: 148
+ : 7:5: b > 1
+ : ^
Buffer modified:
#+begin_src diff
--- start_contents
@@ -48,15 +48,15 @@
% Case1: (t-utils-xr "C-n" "C-e" "C-m" (insert "b > 1") "C-m")
if a > 1 && ...
--
-+ b > 1
+-
++b > 1
end
% Case2: (t-utils-xr "C-n" "C-n" "C-i" (insert "b > 1"))
#+end_src diff
- Invoking : "C-m" = newline
- Start point : 165
+ Start point : 148
Moved to point: 164
: 8:8:
: ^
@@ -68,7 +68,7 @@
% Case1: (t-utils-xr "C-n" "C-e" "C-m" (insert "b > 1") "C-m")
if a > 1 && ...
-- b > 1
+-b > 1
+ b > 1
+
end
@@ -96,9 +96,9 @@
- Invoking : "C-i" = indent-for-tab-command
Start point : 259
- Moved to point: 270
- : 13:11:
- : ^
+ Moved to point: 265
+ : 13:6:
+ : ^
Buffer modified:
#+begin_src diff
--- start_contents
@@ -108,17 +108,17 @@
% Case2: (t-utils-xr "C-n" "C-n" "C-i" (insert "b > 1"))
switch a > 1 && ...
-
-+
++
case 1:
disp('1');
end
#+end_src diff
- Invoking : (insert "b > 1")
- Start point : 270
- Moved to point: 275
- : 13:16: b > 1
- : ^
+ Start point : 265
+ Moved to point: 270
+ : 13:11: b > 1
+ : ^
Buffer modified:
#+begin_src diff
--- start_contents
@@ -127,8 +127,8 @@
% Case2: (t-utils-xr "C-n" "C-n" "C-i" (insert "b > 1"))
switch a > 1 && ...
--
-+ b > 1
+-
++ b > 1
case 1:
disp('1');
end
@@ -136,25 +136,25 @@
* Executing commands from indent_xr_if_cond.m:18:13:
- Case3: (t-utils-xr "C-n" "C-n" "C-i" (insert "b > 1"))
+ Case3: (t-utils-xr "C-n" "C-n" "C-i" (insert "b > 1") "C-i")
- Invoking : "C-n" = next-line
- Start point : 378
- Moved to point: 401
+ Start point : 379
+ Moved to point: 402
: 19:22: while a > 1 && ...
: ^
No buffer modifications
- Invoking : "C-n" = next-line
- Start point : 401
- Moved to point: 402
+ Start point : 402
+ Moved to point: 403
: 20:0:
: ^
No buffer modifications
- Invoking : "C-i" = indent-for-tab-command
- Start point : 402
- Moved to point: 410
+ Start point : 403
+ Moved to point: 411
: 20:8:
: ^
Buffer modified:
@@ -163,7 +163,7 @@
+++ end_contents
@@ -17,7 +17,7 @@
- % Case3: (t-utils-xr "C-n" "C-n" "C-i" (insert "b > 1"))
+ % Case3: (t-utils-xr "C-n" "C-n" "C-i" (insert "b > 1") "C-i")
while a > 1 && ...
-
+
@@ -173,8 +173,8 @@
#+end_src diff
- Invoking : (insert "b > 1")
- Start point : 410
- Moved to point: 415
+ Start point : 411
+ Moved to point: 416
: 20:13: b > 1
: ^
Buffer modified:
@@ -183,7 +183,7 @@
+++ end_contents
@@ -17,7 +17,7 @@
- % Case3: (t-utils-xr "C-n" "C-n" "C-i" (insert "b > 1"))
+ % Case3: (t-utils-xr "C-n" "C-n" "C-i" (insert "b > 1") "C-i")
while a > 1 && ...
-
+ b > 1
@@ -192,12 +192,32 @@
end
#+end_src diff
+- Invoking : "C-i" = indent-for-tab-command
+ Start point : 416
+ Moved to point: 418
+ : 20:15: b > 1
+ : ^
+ Buffer modified:
+ #+begin_src diff
+--- start_contents
++++ end_contents
+@@ -17,7 +17,7 @@
+
+ % Case3: (t-utils-xr "C-n" "C-n" "C-i" (insert "b > 1") "C-i")
+ while a > 1 && ...
+- b > 1
++ b > 1
+ end
+
+ end
+ #+end_src diff
+
* Executing commands from indent_xr_if_cond.m:25:9:
Case4: (t-utils-xr (t-utils-xr-print-code (point-min) (point-max)))
- Invoking : (t-utils-xr-print-code (point-min) (point-max))
- Start point : 499
+ Start point : 502
No point movement
standard-output:
#+begin_src matlab-ts
@@ -213,14 +233,14 @@ function indent_xr_if_cond(a, b)
% Case2: (t-utils-xr \"C-n\" \"C-n\" \"C-i\" (insert \"b > 1\"))
switch a > 1 && ...
- b > 1
+ b > 1
case 1:
disp('1');
end
- % Case3: (t-utils-xr \"C-n\" \"C-n\" \"C-i\" (insert \"b > 1\"))
+ % Case3: (t-utils-xr \"C-n\" \"C-n\" \"C-i\" (insert \"b > 1\") \"C-i\")
while a > 1 && ...
- b > 1
+ b > 1
end
end
diff --git
a/tests/test-matlab-ts-mode-on-save-fixes-files/on_save_no_fix_syntax_error.m
b/tests/test-matlab-ts-mode-on-save-fixes-files/on_save_no_fix_syntax_error.m
new file mode 100644
index 0000000000..2f5a079f35
--- /dev/null
+++
b/tests/test-matlab-ts-mode-on-save-fixes-files/on_save_no_fix_syntax_error.m
@@ -0,0 +1,9 @@
+% -*- matlab-ts -*-
+
+% We shouldn't try to change the name of variable in1 when the code is
incomplete.
+
+% Case1: (t-utils-xr (rename-buffer "tmp__on_save_no_fix_syntax_error.m")
(matlab-ts-mode-on-save-fix-name t))
+
+function ...
+ [ ...
+ in1, ... comment about in1
diff --git
a/tests/test-matlab-ts-mode-on-save-fixes-files/on_save_no_fix_syntax_error_expected.org
b/tests/test-matlab-ts-mode-on-save-fixes-files/on_save_no_fix_syntax_error_expected.org
new file mode 100644
index 0000000000..e3311b98b4
--- /dev/null
+++
b/tests/test-matlab-ts-mode-on-save-fixes-files/on_save_no_fix_syntax_error_expected.org
@@ -0,0 +1,15 @@
+#+startup: showall
+
+* Executing commands from on_save_no_fix_syntax_error.m:5:9:
+
+ Case1: (t-utils-xr (rename-buffer "tmp__on_save_no_fix_syntax_error.m")
(matlab-ts-mode-on-save-fix-name t))
+
+- Invoking : (rename-buffer "tmp__on_save_no_fix_syntax_error.m")
+ Start point : 216
+ No point movement
+ No buffer modifications
+
+- Invoking : (matlab-ts-mode-on-save-fix-name t)
+ Start point : 216
+ No point movement
+ No buffer modifications
diff --git
a/tests/test-matlab-ts-mode-parser-files/parser_binary_operator_continued_issue107.skip.txt
b/tests/test-matlab-ts-mode-parser-files/parser_binary_operator_continued_issue107.skip.txt
deleted file mode 100644
index e38a79cfd0..0000000000
---
a/tests/test-matlab-ts-mode-parser-files/parser_binary_operator_continued_issue107.skip.txt
+++ /dev/null
@@ -1 +0,0 @@
-See https://github.com/acristoffers/tree-sitter-matlab/issues/107
diff --git
a/tests/test-matlab-ts-mode-parser-files/parser_binary_operator_continued_issue107_expected.txt
b/tests/test-matlab-ts-mode-parser-files/parser_binary_operator_continued_issue107_expected.txt
new file mode 100644
index 0000000000..e187dcc304
--- /dev/null
+++
b/tests/test-matlab-ts-mode-parser-files/parser_binary_operator_continued_issue107_expected.txt
@@ -0,0 +1,63 @@
+# tree-sitter parse tree annotated with [NODE-START,NODE-END]{NODE-TEXT}
+(source_file (comment[1,20]{% -*- matlab-ts -*-}) (comment[22,89]{% See
https://github.com/acristoffers/tree-sitter-...})
+ (assignment left: (identifier[91,93]{v1}) =
+ right:
+ (cell {
+ (row
+ (binary_operator left: (number[97,98]{1}) + right: (number[101,102]{2})))
+ }))
+ ;
+ (assignment left: (identifier[106,108]{v2}) =
+ right:
+ (cell { (line_continuation[113,117]{...\n})
+ (row
+ (binary_operator left: (number[124,125]{1})
(line_continuation[126,137]{...\n }) +
(line_continuation[139,143]{...\n}) right: (number[150,151]{2})))
+ }))
+ ;
+ (function_call name: (identifier[161,167]{assert}) (
+ (arguments
+ argument:
+ (function_call name: (identifier[168,175]{isequal}) (
+ (arguments argument: (identifier[176,178]{v1}) ,
(identifier[180,182]{v2}))
+ )))
+ ))
+ \n
+ (assignment left: (identifier[186,188]{v3}) =
+ right:
+ (matrix [
+ (row
+ (binary_operator left: (number[192,193]{1}) + right:
(number[196,197]{2})))
+ ]))
+ ;
+ (assignment left: (identifier[201,203]{v4}) =
+ right:
+ (matrix [ (line_continuation[208,212]{...\n})
+ (row
+ (binary_operator left: (number[219,220]{1})
(line_continuation[221,232]{...\n }) +
(line_continuation[234,238]{...\n}) right: (number[245,246]{2})))
+ ]))
+ ;
+ (function_call name: (identifier[256,262]{assert}) (
+ (arguments
+ argument:
+ (function_call name: (identifier[263,270]{isequal}) (
+ (arguments argument: (identifier[271,273]{v3}) ,
(identifier[275,277]{v4}))
+ )))
+ ))
+ \n
+ (assignment left: (identifier[281,283]{v5}) =
+ right: (binary_operator left: (number[286,287]{1}) + right:
(number[290,291]{2})))
+ ;
+ (assignment left: (identifier[294,296]{v6}) =
+ right:
+ (parenthesis (
+ (binary_operator left: (number[300,301]{1})
(line_continuation[302,306]{...\n}) + (line_continuation[314,318]{...\n})
right: (number[324,325]{2}))
+ )))
+ ;
+ (function_call name: (identifier[329,335]{assert}) (
+ (arguments
+ argument:
+ (function_call name: (identifier[336,343]{isequal}) (
+ (arguments argument: (identifier[344,346]{v5}) ,
(identifier[348,350]{v6}))
+ )))
+ ))
+ \n)
diff --git a/tests/test-package-version.el b/tests/test-package-version.el
index 037d373e9c..8fa0c2db2a 100644
--- a/tests/test-package-version.el
+++ b/tests/test-package-version.el
@@ -28,6 +28,9 @@
Emacs MATLAB mode package consists of several major and minor modes and
for simplicity we require that the versions of these be the same."
+ (when (not (file-exists-p "../matlab-ts-mode.el"))
+ (error "../matlab-ts-mode.el doesn't exist, is the current directory
correct?"))
+
(let ((el-files (directory-files ".." t "\\.el\\'"))
(version-lines "")
(all-versions-consistent t)