     (let* ((options
             (intero-make-options-list
              (or targets
-                 (list (buffer-local-value 'intero-package-name buffer)))))
+                 (list (buffer-local-value 'intero-package-name buffer)))
+             (not (buffer-local-value 'intero-try-with-build buffer))))
            (arguments options)
            (process (with-current-buffer buffer
                       (when debug-on-error

      (with-current-buffer buffer
        (erase-buffer)
        (setq intero-targets targets)
        (setq intero-arguments arguments)
        (setq intero-callbacks
              (list (list source-buffer
                          (lambda (source-buffer _msg)
                            (when source-buffer
                              (with-current-buffer source-buffer
                                (when flycheck-mode
                                  (run-with-timer 0 nil
                                                  'intero-call-in-buffer
                                                  (current-buffer)
                                                  'intero-flycheck-buffer))))
                            (message "Booted up intero!"))))))
      (set-process-filter process
                          (lambda (process string)

      (let ((buffer (process-buffer process)))
        (if (with-current-buffer buffer intero-deleting)
            (message "Intero process deleted.")
          (if (and (intero-unsatisfied-package-p buffer)
                   (not (buffer-local-value 'intero-try-with-build buffer)))
              (progn (with-current-buffer buffer (setq-local intero-try-with-build t))
                     (intero-start-process-in-buffer
                      buffer
                      (buffer-local-value 'intero-targets buffer)
                      (buffer-local-value 'intero-source-buffer buffer)))
            (progn (with-current-buffer buffer (setq-local intero-give-up t))
                   (intero-show-process-problem process change))))))))

(defun intero-unsatisfied-package-p (buffer)
  "Does the buffer contain GHCi's unsatisfied package complaint?"
  (with-current-buffer buffer
    (save-excursion
      (goto-char (point-min))
      (search-forward-regexp "cannot satisfy -package" nil t 1))))

(defun intero-installed-p ()
  "Is intero (of the right version) installed in the stack environment?"
