branch: externals/matlab-mode
commit cee862834637b14b62f1b502b42130771fc81b12
Author: John Ciolfi <[email protected]>
Commit: John Ciolfi <[email protected]>
matlab-ts-mode: for doc comments, add electric-end "% "
---
matlab-ts-mode.el | 159 ++++----
tests/t-utils.el | 5 +
.../electric_ends_cases.m | 2 +
.../electric_ends_cases_expected.org | 422 ++++++++++++---------
4 files changed, 334 insertions(+), 254 deletions(-)
diff --git a/matlab-ts-mode.el b/matlab-ts-mode.el
index 6fa2a64770..db7e582441 100644
--- a/matlab-ts-mode.el
+++ b/matlab-ts-mode.el
@@ -139,9 +139,9 @@ Server gives all syntactic faces along with error
indicators.
The \"Standard plus parse errors\" can result in too much use of the
`font-lock-warning-face' when there are syntax errors."
:type '(choice (const :tag "Minimal" 1)
- (const :tag "Low" 2)
- (const :tag "Standard" 3)
- (const :tag "Standard plus parse errors" 4)))
+ (const :tag "Low" 2)
+ (const :tag "Standard" 3)
+ (const :tag "Standard plus parse errors" 4)))
(defcustom matlab-ts-mode-on-save-fixes
'(matlab-ts-mode-on-save-fix-name)
@@ -171,7 +171,7 @@ You can also install via use-package or other methods."
:type 'boolean)
(defcustom matlab-ts-mode-electric-ends t
- "*If t, insert end keywords to complete statements.
+ "*If t, insert end keywords to complete statements and insert % for doc
comments.
For example, if you type
classdef foo<RET>
an end statement will be inserted resulting in:
@@ -180,7 +180,14 @@ an end statement will be inserted resulting in:
end
Insertion of end keywords works well when the code is
indented. If you are editing code that is not indented,
-you may wish to turn this off."
+you may wish to turn this off.
+
+This will also add \"% \" for documentation comments. For example,
+ function foo
+ % help for foo<RET>
+ %
+ ^ <== \"% \" is inserted and point is here
+ end"
:type 'boolean)
;;; Global variables used in multiple code ";;; sections"
@@ -315,11 +322,11 @@ content can crash Emacs via the matlab tree-sitter
parser."
"Create a new SYMBOL with DOC used as a text property category with SYNTAX."
(declare (indent defvar) (debug (sexp form sexp)) (doc-string 3))
`(progn (defconst ,symbol ,syntax ,doc)
- (put ',symbol 'syntax-table ,symbol)))
+ (put ',symbol 'syntax-table ,symbol)))
;; In the Syntax Table descriptors, "<" is for comments
(matlab-ts-mode--syntax-symbol matlab-ts-mode--ellipsis-syntax
(string-to-syntax "<")
- "Syntax placed on ellipsis to treat them as comments.")
+ "Syntax placed on ellipsis to treat them as
comments.")
(defun matlab-ts-mode--syntax-propertize (&optional start end)
"Scan region between START and END to add properties.
@@ -335,15 +342,15 @@ as comments which is how they are treated by MATLAB."
;; Edits can change what properties characters can have so remove ours
and reapply
(remove-text-properties (point) (save-excursion (goto-char (or end
(point-max)))
- (end-of-line) (point))
- '(category nil mcm nil))
+ (end-of-line) (point))
+ '(category nil mcm nil))
;; Tell Emacs that ellipsis (...) line continuations are comments.
(while (and (not (>= (point) (or end (point-max)))) (not (eobp)))
(if (treesit-search-forward-goto (treesit-node-at (point))
(rx bos "line_continuation" eos)
t) ;; goto start of: ... optional text
- (matlab-ts-mode--put-char-category (point)
'matlab-ts-mode--ellipsis-syntax)
+ (matlab-ts-mode--put-char-category (point)
'matlab-ts-mode--ellipsis-syntax)
(goto-char (point-max)))))))
;;; font-lock
@@ -408,12 +415,12 @@ as comments which is how they are treated by MATLAB."
">" ;; Greater than
">=" ;; Greater than or equal to
"<" ;; Less than
- "<=" ;; Less than or equal to
+ "<=" ;; Less than or equal to
"&" ;; Find logical AND
"|" ;; Find logical OR
"&&" ;; Find logical AND (with short-circuiting)
"||" ;; Find logical OR (with short-circuiting)
- "~" ;; Find logical NOT
+ "~" ;; Find logical NOT
"@" ;; Create anonymous functions and function handles, call
superclass methods
;; "!" ;; "!" is like an operator, but has command-dual like syntax,
so handled elsewhere
"?" ;; Retrieve metaclass information for class name
@@ -455,7 +462,7 @@ help doc comment."
(let ((prev-node (treesit-node-prev-sibling comment-node)))
(when prev-node
(while (string-match-p (rx bos "line_continuation" eos)
- (treesit-node-type prev-node))
+ (treesit-node-type prev-node))
(setq prev-node (treesit-node-prev-sibling prev-node)))
(let ((prev-type (treesit-node-type prev-node)))
;; The true (t) cases. Note line continuation ellipsis are allowed.
@@ -467,10 +474,10 @@ help doc comment."
"superclasses") ;; subclass
eos)
prev-type)
- (and (string= prev-type "identifier") ;; id could
be a fcn or class id
+ (and (string= prev-type "identifier") ;; id could
be a fcn or class id
(let ((prev-sibling (treesit-node-prev-sibling
prev-node)))
(and prev-sibling
- (string-match-p
+ (string-match-p
(rx bos
(or "function" ;; fcn without in
and out args
"function_output" ;; fcn w/out args
and no in args
@@ -725,16 +732,16 @@ Example, disp variable is overriding the disp builtin
function:
@matlab-ts-mode-variable-override-builtin-face)))
(assignment left: (identifier) @font-lock-variable-name-face)
(multioutput_variable (identifier)
@matlab-ts-mode-variable-override-builtin-face
- (:pred matlab-ts-mode--is-variable-overriding-builtin
- @matlab-ts-mode-variable-override-builtin-face))
+ (:pred
matlab-ts-mode--is-variable-overriding-builtin
+
@matlab-ts-mode-variable-override-builtin-face))
(multioutput_variable (identifier) @font-lock-variable-name-face)
(global_operator (identifier)
@matlab-ts-mode-variable-override-builtin-face
- (:pred matlab-ts-mode--is-variable-overriding-builtin
- @matlab-ts-mode-variable-override-builtin-face))
+ (:pred matlab-ts-mode--is-variable-overriding-builtin
+ @matlab-ts-mode-variable-override-builtin-face))
(global_operator (identifier) @font-lock-variable-name-face)
(persistent_operator (identifier)
@matlab-ts-mode-variable-override-builtin-face
- (:pred matlab-ts-mode--is-variable-overriding-builtin
- @matlab-ts-mode-variable-override-builtin-face))
+ (:pred matlab-ts-mode--is-variable-overriding-builtin
+
@matlab-ts-mode-variable-override-builtin-face))
(persistent_operator (identifier) @font-lock-variable-name-face)
(for_statement (iterator (identifier)
@matlab-ts-mode-variable-override-builtin-face
(:pred
matlab-ts-mode--is-variable-overriding-builtin
@@ -1109,7 +1116,7 @@ Example, disp variable is overriding the disp builtin
function:
;; 1000, 1.9;
;; 100000, 1.875];
;; or un-aligned
-;
+ ;
;; table1 = [1, 2;
;; 1000, 1.9;
;; 100000, 1.875];
@@ -1230,10 +1237,10 @@ is where we start looking for the error node."
(t
;; Find first row to anchor against
(let ((prev-sibling (treesit-node-prev-sibling check-node)))
- (while prev-sibling
- (when (string= (treesit-node-type prev-sibling) "row")
- (setq check-node prev-sibling))
- (setq prev-sibling (treesit-node-prev-sibling
prev-sibling))))
+ (while prev-sibling
+ (when (string= (treesit-node-type prev-sibling) "row")
+ (setq check-node prev-sibling))
+ (setq prev-sibling (treesit-node-prev-sibling
prev-sibling))))
;; In an ERROR node of a matrix or cell, return anchor
(setq matlab-ts-mode--i-error-row-matcher-pair
(cons (treesit-node-start check-node) 0)))))))))))
@@ -1700,8 +1707,8 @@ Sets `matlab-ts-mode--i-next-line-pair' to (ANCHOR-NODE .
OFFSET)"
;; Case: if condition || ...
;; ^ <== TAB to here
0
- ;; Case: if condition
- ;; ^ <== TAB to here
+ ;; Case: if condition
+ ;; ^ <== TAB to here
matlab-ts-mode--indent-level)))
((rx (seq bos (or "switch" "case" "otherwise") eos))
@@ -2618,10 +2625,10 @@ the normal s-expression movement by calling
(defun matlab-ts-mode--defun-name (node)
"Return the defun name of NODE for Change Log entries."
- (when (string-match-p
- (rx bos (or "function_definition" "class_definition") eos)
- (treesit-node-type node))
- (treesit-node-text (treesit-node-child-by-field-name node "name"))))
+ (when (string-match-p
+ (rx bos (or "function_definition" "class_definition") eos)
+ (treesit-node-type node))
+ (treesit-node-text (treesit-node-child-by-field-name node "name"))))
;;; imenu
@@ -2924,7 +2931,7 @@ THERE-END MISMATCH) or nil."
(if (or here-begin here-end)
(list here-begin here-end there-begin there-end mismatch)
- (funcall #'show-paren--default))))
+ (funcall #'show-paren--default))))
;;; post-self-command-hook
@@ -2953,11 +2960,11 @@ THERE-END MISMATCH) or nil."
;; to see if it is really attached.
;; This works well assuming that the code is indented when one is editing
it.
((let ((node-indent-level (save-excursion
- (goto-char (treesit-node-start node))
+ (goto-char (treesit-node-start node))
(current-indentation)))
(end-indent-level (save-excursion
- (goto-char (treesit-node-start last-child))
- (current-indentation))))
+ (goto-char (treesit-node-start last-child))
+ (current-indentation))))
(not (= node-indent-level end-indent-level)))
t)
@@ -2992,7 +2999,7 @@ THERE-END MISMATCH) or nil."
;; Otherwise: statement has an end
(t
nil
- ))))
+ ))))
(defun matlab-ts-mode--insert-electric-ends ()
"A RET was type, insert the electric \"end\" if needed."
@@ -3002,35 +3009,47 @@ THERE-END MISMATCH) or nil."
(let (end-indent-level
extra-insert
- move-point-to-extra-insert)
+ item-to-insert
+ move-point-to-extra-insert
+ (pre-insert ""))
(save-excursion
(forward-line -1)
(back-to-indentation)
- (let* ((node (treesit-node-at (point)))
- (node-type (treesit-node-type node)))
- (when (and node
- ;; AND: Was a statement entered that requires and end?
- (string-match-p
- (rx bos (or "function" "arguments" "if" "switch" "while"
"for" "parfor"
- "spmd" "try" "classdef" "enumeration"
"properties" "methods"
- "events")
- eos)
- node-type)
- ;; AND: Is the statement missing an end?
- (matlab-ts-mode--is-electric-end-missing node))
-
- ;; Statement for the RET doesn't have an end, so add one at
end-indent-level
- (setq end-indent-level (current-indentation))
-
- ;; Extra insert, e.g. case for the switch statement.
- (pcase node-type
- ("switch"
- (setq extra-insert " case "
- move-point-to-extra-insert t))
- ("try"
- (setq extra-insert "catch me"))
- ))))
+ (let* ((node (treesit-node-at (point))))
+ (when node
+ (let ((node-type (treesit-node-type node)))
+
+ (cond
+
+ ;; Case: Was a statement entered that requires and end?
+ ((string-match-p (rx bos (or "function" "arguments" "if" "switch"
"while" "for" "parfor"
+ "spmd" "try" "classdef"
"enumeration" "properties" "methods"
+ "events")
+ eos)
+ node-type)
+ (when (matlab-ts-mode--is-electric-end-missing node) ;; Is the
statement missing an end?
+ ;; Statement for the RET doesn't have an end, so add one at
end-indent-level
+ (setq end-indent-level (current-indentation))
+ (setq pre-insert "\n")
+ (setq item-to-insert "end\n")
+
+ ;; Extra insert, e.g. case for the switch statement.
+ (pcase node-type
+ ("switch"
+ (setq extra-insert " case "
+ move-point-to-extra-insert t))
+ ("try"
+ (setq extra-insert "catch me"))
+ )))
+
+ ;; Case: Single-line doc comment?
+ ((and (string= node-type "comment")
+ (eq (get-char-property (point) 'face) 'font-lock-doc-face)
+ (looking-at "%[ \t]*[^ \t\r\n]"))
+ (setq end-indent-level (current-indentation))
+ (setq item-to-insert "% ")
+ ))))))
(when end-indent-level
(let ((indent-level-spaces (make-string end-indent-level ? )))
@@ -3039,7 +3058,9 @@ THERE-END MISMATCH) or nil."
(when (not move-point-to-extra-insert)
(insert "\n"))
(insert indent-level-spaces extra-insert))
- (insert "\n" indent-level-spaces "end\n"))
+ (insert pre-insert indent-level-spaces item-to-insert))
+ (setq unread-command-events (nconc (listify-key-sequence (kbd "C-e"))
+ unread-command-events))
))))
(defun matlab-ts-mode--post-insert-callback ()
@@ -3065,7 +3086,7 @@ This callback also implements
`matlab-ts-mode-electric-ends'."
;; Add "end" (for `matlab-ts-mode-electric-ends')
(when (and ret-typed
- matlab-ts-mode-electric-ends)
+ matlab-ts-mode-electric-ends)
(matlab-ts-mode--insert-electric-ends)))))
;;; MLint Flycheck
@@ -3471,14 +3492,6 @@ so configuration variables of that mode, do not affect
this mode.
;; TODO update matlab-ts-mode--builtins.el. I generated using R2025a
installation, though I
;; think it was missing a few toolboxes.
;;
- ;; TODO electric-ends
- ;; When writing help doc a return should insert "% "
- ;; function foo
- ;; % help line 1
- ;; % help line 2
- ;; %
- ;; ^ <= RET on help line 2, should insert
"% "
- ;;
;; TODO [future] add matlab-sections-minor-mode indicator in mode line and
make it clickable so
;; it can be turned off
;;
@@ -3559,4 +3572,4 @@
https://github.com/mathworks/Emacs-MATLAB-Mode/blob/default/doc/matlab-language-
;; LocalWords: NPS BUF myfcn pcase xr repeat:nil docstring numberp imenu
alist nondirectory mapc
;; LocalWords: funcall mfile elec foo'bar mapcar lsp noerror alnum featurep
grep'ing mapconcat wie
;; LocalWords: Keymap keymap netshell gud ebstop mlgud ebclear ebstatus mlg
mlgud's subjob reindent
-;; LocalWords: DWIM dwim parens caar cdar utils fooenum mcode CRLF cmddual
lang
+;; LocalWords: DWIM dwim parens caar cdar utils fooenum mcode CRLF cmddual
lang nconc listify kbd
diff --git a/tests/t-utils.el b/tests/t-utils.el
index 2b4c5b66b5..20228eabe3 100644
--- a/tests/t-utils.el
+++ b/tests/t-utils.el
@@ -773,6 +773,11 @@ TODO should example test setup, see
t-utils-test-font-lock."
(t-utils--insert-file-for-test lang-file)
+ ;; Font lock may be required by commands exercised by t-utils-xr.
+ (font-lock-mode 1)
+ (font-lock-flush (point-min) (point-max))
+ (font-lock-ensure (point-min) (point-max))
+
(let* ((start-time (current-time))
(expected-file (replace-regexp-in-string "\\.[^.]+\\'"
"_expected.org"
lang-file))
diff --git
a/tests/test-matlab-ts-mode-electric-ends-files/electric_ends_cases.m
b/tests/test-matlab-ts-mode-electric-ends-files/electric_ends_cases.m
index 498a62e8f9..d8157887c0 100644
--- a/tests/test-matlab-ts-mode-electric-ends-files/electric_ends_cases.m
+++ b/tests/test-matlab-ts-mode-electric-ends-files/electric_ends_cases.m
@@ -12,7 +12,9 @@ classdef electric_ends_cases
%(t-utils-xr "C-n" "C-i" (insert "function bar") "C-m" (insert
"disp('bar')"))
+ %(t-utils-xr (re-search-forward "foo help") "C-m" "C-e" (insert "line
2"))
function foo(a)
+ % foo help
%(t-utils-xr "C-n" "C-i" (insert "arguments") "C-m" (insert "a"))
diff --git
a/tests/test-matlab-ts-mode-electric-ends-files/electric_ends_cases_expected.org
b/tests/test-matlab-ts-mode-electric-ends-files/electric_ends_cases_expected.org
index 50bf633144..a5a8c39e0f 100644
---
a/tests/test-matlab-ts-mode-electric-ends-files/electric_ends_cases_expected.org
+++
b/tests/test-matlab-ts-mode-electric-ends-files/electric_ends_cases_expected.org
@@ -302,9 +302,9 @@
%(t-utils-xr "C-n" "C-i" (insert "function bar") "C-m" (insert
"disp('bar')"))
-
+
+ %(t-utils-xr (re-search-forward "foo help") "C-m" "C-e" (insert "line
2"))
function foo(a)
-
- %(t-utils-xr "C-n" "C-i" (insert "arguments") "C-m" (insert "a"))
+ % foo help
#+end_src diff
- Invoking : (insert "function bar")
@@ -322,9 +322,9 @@
%(t-utils-xr "C-n" "C-i" (insert "function bar") "C-m" (insert
"disp('bar')"))
-
+ function bar
+ %(t-utils-xr (re-search-forward "foo help") "C-m" "C-e" (insert "line
2"))
function foo(a)
-
- %(t-utils-xr "C-n" "C-i" (insert "arguments") "C-m" (insert "a"))
+ % foo help
#+end_src diff
- Invoking : "C-m" = newline
@@ -343,9 +343,9 @@
+
+ end
+
+ %(t-utils-xr (re-search-forward "foo help") "C-m" "C-e" (insert "line
2"))
function foo(a)
-
- %(t-utils-xr "C-n" "C-i" (insert "arguments") "C-m" (insert "a"))
+ % foo help
#+end_src diff
- Invoking : (insert "disp('bar')")
@@ -365,31 +365,88 @@
+ disp('bar')
end
+ %(t-utils-xr (re-search-forward "foo help") "C-m" "C-e" (insert "line
2"))
+ #+end_src diff
+
+* Executing commands from electric_ends_cases.m:27:9:
+
+ (t-utils-xr (re-search-forward "foo help") "C-m" "C-e" (insert "line 2"))
+
+- Invoking : (re-search-forward "foo help")
+ Start point : 657
+ Moved to point: 700
+ : 29:18: % foo help
+ : ^
+ No buffer modifications
+
+- Invoking : "C-m" = newline
+ Start point : 700
+ Moved to point: 709
+ : 30:8: %
+ : ^
+ Buffer modified:
+ #+begin_src diff
+--- start_contents
++++ end_contents
+@@ -27,6 +27,7 @@
+ %(t-utils-xr (re-search-forward "foo help") "C-m" "C-e" (insert "line
2"))
function foo(a)
+ % foo help
++ %
+
+ %(t-utils-xr "C-n" "C-i" (insert "arguments") "C-m" (insert "a"))
+
#+end_src diff
-* Executing commands from electric_ends_cases.m:29:13:
+- Invoking : "C-e" = move-end-of-line
+ Start point : 709
+ Moved to point: 711
+ : 30:10: %
+ : ^
+ No buffer modifications
+
+- Invoking : (insert "line 2")
+ Start point : 711
+ Moved to point: 717
+ : 30:16: % line 2
+ : ^
+ Buffer modified:
+ #+begin_src diff
+--- start_contents
++++ end_contents
+@@ -27,7 +27,7 @@
+ %(t-utils-xr (re-search-forward "foo help") "C-m" "C-e" (insert "line
2"))
+ function foo(a)
+ % foo help
+- %
++ % line 2
+
+ %(t-utils-xr "C-n" "C-i" (insert "arguments") "C-m" (insert "a"))
+
+ #+end_src diff
+
+* Executing commands from electric_ends_cases.m:32:13:
(t-utils-xr "C-n" "C-i" (insert "arguments") "C-m" (insert "a"))
- Invoking : "C-n" = next-line
- Start point : 677
- Moved to point: 678
- : 30:0:
+ Start point : 796
+ Moved to point: 797
+ : 33:0:
: ^
No buffer modifications
- Invoking : "C-i" = indent-for-tab-command
- Start point : 678
- Moved to point: 690
- : 30:12:
+ Start point : 797
+ Moved to point: 809
+ : 33:12:
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -27,7 +27,7 @@
- function foo(a)
+@@ -30,7 +30,7 @@
+ % line 2
%(t-utils-xr "C-n" "C-i" (insert "arguments") "C-m" (insert "a"))
-
@@ -400,16 +457,16 @@
#+end_src diff
- Invoking : (insert "arguments")
- Start point : 690
- Moved to point: 699
- : 30:21: arguments
+ Start point : 809
+ Moved to point: 818
+ : 33:21: arguments
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -27,7 +27,7 @@
- function foo(a)
+@@ -30,7 +30,7 @@
+ % line 2
%(t-utils-xr "C-n" "C-i" (insert "arguments") "C-m" (insert "a"))
-
@@ -420,15 +477,15 @@
#+end_src diff
- Invoking : "C-m" = newline
- Start point : 699
- Moved to point: 716
- : 31:16:
+ Start point : 818
+ Moved to point: 835
+ : 34:16:
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -28,6 +28,9 @@
+@@ -31,6 +31,9 @@
%(t-utils-xr "C-n" "C-i" (insert "arguments") "C-m" (insert "a"))
arguments
@@ -441,15 +498,15 @@
#+end_src diff
- Invoking : (insert "a")
- Start point : 716
- Moved to point: 717
- : 31:17: a
+ Start point : 835
+ Moved to point: 836
+ : 34:17: a
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -28,7 +28,7 @@
+@@ -31,7 +31,7 @@
%(t-utils-xr "C-n" "C-i" (insert "arguments") "C-m" (insert "a"))
arguments
@@ -460,27 +517,27 @@
%(t-utils-xr "C-n" "C-i" (insert "if a") "C-m" (insert
"disp('if')"))
#+end_src diff
-* Executing commands from electric_ends_cases.m:34:13:
+* Executing commands from electric_ends_cases.m:37:13:
(t-utils-xr "C-n" "C-i" (insert "if a") "C-m" (insert "disp('if')"))
- Invoking : "C-n" = next-line
- Start point : 816
- Moved to point: 817
- : 35:0:
+ Start point : 935
+ Moved to point: 936
+ : 38:0:
: ^
No buffer modifications
- Invoking : "C-i" = indent-for-tab-command
- Start point : 817
- Moved to point: 829
- : 35:12:
+ Start point : 936
+ Moved to point: 948
+ : 38:12:
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -32,7 +32,7 @@
+@@ -35,7 +35,7 @@
end
%(t-utils-xr "C-n" "C-i" (insert "if a") "C-m" (insert
"disp('if')"))
@@ -492,15 +549,15 @@
#+end_src diff
- Invoking : (insert "if a")
- Start point : 829
- Moved to point: 833
- : 35:16: if a
+ Start point : 948
+ Moved to point: 952
+ : 38:16: if a
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -32,7 +32,7 @@
+@@ -35,7 +35,7 @@
end
%(t-utils-xr "C-n" "C-i" (insert "if a") "C-m" (insert
"disp('if')"))
@@ -512,15 +569,15 @@
#+end_src diff
- Invoking : "C-m" = newline
- Start point : 833
- Moved to point: 850
- : 36:16:
+ Start point : 952
+ Moved to point: 969
+ : 39:16:
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -33,6 +33,9 @@
+@@ -36,6 +36,9 @@
%(t-utils-xr "C-n" "C-i" (insert "if a") "C-m" (insert
"disp('if')"))
if a
@@ -533,15 +590,15 @@
#+end_src diff
- Invoking : (insert "disp('if')")
- Start point : 850
- Moved to point: 860
- : 36:26: disp('if')
+ Start point : 969
+ Moved to point: 979
+ : 39:26: disp('if')
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -33,7 +33,7 @@
+@@ -36,7 +36,7 @@
%(t-utils-xr "C-n" "C-i" (insert "if a") "C-m" (insert
"disp('if')"))
if a
@@ -552,27 +609,27 @@
%(t-utils-xr "C-n" "C-i" (insert "switch a") "C-m" "C-e" (insert
"1") "C-m" (insert "disp('case 1')"))
#+end_src diff
-* Executing commands from electric_ends_cases.m:39:13:
+* Executing commands from electric_ends_cases.m:42:13:
(t-utils-xr "C-n" "C-i" (insert "switch a") "C-m" "C-e" (insert "1") "C-m"
(insert "disp('case 1')"))
- Invoking : "C-n" = next-line
- Start point : 992
- Moved to point: 993
- : 40:0:
+ Start point : 1111
+ Moved to point: 1112
+ : 43:0:
: ^
No buffer modifications
- Invoking : "C-i" = indent-for-tab-command
- Start point : 993
- Moved to point: 1005
- : 40:12:
+ Start point : 1112
+ Moved to point: 1124
+ : 43:12:
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -37,7 +37,7 @@
+@@ -40,7 +40,7 @@
end
%(t-utils-xr "C-n" "C-i" (insert "switch a") "C-m" "C-e" (insert
"1") "C-m" (insert "disp('case 1')"))
@@ -584,15 +641,15 @@
#+end_src diff
- Invoking : (insert "switch a")
- Start point : 1005
- Moved to point: 1013
- : 40:20: switch a
+ Start point : 1124
+ Moved to point: 1132
+ : 43:20: switch a
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -37,7 +37,7 @@
+@@ -40,7 +40,7 @@
end
%(t-utils-xr "C-n" "C-i" (insert "switch a") "C-m" "C-e" (insert
"1") "C-m" (insert "disp('case 1')"))
@@ -604,15 +661,15 @@
#+end_src diff
- Invoking : "C-m" = newline
- Start point : 1013
- Moved to point: 1028
- : 41:14: case
+ Start point : 1132
+ Moved to point: 1147
+ : 44:14: case
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -38,6 +38,9 @@
+@@ -41,6 +41,9 @@
%(t-utils-xr "C-n" "C-i" (insert "switch a") "C-m" "C-e" (insert
"1") "C-m" (insert "disp('case 1')"))
switch a
@@ -625,22 +682,22 @@
#+end_src diff
- Invoking : "C-e" = move-end-of-line
- Start point : 1028
- Moved to point: 1033
- : 41:19: case
+ Start point : 1147
+ Moved to point: 1152
+ : 44:19: case
: ^
No buffer modifications
- Invoking : (insert "1")
- Start point : 1033
- Moved to point: 1034
- : 41:20: case 1
+ Start point : 1152
+ Moved to point: 1153
+ : 44:20: case 1
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -38,7 +38,7 @@
+@@ -41,7 +41,7 @@
%(t-utils-xr "C-n" "C-i" (insert "switch a") "C-m" "C-e" (insert
"1") "C-m" (insert "disp('case 1')"))
switch a
@@ -652,15 +709,15 @@
#+end_src diff
- Invoking : "C-m" = newline
- Start point : 1034
- Moved to point: 1051
- : 42:16:
+ Start point : 1153
+ Moved to point: 1170
+ : 45:16:
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -39,6 +39,7 @@
+@@ -42,6 +42,7 @@
%(t-utils-xr "C-n" "C-i" (insert "switch a") "C-m" "C-e" (insert
"1") "C-m" (insert "disp('case 1')"))
switch a
case 1
@@ -671,15 +728,15 @@
#+end_src diff
- Invoking : (insert "disp('case 1')")
- Start point : 1051
- Moved to point: 1065
- : 42:30: disp('case 1')
+ Start point : 1170
+ Moved to point: 1184
+ : 45:30: disp('case 1')
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -39,7 +39,7 @@
+@@ -42,7 +42,7 @@
%(t-utils-xr "C-n" "C-i" (insert "switch a") "C-m" "C-e" (insert
"1") "C-m" (insert "disp('case 1')"))
switch a
case 1
@@ -690,27 +747,27 @@
%(t-utils-xr "C-n" "C-i" (insert "while true") "C-m" (insert
"break"))
#+end_src diff
-* Executing commands from electric_ends_cases.m:45:13:
+* Executing commands from electric_ends_cases.m:48:13:
(t-utils-xr "C-n" "C-i" (insert "while true") "C-m" (insert "break"))
- Invoking : "C-n" = next-line
- Start point : 1165
- Moved to point: 1166
- : 46:0:
+ Start point : 1284
+ Moved to point: 1285
+ : 49:0:
: ^
No buffer modifications
- Invoking : "C-i" = indent-for-tab-command
- Start point : 1166
- Moved to point: 1178
- : 46:12:
+ Start point : 1285
+ Moved to point: 1297
+ : 49:12:
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -43,7 +43,7 @@
+@@ -46,7 +46,7 @@
end
%(t-utils-xr "C-n" "C-i" (insert "while true") "C-m" (insert
"break"))
@@ -722,15 +779,15 @@
#+end_src diff
- Invoking : (insert "while true")
- Start point : 1178
- Moved to point: 1188
- : 46:22: while true
+ Start point : 1297
+ Moved to point: 1307
+ : 49:22: while true
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -43,7 +43,7 @@
+@@ -46,7 +46,7 @@
end
%(t-utils-xr "C-n" "C-i" (insert "while true") "C-m" (insert
"break"))
@@ -742,15 +799,15 @@
#+end_src diff
- Invoking : "C-m" = newline
- Start point : 1188
- Moved to point: 1205
- : 47:16:
+ Start point : 1307
+ Moved to point: 1324
+ : 50:16:
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -44,6 +44,9 @@
+@@ -47,6 +47,9 @@
%(t-utils-xr "C-n" "C-i" (insert "while true") "C-m" (insert
"break"))
while true
@@ -763,15 +820,15 @@
#+end_src diff
- Invoking : (insert "break")
- Start point : 1205
- Moved to point: 1210
- : 47:21: break
+ Start point : 1324
+ Moved to point: 1329
+ : 50:21: break
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -44,7 +44,7 @@
+@@ -47,7 +47,7 @@
%(t-utils-xr "C-n" "C-i" (insert "while true") "C-m" (insert
"break"))
while true
@@ -782,27 +839,27 @@
%(t-utils-xr "C-n" "C-i" (insert "for idx=1:a") "C-m" (insert
"disp(idx)"))
#+end_src diff
-* Executing commands from electric_ends_cases.m:50:13:
+* Executing commands from electric_ends_cases.m:53:13:
(t-utils-xr "C-n" "C-i" (insert "for idx=1:a") "C-m" (insert "disp(idx)"))
- Invoking : "C-n" = next-line
- Start point : 1315
- Moved to point: 1316
- : 51:0:
+ Start point : 1434
+ Moved to point: 1435
+ : 54:0:
: ^
No buffer modifications
- Invoking : "C-i" = indent-for-tab-command
- Start point : 1316
- Moved to point: 1328
- : 51:12:
+ Start point : 1435
+ Moved to point: 1447
+ : 54:12:
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -48,7 +48,7 @@
+@@ -51,7 +51,7 @@
end
%(t-utils-xr "C-n" "C-i" (insert "for idx=1:a") "C-m" (insert
"disp(idx)"))
@@ -814,15 +871,15 @@
#+end_src diff
- Invoking : (insert "for idx=1:a")
- Start point : 1328
- Moved to point: 1339
- : 51:23: for idx=1:a
+ Start point : 1447
+ Moved to point: 1458
+ : 54:23: for idx=1:a
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -48,7 +48,7 @@
+@@ -51,7 +51,7 @@
end
%(t-utils-xr "C-n" "C-i" (insert "for idx=1:a") "C-m" (insert
"disp(idx)"))
@@ -834,15 +891,15 @@
#+end_src diff
- Invoking : "C-m" = newline
- Start point : 1339
- Moved to point: 1356
- : 52:16:
+ Start point : 1458
+ Moved to point: 1475
+ : 55:16:
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -49,6 +49,9 @@
+@@ -52,6 +52,9 @@
%(t-utils-xr "C-n" "C-i" (insert "for idx=1:a") "C-m" (insert
"disp(idx)"))
for idx=1:a
@@ -855,15 +912,15 @@
#+end_src diff
- Invoking : (insert "disp(idx)")
- Start point : 1356
- Moved to point: 1365
- : 52:25: disp(idx)
+ Start point : 1475
+ Moved to point: 1484
+ : 55:25: disp(idx)
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -49,7 +49,7 @@
+@@ -52,7 +52,7 @@
%(t-utils-xr "C-n" "C-i" (insert "for idx=1:a") "C-m" (insert
"disp(idx)"))
for idx=1:a
@@ -874,27 +931,27 @@
%(t-utils-xr "C-n" "C-i" (insert "parfor idx=1:a") "C-m" (insert
"disp(idx)"))
#+end_src diff
-* Executing commands from electric_ends_cases.m:55:13:
+* Executing commands from electric_ends_cases.m:58:13:
(t-utils-xr "C-n" "C-i" (insert "parfor idx=1:a") "C-m" (insert "disp(idx)"))
- Invoking : "C-n" = next-line
- Start point : 1473
- Moved to point: 1474
- : 56:0:
+ Start point : 1592
+ Moved to point: 1593
+ : 59:0:
: ^
No buffer modifications
- Invoking : "C-i" = indent-for-tab-command
- Start point : 1474
- Moved to point: 1486
- : 56:12:
+ Start point : 1593
+ Moved to point: 1605
+ : 59:12:
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -53,7 +53,7 @@
+@@ -56,7 +56,7 @@
end
%(t-utils-xr "C-n" "C-i" (insert "parfor idx=1:a") "C-m" (insert
"disp(idx)"))
@@ -906,15 +963,15 @@
#+end_src diff
- Invoking : (insert "parfor idx=1:a")
- Start point : 1486
- Moved to point: 1500
- : 56:26: parfor idx=1:a
+ Start point : 1605
+ Moved to point: 1619
+ : 59:26: parfor idx=1:a
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -53,7 +53,7 @@
+@@ -56,7 +56,7 @@
end
%(t-utils-xr "C-n" "C-i" (insert "parfor idx=1:a") "C-m" (insert
"disp(idx)"))
@@ -926,15 +983,15 @@
#+end_src diff
- Invoking : "C-m" = newline
- Start point : 1500
- Moved to point: 1517
- : 57:16:
+ Start point : 1619
+ Moved to point: 1636
+ : 60:16:
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -54,6 +54,9 @@
+@@ -57,6 +57,9 @@
%(t-utils-xr "C-n" "C-i" (insert "parfor idx=1:a") "C-m" (insert
"disp(idx)"))
parfor idx=1:a
@@ -947,15 +1004,15 @@
#+end_src diff
- Invoking : (insert "disp(idx)")
- Start point : 1517
- Moved to point: 1526
- : 57:25: disp(idx)
+ Start point : 1636
+ Moved to point: 1645
+ : 60:25: disp(idx)
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -54,7 +54,7 @@
+@@ -57,7 +57,7 @@
%(t-utils-xr "C-n" "C-i" (insert "parfor idx=1:a") "C-m" (insert
"disp(idx)"))
parfor idx=1:a
@@ -966,27 +1023,27 @@
%(t-utils-xr "C-n" "C-i" (insert "spmd") "C-m" (insert "q =
magic(spmdIndex + 2)"))
#+end_src diff
-* Executing commands from electric_ends_cases.m:60:13:
+* Executing commands from electric_ends_cases.m:63:13:
(t-utils-xr "C-n" "C-i" (insert "spmd") "C-m" (insert "q = magic(spmdIndex +
2)"))
- Invoking : "C-n" = next-line
- Start point : 1639
- Moved to point: 1640
- : 61:0:
+ Start point : 1758
+ Moved to point: 1759
+ : 64:0:
: ^
No buffer modifications
- Invoking : "C-i" = indent-for-tab-command
- Start point : 1640
- Moved to point: 1652
- : 61:12:
+ Start point : 1759
+ Moved to point: 1771
+ : 64:12:
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -58,7 +58,7 @@
+@@ -61,7 +61,7 @@
end
%(t-utils-xr "C-n" "C-i" (insert "spmd") "C-m" (insert "q =
magic(spmdIndex + 2)"))
@@ -998,15 +1055,15 @@
#+end_src diff
- Invoking : (insert "spmd")
- Start point : 1652
- Moved to point: 1656
- : 61:16: spmd
+ Start point : 1771
+ Moved to point: 1775
+ : 64:16: spmd
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -58,7 +58,7 @@
+@@ -61,7 +61,7 @@
end
%(t-utils-xr "C-n" "C-i" (insert "spmd") "C-m" (insert "q =
magic(spmdIndex + 2)"))
@@ -1018,15 +1075,15 @@
#+end_src diff
- Invoking : "C-m" = newline
- Start point : 1656
- Moved to point: 1673
- : 62:16:
+ Start point : 1775
+ Moved to point: 1792
+ : 65:16:
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -59,6 +59,9 @@
+@@ -62,6 +62,9 @@
%(t-utils-xr "C-n" "C-i" (insert "spmd") "C-m" (insert "q =
magic(spmdIndex + 2)"))
spmd
@@ -1039,15 +1096,15 @@
#+end_src diff
- Invoking : (insert "q = magic(spmdIndex + 2)")
- Start point : 1673
- Moved to point: 1697
- : 62:40: q = magic(spmdIndex + 2)
+ Start point : 1792
+ Moved to point: 1816
+ : 65:40: q = magic(spmdIndex + 2)
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -59,7 +59,7 @@
+@@ -62,7 +62,7 @@
%(t-utils-xr "C-n" "C-i" (insert "spmd") "C-m" (insert "q =
magic(spmdIndex + 2)"))
spmd
@@ -1058,27 +1115,27 @@
%(t-utils-xr "C-n" "C-i" (insert "try") "C-m" (insert
"disp('try')"))
#+end_src diff
-* Executing commands from electric_ends_cases.m:65:13:
+* Executing commands from electric_ends_cases.m:68:13:
(t-utils-xr "C-n" "C-i" (insert "try") "C-m" (insert "disp('try')"))
- Invoking : "C-n" = next-line
- Start point : 1796
- Moved to point: 1797
- : 66:0:
+ Start point : 1915
+ Moved to point: 1916
+ : 69:0:
: ^
No buffer modifications
- Invoking : "C-i" = indent-for-tab-command
- Start point : 1797
- Moved to point: 1809
- : 66:12:
+ Start point : 1916
+ Moved to point: 1928
+ : 69:12:
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -63,7 +63,7 @@
+@@ -66,7 +66,7 @@
end
%(t-utils-xr "C-n" "C-i" (insert "try") "C-m" (insert
"disp('try')"))
@@ -1090,15 +1147,15 @@
#+end_src diff
- Invoking : (insert "try")
- Start point : 1809
- Moved to point: 1812
- : 66:15: try
+ Start point : 1928
+ Moved to point: 1931
+ : 69:15: try
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -63,7 +63,7 @@
+@@ -66,7 +66,7 @@
end
%(t-utils-xr "C-n" "C-i" (insert "try") "C-m" (insert
"disp('try')"))
@@ -1110,15 +1167,15 @@
#+end_src diff
- Invoking : "C-m" = newline
- Start point : 1812
- Moved to point: 1829
- : 67:16:
+ Start point : 1931
+ Moved to point: 1948
+ : 70:16:
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -64,6 +64,10 @@
+@@ -67,6 +67,10 @@
%(t-utils-xr "C-n" "C-i" (insert "try") "C-m" (insert
"disp('try')"))
try
@@ -1132,15 +1189,15 @@
#+end_src diff
- Invoking : (insert "disp('try')")
- Start point : 1829
- Moved to point: 1840
- : 67:27: disp('try')
+ Start point : 1948
+ Moved to point: 1959
+ : 70:27: disp('try')
: ^
Buffer modified:
#+begin_src diff
--- start_contents
+++ end_contents
-@@ -64,7 +64,7 @@
+@@ -67,7 +67,7 @@
%(t-utils-xr "C-n" "C-i" (insert "try") "C-m" (insert
"disp('try')"))
try
@@ -1151,12 +1208,12 @@
#+end_src diff
-* Executing commands from electric_ends_cases.m:76:1:
+* Executing commands from electric_ends_cases.m:79:1:
(t-utils-xr (t-utils-xr-print-code (point-min) (point-max)))
- Invoking : (t-utils-xr-print-code (point-min) (point-max))
- Start point : 1966
+ Start point : 2085
No point movement
standard-output:
#+begin_src matlab-ts
@@ -1186,7 +1243,10 @@ classdef electric_ends_cases
disp('bar')
end
+ %(t-utils-xr (re-search-forward \"foo help\") \"C-m\" \"C-e\" (insert
\"line 2\"))
function foo(a)
+ % foo help
+ % line 2
%(t-utils-xr \"C-n\" \"C-i\" (insert \"arguments\") \"C-m\"
(insert \"a\"))
arguments