emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master c15c9f4de62: (conf-toml-recognize-section): Fix bug#70383


From: Stefan Monnier
Subject: master c15c9f4de62: (conf-toml-recognize-section): Fix bug#70383
Date: Wed, 17 Apr 2024 14:33:05 -0400 (EDT)

branch: master
commit c15c9f4de62b5bf06d6ccdb5bbada4f542108a38
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    (conf-toml-recognize-section): Fix bug#70383
    
    * lisp/textmodes/conf-mode.el (conf-toml-recognize-section): Move
    point, like font-lock matchers are expected to do.
---
 lisp/textmodes/conf-mode.el | 41 ++++++++++++++++++++---------------------
 1 file changed, 20 insertions(+), 21 deletions(-)

diff --git a/lisp/textmodes/conf-mode.el b/lisp/textmodes/conf-mode.el
index 5e1636033f6..e74409128df 100644
--- a/lisp/textmodes/conf-mode.el
+++ b/lisp/textmodes/conf-mode.el
@@ -613,27 +613,26 @@ For details see `conf-mode'.  Example:
   "Font-lock helper function for `conf-toml-mode'.
 Handles recognizing TOML section names, like [section],
 \[[section]], or [something.\"else\".section]."
-  (save-excursion
-    ;; Skip any number of "[" to handle things like [[section]].
-    (when (re-search-forward "^\\s-*\\[+" limit t)
-      (let ((start (point)))
-        (backward-char)
-        (let ((end (min limit
-                        (condition-case nil
-                            (progn
-                              (forward-list)
-                              (1- (point)))
-                          (scan-error
-                           (end-of-line)
-                           (point))))))
-          ;; If there is a comma in the text, then we assume this is
-          ;; an array and not a section.  (This could be refined to
-          ;; look only for unquoted commas if necessary.)
-          (save-excursion
-            (goto-char start)
-            (unless (search-forward "," end t)
-              (set-match-data (list start end))
-              t)))))))
+  ;; Skip any number of "[" to handle things like [[section]].
+  (when (re-search-forward "^\\s-*\\[+" limit t)
+    (let ((start (point)))
+      (backward-char)
+      (let ((end (min limit
+                      (condition-case nil
+                          (progn
+                            (forward-list)
+                            (1- (point)))
+                        (scan-error
+                         (end-of-line)
+                         (point))))))
+        ;; If there is a comma in the text, then we assume this is
+        ;; an array and not a section.  (This could be refined to
+        ;; look only for unquoted commas if necessary.)
+        (save-excursion
+          (goto-char start)
+          (unless (search-forward "," end t)
+            (set-match-data (list start end))
+            t))))))
 
 ;;;###autoload
 (define-derived-mode conf-toml-mode conf-mode "Conf[TOML]"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]