seanmcl committed cef25bf Merge

Comments (0)

Files changed (1)

   (assert ( id))
   (assert (or (null code-buffer-opt) (bufferp code-buffer-opt)))
-  (let* (;; If there's no code buffer, grab an arbitrary buffer and use
-         ;; that as we go through the code.  Just don't set the code buffer
-         ;; in this case.
-         (model (Omake.Model.get id))
+  (let* ((model (Omake.Model.get id))
          (error-buffer (Omake.model-error-buffer model))
          (_ (assert (nequal code-buffer-opt error-buffer)))
          (code (Omake.choose-frame-and-maybe-window
                      (sw (frame-selected-window frame))
                      (windows (window-list frame))
                      (unselected-ws (remove-if-not (lambda (w) (nequal w sw)) windows)))
-                (if (null unselected-ws) (Omake.Frame.split)
+                (if (null unselected-ws)
+                    (with-selected-frame frame (Omake.Frame.split))
                   (let* ((lru (when unselected-ws (car unselected-ws)))
                          ;; Can't get lru from an arbitrary list of windows without digging into C
                          (other-than (lambda (w) (if (equal w sw) lru sw))))
          (code (car choice))
          (err (cdr choice)))
     (assert (nequal code err))
+    (assert code)
+    (assert err)
     (assert (Omake.obeys-dedicated 'code code))
     (assert (Omake.obeys-dedicated 'error err))
   (setq Omake.Frame.Code (selected-frame)))
 (defun ()
+  "Set the error buffer in the error window.  Return the code and error windows."
   (let* ((id (Omake.Id.current))
          (model (Omake.Model.get id))
          (eb (Omake.model-error-buffer model))
          (ws (Omake.choose-windows id nil))
          (ew (cdr ws)))
-    (set-window-buffer ew eb)))
+    (set-window-buffer ew eb)
+    ws))
 (defun Omake.compile (&optional read-command)
   "Compile the current directory."
   (interactive "P")
   (let* ((model (Omake.Model.current))
          (result (Omake.model-result model))
+         (status (Omake.model-status model))
+         (comp-dir (Omake.model-compilation-dir model))
          (current-file (buffer-file-name)))
     (if (Omake.Result.failure-p result)
-        (message "Omake failed.  There is no next error.")
+        (message "There is problem with omake.")
       ;; Otherwise find the error.  The tricky thing is figuring out
       ;; which error is next.  Recall C-u resets the error index to 0.
       ;; Cases:
         (setf (Omake.model-result model) (Omake.Result.Ring ring))
         (if ( ring)
-            (progn
-              (
-              (message "There are no errors."))
+            (let* ((ws (
+                   (cw (car ws))
+                   (ew (cdr ws)))
+              (when (equal (window-buffer cw) (window-buffer ew))
+                (let ((db (dired-noselect comp-dir)))
+                  (set-window-buffer cw db)))
+              (if (Omake.Status.polling-p status)
+                  (message "There are no errors.")
+                (message "There are no errors, but omake is still running")))
           (let* ((current (Omake.ring-current ring))
                  (n (mod user-num num-errors))
                  (_ (assert (< n num-errors)))
                  (e (Omake.Ring.nth ring n)))
-            (Omake.Error.eval e)))))))
+            (Omake.Error.eval e)
+            (message "There are errors")))))))
 (defun Omake.toggle-expanded-error ()