Commits

seanmcl committed 0188ba1

window selection bug fixes

Comments (0)

Files changed (1)

   (assert (Omake.id-p id))
   (assert (or (null code-buffer-opt) (bufferp code-buffer-opt)))
   (Omake.check-dedicated)
-  (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))
     choice))
   (setq Omake.Frame.Code (selected-frame)))
 
 (defun Omake.show-error-buffer ()
+  "Set the error buffer in the error window.  Return the code and error windows."
   (interactive)
   (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:
                      ring)))
         (setf (Omake.model-result model) (Omake.Result.Ring ring))
         (if (Omake.Ring.is-empty ring)
-            (progn
-              (Omake.show-error-buffer)
-              (message "There are no errors."))
+            (let* ((ws (Omake.show-error-buffer))
+                   (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))
                  (user-num
                   (cond
                  (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 ()
   (interactive)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.