Subject: bug#61743: cl-loop's "being the intervals of" does not let-bind var

From: JD Smith <[email-masked]>
Date: Thu, 23 Feb 2023 17:44:51 -0500

Macro-expanding the following reveals that the “being the intervals” cl-loop construct fails to let-bind the loop var (i here):

  (cl-loop for i being the intervals of x do (ignore))

expanding to:

(cl-block nil
  (cl-block --cl-finish--
    (cl--map-intervals
     (lambda
       (--cl-var1-- --cl-var2--)
       (setq i
	     (cons --cl-var1-- --cl-var2--))
       (ignore))
     x nil nil nil))
  nil)

This leads to the loop altering global variables.  Emacs v28.2