Replace while loops with dolist

This commit is contained in:
Rudi Grinberg 2018-02-27 01:38:12 +07:00
parent 49de3344f7
commit 27ae188261
1 changed files with 7 additions and 12 deletions

View File

@ -351,11 +351,9 @@ it is started."
(setq utop-input-prompt-max utop-prompt-max) (setq utop-input-prompt-max utop-prompt-max)
;; Send all lines to utop ;; Send all lines to utop
(utop-send-string cmd) (utop-send-string cmd)
(while lines (dolist (line lines)
;; Send the line ;; Send the line
(utop-send-string (concat "data:" (car lines) "\n")) (utop-send-string (concat "data:" line "\n")))
;; Remove it and continue
(setq lines (cdr lines)))
(utop-send-string "end:\n"))) (utop-send-string "end:\n")))
(defun utop-last-type () (defun utop-last-type ()
@ -735,11 +733,9 @@ If ADD-TO-HISTORY is t then the input will be added to history."
(if (utop--supports-company) (if (utop--supports-company)
"complete-company:\n" "complete-company:\n"
"complete:\n")) "complete:\n"))
(while lines (dolist (line lines)
;; Send the line ;; Send the line
(utop-send-string (concat "data:" (car lines) "\n")) (utop-send-string (concat "data:" line "\n")))
;; Remove it and continue
(setq lines (cdr lines)))
(utop-send-string "end:\n"))) (utop-send-string "end:\n")))
(defun utop-complete () (defun utop-complete ()
@ -962,13 +958,12 @@ defaults to 0."
;; Set the header column size to the maximal length ;; Set the header column size to the maximal length
(setcdr (elt tabulated-list-format 0) (list max-name-length t)) (setcdr (elt tabulated-list-format 0) (list max-name-length t))
;; Build a list, accumulating in tabulated-list-entries ;; Build a list, accumulating in tabulated-list-entries
(while packages (dolist (package packages)
(let* ((package (car packages)) (let* ((package package)
(name (car package)) (name (car package))
(version (cdr package))) (version (cdr package)))
(push (list package (vector name version)) (push (list package (vector name version))
tabulated-list-entries)) tabulated-list-entries))))
(setq packages (cdr packages))))
(setq tabulated-list-entries (nreverse tabulated-list-entries))) (setq tabulated-list-entries (nreverse tabulated-list-entries)))
(defun utop-package-printer (_id cols) (defun utop-package-printer (_id cols)