emacs-diffs
[Top][All Lists]
Advanced

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

master f0c5de7839: * lisp/progmodes/cc-defs.el (c-safe-scan-lists): Eval


From: Alan Mackenzie
Subject: master f0c5de7839: * lisp/progmodes/cc-defs.el (c-safe-scan-lists): Evaluate LIMIT just once
Date: Wed, 17 Aug 2022 16:36:25 -0400 (EDT)

branch: master
commit f0c5de78394cb3155cf51f5946f25610e2ab5d0b
Author: Alan Mackenzie <acm@muc.de>
Commit: Alan Mackenzie <acm@muc.de>

    * lisp/progmodes/cc-defs.el (c-safe-scan-lists): Evaluate LIMIT just once
---
 lisp/progmodes/cc-defs.el | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el
index 04f519dd0a..48ae4368a7 100644
--- a/lisp/progmodes/cc-defs.el
+++ b/lisp/progmodes/cc-defs.el
@@ -794,15 +794,16 @@ right side of it."
               `(c-safe (scan-lists ,from ,count ,depth)))))
     (if limit
        `(save-restriction
-          (when ,limit
-            ,(if (numberp count)
-                 (if (< count 0)
-                     `(narrow-to-region ,limit (point-max))
-                   `(narrow-to-region (point-min) ,limit))
-               `(if (< ,count 0)
-                    (narrow-to-region ,limit (point-max))
-                  (narrow-to-region (point-min) ,limit))))
-          ,res)
+          (let ((-limit- ,limit))
+            (when -limit-
+              ,(if (numberp count)
+                   (if (< count 0)
+                       `(narrow-to-region -limit- (point-max))
+                     `(narrow-to-region (point-min) -limit-))
+                 `(if (< ,count 0)
+                      (narrow-to-region -limit- (point-max))
+                    (narrow-to-region (point-min) -limit-))))
+            ,res))
       res)))
 
 



reply via email to

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