branch: externals/matlab-mode
commit 4a98c8b952c27d910a03c16bcac946e1505eda1d
Author: John Ciolfi <john.ciolfi...@gmail.com>
Commit: John Ciolfi <john.ciolfi...@gmail.com>

    Minor regex optimization, [[:blank:]] => [ \t]
    
    [[:blank:]] matches more than space and tab, so use space and tab when 
outside of comments.
    MATLAB language only allows unicode spaces in comments.
---
 matlab-scan.el     |  6 +++---
 matlab-sections.el | 10 +++++-----
 tlc.el             |  4 ++--
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/matlab-scan.el b/matlab-scan.el
index 5df173504d..efe0255841 100644
--- a/matlab-scan.el
+++ b/matlab-scan.el
@@ -802,15 +802,15 @@ and DECLARATION-PT.  Examples:
       (goto-char start-pt)
       (beginning-of-line)
 
-      (when (looking-at "^[[:blank:]]*%[[:blank:]]*copyright\\b")
+      (when (looking-at "^[ \t]*%[ \t]*copyright\\b")
         (beginning-of-line)
         (forward-line -1)
-        (while (looking-at "^[[:blank:]]*$")
+        (while (looking-at "^[ \t]*$")
           (forward-line -1)))
 
       (while (and (> (point) declaration-pt)
                   (not found-non-comment-blank-line)
-                  (re-search-backward "^[[:blank:]]*$" declaration-pt t))
+                  (re-search-backward "^[ \t]*$" declaration-pt t))
         (if (nth 4 (syntax-ppss))
             ;; blank line in a multi-line %{ ... %} comment
             (forward-line -1)
diff --git a/matlab-sections.el b/matlab-sections.el
index ed88dfe8fe..bfe7cd6966 100644
--- a/matlab-sections.el
+++ b/matlab-sections.el
@@ -76,7 +76,7 @@ the reason for it being optional."
   :safe 'booleanp)
 
 (defcustom matlab-sections-section-break-regexp
-  (concat "^[[:blank:]]*" ;; Can have space or tabs prior to the "%%" 
characters
+  (concat "^[ \t]*" ;; Can have space or tabs prior to the "%%" characters
           "\\("
           "%%"            ;; Next must have two "%%" characters
           "\\(?:"         ;; Optionally followed by a description or blanks
@@ -142,7 +142,7 @@ determine the RANGE."
     (save-restriction
       (widen)
       (goto-char (car range))
-      (when (not (looking-at "^[[:blank:]]*%%[[:blank:]]*\\(.*\\)$"))
+      (when (not (looking-at "^[ \t]*%%[[:blank:]]*\\(.*\\)$"))
         (error "Assert - failed to match section heading at point %S" (point)))
       (let ((heading (string-trim (match-string-no-properties 1))))
         (when (string= heading "")
@@ -227,7 +227,7 @@ Optionally provide prefix argument ARG to move by that many 
sections."
           (when (not (eobp))
             (forward-line))
           (while (and (not (eobp))
-                      (looking-at "^[[:blank:]]*$"))
+                      (looking-at "^[ \t]*$"))
             (forward-line))
           (setq next-section-pt (point))))
       (when (not next-section-pt)
@@ -268,7 +268,7 @@ Return `point'."
       (progn
         (forward-line)
         (while (and (not (eobp))
-                    (looking-at "^[[:blank:]]*$"))
+                    (looking-at "^[ \t]*$"))
           (forward-line)))
     ;; else consider case where there's code before first section, if so go 
there
     (goto-char (point-min)))
@@ -287,7 +287,7 @@ Return `point'."
         (when (not (bobp))
           (forward-line -1))
         (while (and (not (bobp))
-                    (looking-at "^[[:blank:]]*$"))
+                    (looking-at "^[ \t]*$"))
           (forward-line -1))
         ;; move to the point where we'd start code
         (forward-line))
diff --git a/tlc.el b/tlc.el
index 4ce364fc07..b32398cf03 100644
--- a/tlc.el
+++ b/tlc.el
@@ -1,4 +1,4 @@
-;;; tlc --- Major mode for editing tlc files -*- lexical-binding: t -*-
+y;;; tlc --- Major mode for editing tlc files -*- lexical-binding: t -*-
 
 ;; Copyright (C) 2024 Free Software Foundation, Inc.
 
@@ -138,7 +138,7 @@
   :type 'hook)
 
 (defvar tlc--imenu-generic-expression
-  '((nil "^[[:blank:]]*%function[[:blank:]]+\\([a-zA-Z0-9_]+\\)" 1))
+  '((nil "^[ \t]*%function[ \t]+\\([a-zA-Z0-9_]+\\)" 1))
   "Regexp to find function names in *.tlc files for `imenu'.")
 
 (defvar tlc-syntax-table nil

Reply via email to