1. Yaron Minsky
  2. js-elisp


seanmcl  committed cef25bf Merge
  • Participants
  • Parent commits 157eade, 0188ba1
  • Branches default

Comments (0)

Files changed (1)

File omake.el

View file
  • Ignore whitespace
   (assert (Omake.id-p 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 Omake.show-error-buffer ()
+  "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 (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))
                  (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 ()