branch: externals/matlab-mode
commit 5c610ab763580d9cbee86a790a7f5b5bb8f29466
Author: John Ciolfi <[email protected]>
Commit: John Ciolfi <[email protected]>

    Add manual prof-matlab-ts-mode--ei-move-to-and-get-node
---
 tests/prof/.dir-locals.el                          | 43 +++++++++++++++
 ...prof-matlab-ts-mode--ei-move-to-and-get-node.el | 62 ++++++++++++++++++++++
 2 files changed, 105 insertions(+)

diff --git a/tests/prof/.dir-locals.el b/tests/prof/.dir-locals.el
new file mode 100644
index 0000000000..fda118764f
--- /dev/null
+++ b/tests/prof/.dir-locals.el
@@ -0,0 +1,43 @@
+;;; .dir-locals.el ---
+
+;; Author: John Ciolfi <[email protected]>
+
+;; Copyright (C) 2026 Free Software Foundation Inc.
+;;
+;; This program is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+;;
+;; Directory local Emacs variables that are applied to *.el files within the 
current directory.
+
+;;   To avoid prompting to setup flycheck-emacs-lisp-load-path local dir local 
variable, add to your
+;;   ~/.emacs
+;;
+;;     (put 'flycheck-emacs-lisp-load-path 'safe-local-variable #'listp)
+
+((emacs-lisp-mode . ((flycheck-emacs-lisp-load-path . ("." "../.."))
+                     ;; Use spaces when TAB key is pressed, which helps with 
editors that have
+                     ;; different TAB stops.
+                     (indent-tabs-mode . nil)
+                     ;; Monitors are quite large and lisp code often has long 
variable / function
+                     ;; names, so using a fill-column of 100 seems reasonable.
+                     (fill-column . 100)
+                    ;; page-delimiter is used by forward-page "C-x ]", and 
backward-page "C-x ["
+                    (page-delimiter . "^;;; ")
+                    ))
+ (org-mode . ((indent-tabs-mode . nil)
+             (fill-column . 100))))
+
+
+;; LocalWords:  flycheck listp
diff --git a/tests/prof/prof-matlab-ts-mode--ei-move-to-and-get-node.el 
b/tests/prof/prof-matlab-ts-mode--ei-move-to-and-get-node.el
new file mode 100644
index 0000000000..5f562f42ea
--- /dev/null
+++ b/tests/prof/prof-matlab-ts-mode--ei-move-to-and-get-node.el
@@ -0,0 +1,62 @@
+;;; prof-matlab-ts-mode--ei-move-to-and-get-node.el --- -*- lexical-binding: t 
-*-
+
+;; Version: 8.0.0
+;; URL: https://github.com/mathworks/Emacs-MATLAB-Mode
+;; SPDX-License-Identifier: GPL-3.0-or-later
+;;
+;; Author: John Ciolfi <[email protected]>
+;; Created: Dec-29-2025
+;; Keywords: MATLAB
+
+;; Copyright (C) 2025-2026 Free Software Foundation, Inc.
+;;
+;; This file is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published
+;; by the Free Software Foundation, either version 3 of the License,
+;; or (at your option) any later version.
+;;
+;; This file is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this file.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+;;    Manually profile `matlab-ts-mode--ei-move-to-and-get-node'
+
+
+;;; Code:
+
+(require 'profiler)
+(require 'matlab-ts-mode)
+
+(defun prof-matlab-ts-mode--ei-move-to-and-get-node (arg)
+  "Profile `matlab-ts-mode--ei-move-to-and-get-node'.
+This profiles the current `matlab-ts-mode' buffer.
+With prefix ARG, report elapsed time without profiling."
+  (interactive "P")
+  (when (not (eq major-mode 'matlab-ts-mode))
+    (user-error "Buffer %s major-mode is not matlab-ts-mode" (buffer-name)))
+  (goto-char (point-min))
+
+  (unwind-protect
+      (let ((start-time (current-time)))
+         (when (not arg) (profiler-start 'cpu))
+         (while (not (eobp))
+           (matlab-ts-mode--ei-fast-back-to-indentation)
+          (cl-loop while t do
+                   (let* ((pair (matlab-ts-mode--ei-move-to-and-get-node))
+                          (node (car pair)))
+                     (when (not node)
+                       (cl-return))
+                     (goto-char (treesit-node-end node))))
+          (forward-line))
+         (message "elapsed time: %10.1f" (float-time (time-subtract 
(current-time) start-time))))
+    (when (not arg)
+      (profiler-stop)
+      (profiler-report))))
+
+(provide 'prof-matlab-ts-mode--ei-move-to-and-get-node)
+;;; prof-matlab-ts-mode--ei-move-to-and-get-node.el ends here

Reply via email to