aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/emacs-lisp/cl-macs.el32
1 files changed, 7 insertions, 25 deletions
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index cda25d186fd..00f34d3fb60 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -897,7 +897,7 @@ This is compatible with Common Lisp, but note that `defun' and
897(defvar cl--loop-name) 897(defvar cl--loop-name)
898(defvar cl--loop-result) (defvar cl--loop-result-explicit) 898(defvar cl--loop-result) (defvar cl--loop-result-explicit)
899(defvar cl--loop-result-var) (defvar cl--loop-steps) 899(defvar cl--loop-result-var) (defvar cl--loop-steps)
900(defvar cl--loop-symbol-macs) (defvar cl--loop-guard-cond) 900(defvar cl--loop-symbol-macs)
901 901
902(defun cl--loop-set-iterator-function (kind iterator) 902(defun cl--loop-set-iterator-function (kind iterator)
903 (if cl--loop-iterator-function 903 (if cl--loop-iterator-function
@@ -966,7 +966,7 @@ For more details, see Info node `(cl)Loop Facility'.
966 (cl--loop-accum-var nil) (cl--loop-accum-vars nil) 966 (cl--loop-accum-var nil) (cl--loop-accum-vars nil)
967 (cl--loop-initially nil) (cl--loop-finally nil) 967 (cl--loop-initially nil) (cl--loop-finally nil)
968 (cl--loop-iterator-function nil) (cl--loop-first-flag nil) 968 (cl--loop-iterator-function nil) (cl--loop-first-flag nil)
969 (cl--loop-symbol-macs nil) (cl--loop-guard-cond nil)) 969 (cl--loop-symbol-macs nil))
970 ;; Here is more or less how those dynbind vars are used after looping 970 ;; Here is more or less how those dynbind vars are used after looping
971 ;; over cl--parse-loop-clause: 971 ;; over cl--parse-loop-clause:
972 ;; 972 ;;
@@ -1001,24 +1001,7 @@ For more details, see Info node `(cl)Loop Facility'.
1001 (list (or cl--loop-result-explicit 1001 (list (or cl--loop-result-explicit
1002 cl--loop-result)))) 1002 cl--loop-result))))
1003 (ands (cl--loop-build-ands (nreverse cl--loop-body))) 1003 (ands (cl--loop-build-ands (nreverse cl--loop-body)))
1004 (while-body 1004 (while-body (nconc (cadr ands) (nreverse cl--loop-steps)))
1005 (nconc
1006 (cadr ands)
1007 (if (or (not cl--loop-guard-cond) (not cl--loop-first-flag))
1008 (nreverse cl--loop-steps)
1009 ;; Right after update the loop variable ensure that the loop
1010 ;; condition, i.e. (car ands), is still satisfied; otherwise,
1011 ;; set `cl--loop-first-flag' nil and skip the remaining
1012 ;; body forms (#Bug#29799).
1013 ;;
1014 ;; (last cl--loop-steps) updates the loop var
1015 ;; (car (butlast cl--loop-steps)) sets `cl--loop-first-flag' nil
1016 ;; (nreverse (cdr (butlast cl--loop-steps))) are the
1017 ;; remaining body forms.
1018 (append (last cl--loop-steps)
1019 `((and ,(car ands)
1020 ,@(nreverse (cdr (butlast cl--loop-steps)))))
1021 `(,(car (butlast cl--loop-steps)))))))
1022 (body (append 1005 (body (append
1023 (nreverse cl--loop-initially) 1006 (nreverse cl--loop-initially)
1024 (list (if cl--loop-iterator-function 1007 (list (if cl--loop-iterator-function
@@ -1528,11 +1511,10 @@ For more details, see Info node `(cl)Loop Facility'.
1528 ,(cl--loop-let (nreverse loop-for-sets) 'setq ands) 1511 ,(cl--loop-let (nreverse loop-for-sets) 'setq ands)
1529 t) 1512 t)
1530 cl--loop-body)) 1513 cl--loop-body))
1531 (when loop-for-steps 1514 (if loop-for-steps
1532 (setq cl--loop-guard-cond t) 1515 (push (cons (if ands 'cl-psetq 'setq)
1533 (push (cons (if ands 'cl-psetq 'setq) 1516 (apply 'append (nreverse loop-for-steps)))
1534 (apply 'append (nreverse loop-for-steps))) 1517 cl--loop-steps))))
1535 cl--loop-steps))))
1536 1518
1537 ((eq word 'repeat) 1519 ((eq word 'repeat)
1538 (let ((temp (make-symbol "--cl-var--"))) 1520 (let ((temp (make-symbol "--cl-var--")))