* lisp/progmodes/cc-defs.el (c-safe-scan-lists): Evaluate LIMIT just once

This commit is contained in:
Alan Mackenzie 2022-08-17 20:34:43 +00:00
parent 31f289625c
commit f0c5de7839

View file

@ -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)))