   (merlin-error-reset)
   (merlin-sync-to-point (point-max) t)
   (let* ((errors (merlin-send-command 'errors))
-         (no-loc (remove-if (lambda (e) (assoc 'start e)) errors))
-         (errors (remove-if (lambda (e) (not (assoc 'start e))) errors))
-         (errors (if merlin-report-warnings errors
-                   (remove-if (lambda (e) (merlin-error-warning-p (cdr (assoc 'message e))))
-                              errors))))
-    (if (not (or errors no-loc))
-        (when view-errors-p (message "No errors"))
-      (progn
-        (setq merlin-erroneous-buffer t)
-        (when no-loc
-          (mapcar (lambda (e) (message "%s" (cdr (assoc 'message e)))) no-loc))
-        (when errors
-          (merlin-transform-display-errors errors)
-          (when view-errors-p
-            (message "(%d pending errors, use %s to jump)"
-                     (length errors)
-                     (substitute-command-keys "\\[merlin-error-next]"))))))))
+         (no-loc (remove-if (lambda (e) (assoc 'start e)) errors)))
+    (setq errors (remove-if-not (lambda (e) (assoc 'start e)) errors))
+    (unless merlin-report-warnings
+      (setq errors (remove-if (lambda (e)
+                                (merlin-error-warning-p (cdr (assoc 'message e))))
+                              errors)))
+    (setq merlin-erroneous-buffer (or errors no-loc))
+    (dolist (e no-loc)
+      (message "%s" (cdr (assoc 'message e))))
+    (merlin-transform-display-errors errors)
+    (when view-errors-p
+      (if merlin-erroneous-buffer
+          (message "No errors")
+        (message "(%d pending errors, use %s to jump)"
+                 (length errors)
+                 (substitute-command-keys "\\[merlin-error-next]"))))))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; COMPLETION-AT-POINT SUPPORT ;;

  "Compute the prefix of IDENT.  The prefix of `Foo.bar' is `Foo.' and the prefix of `bar' is `'."
  (car (merlin--completion-split-ident ident)))

(defvar-local dwimed nil
  "Remember if we used dwim for the current completion or not")

(defun merlin--completion-full-entry-name (compl-prefix entry)
  (let ((entry-name (cdr (assoc 'name entry))))
    (if dwimed entry-name (concat compl-prefix entry-name))))

(defun merlin--completion-prepare-labels (labels suffix)
  ; Remove non-matching entry, adjusting optional labels if needed

    (lambda (errors)
      (merlin-error-reset)
      (let ((no-loc (remove-if (lambda (e) (assoc 'start e)) errors)))
        (setq errors (remove-if-not (lambda (e) (assoc 'start e)) errors))
        (unless merlin-report-warnings
          (setq errors (remove-if (lambda (e)
                                    (merlin-error-warning-p (cdr (assoc 'message e))))
                                  errors)))
        (setq merlin-erroneous-buffer (or errors no-loc))
        (dolist (e no-loc)
          (message "%s" (cdr (assoc 'message e))))
        (merlin-transform-display-errors errors)))))

(defun merlin--error-check (view-errors-p)
  "Check for errors.
