dimitri/el-get — pull request #674 by DarwinAwardWinner (2012-03-18 20:04:40+00:00)
Title: Use setq instead of let in tests

This makes it easier to run tests interactively and inspect the
results afterward, because the variables such as "el-get-sources" that
were set for the tests are still bound to the values they had during
the test.

This was an automated conversion accomplished with the following code. You can verify that only the let forms were changed by using `git diff -w` to view only non-whitespace changes. For each file, you'll see that the varlist of the `let` form is now a `setq` form, and the body of the let form is unchanged except for deleting the trailing close-paren of the let form.

```lisp
(defun pp-setq-to-string (setq-form)
(assert (eq (car setq-form) 'setq))
(with-temp-buffer
(insert (pp-to-string setq-form))
(goto-char (point-min))
(down-list 1)
(forward-sexp 1)
(ignore-errors
(while t
(forward-sexp 3)
(backward-sexp 1)
(insert "\n")
(indent-for-tab-command t)))
(buffer-string)))

(defun transform-test-file (test-file)
(with-current-buffer (find-file-noselect test-file)
(goto-char (point-min))
;; Fix top-level let forms
(ignore-errors
(while t
(let ((expr (read (current-buffer))))
(when (eq (car expr) 'let)
;; Go back to start of let form
(backward-sexp)
;; Go into let form
(down-list 1)
;; check for and kill opening paren of let form
(assert (looking-back "("))
(delete-backward-char 1)
;; Kill let symbol and varlist
(kill-sexp 2)
;; Insert setq form
(let* ((varlist (cadr expr))
(setq-form
(cons 'setq (mapcan 'identity
varlist))))
(insert (pp-setq-to-string setq-form)))
;; Exit let form
(up-list 1)
;; Check for and kill closing paren of let form
(assert (looking-back ")"))
(delete-backward-char 1)))))
(when (buffer-modified-p)
(indent-region (point-min) (point-max))
(save-buffer))
(kill-buffer)))

(mapc 'transform-test-file (directory-files "~/Projects/public/el-get/test/" t ".*\\.el$"))
```