emacs-diffs
[Top][All Lists]
Advanced

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

emacs-27 7e78f0d 1/2: Fix void-variable n-reb in re-builder (Bug#40409)


From: Noam Postavsky
Subject: emacs-27 7e78f0d 1/2: Fix void-variable n-reb in re-builder (Bug#40409)
Date: Sat, 4 Apr 2020 20:28:35 -0400 (EDT)

branch: emacs-27
commit 7e78f0d1b26557b1af95c542cc95cff131c18ec8
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>

    Fix void-variable n-reb in re-builder (Bug#40409)
    
    * lisp/emacs-lisp/re-builder.el (reb-while): Take the current value of
    the counter instead of its name.
    (reb-mark-non-matching-parenthesis): Bind n-reb to 0 at the start and
    don't wrongly treat it as dynamicly bound.
---
 lisp/emacs-lisp/re-builder.el | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/lisp/emacs-lisp/re-builder.el b/lisp/emacs-lisp/re-builder.el
index 580e914..0e1618e 100644
--- a/lisp/emacs-lisp/re-builder.el
+++ b/lisp/emacs-lisp/re-builder.el
@@ -767,22 +767,21 @@ If SUBEXP is non-nil mark only the corresponding 
sub-expressions."
      (reb-mark-non-matching-parenthesis))
     nil)))
 
-(defsubst reb-while (limit counter where)
-  (let ((count (symbol-value counter)))
-    (if (= count limit)
-        (progn
-          (message "Reached (while limit=%s, where=%s)" limit where)
-          nil)
-      (set counter (1+ count)))))
+(defsubst reb-while (limit current where)
+  (if (< current limit)
+      (1+ current)
+    (message "Reached (while limit=%s, where=%s)" limit where)
+    nil))
 
 (defun reb-mark-non-matching-parenthesis (bound)
   ;; We have a small string, check the whole of it, but wait until
   ;; everything else is fontified.
   (when (>= bound (point-max))
-    (let (left-pars
+    (let ((n-reb 0)
+          left-pars
           faces-here)
       (goto-char (point-min))
-      (while (and (reb-while 100 'n-reb "mark-par")
+      (while (and (setq n-reb (reb-while 100 n-reb "mark-par"))
                   (not (eobp)))
         (skip-chars-forward "^()")
         (unless (eobp)



reply via email to

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