seanmcl avatar seanmcl committed 8e6fe37

interface improvements #140

Comments (0)

Files changed (2)

elisp/omake/omake-interface.el

 (defun Omake.next-error (&optional user-num id)
   (interactive "P")
   (Omake.handle-errors
+    (catch 'exit
     ;; We'll definitely show the error window, so uniconify the error frame if it exists
     (Omake.Frame.uniconify 'status)
     (assert (or (null id) (Omake.Id.is id)))
     (let* ((id (if id id (Omake.Id.current)))
            (ids (Omake.Id.to-string id))
-           (_ (unless (Omake.Model.has id)
-                (let ((cont
-                       (Emacs.y-or-n-p
-                        (format "You are not watching %s.  Compile/watch it and go to the first error? " ids))))
-                  (if (not cont) (signal 'Omake.Errors.abort nil)
-                    (Omake.start-project)))))
+           (_ (unless (Omake.Project.find id)
+                (message "Project %s is not currently compiling." ids)
+                (throw 'exit nil)))
+           (_ (unless (Omake.Model.has id) (Omake.watch id)))
            (model (Omake.Model.get id))
            (project (Omake.Model.project model))
            (result (Omake.Model.result model))
               ;; Make sure the code frame is visible
               (Omake.Frame.uniconify 'code)
               (message "There are errors")
-              (Omake.Error.eval e))))))))
+              (Omake.Error.eval e)))))))))
 
 ;;----------------------------------------------------------------------------;;
 ;; Starting and watching projects                                             ;;
              (project (Omake.Project.find id)))
         (catch 'exit
           ;; If the project exists but is not being watched, watch it.
-          (if (and project (not (Omake.Project.is-watching id)))
-              (progn
-                (Omake.Project.watch id)
-                (Omake.show-status-buffer id))
-            ;; If it exists and is being watched, ask to kill and restart
-            (when project
-              (let* ((num-watchers (Omake.Project.num-watchers project))
-                     (watch-msg
-                      (if (< 1 num-watchers)
-                          "\nThis will affect other processes watching this project."
-                        ""))
-                     (kill
-                      (Emacs.y-or-n-p
-                       (format "\
+          (when (and project (not (Omake.Project.is-watching id)))
+            (Omake.Project.watch id))
+          ;; If it exists, ask to kill and restart
+          (when project
+            (let* ((num-watchers (Omake.Project.num-watchers project))
+                   (watch-msg
+                    (if (< 1 num-watchers)
+                        "\nThis will affect other processes watching this project."
+                      ""))
+                   (kill
+                    (Emacs.y-or-n-p
+                     (format "\
 OMake is already building:
   %s
 Proceeding will kill OMake and restart it on:
   %s%s
 Proceed? "
-                               (Omake.Project.compilation-dir project) path watch-msg))))
-                (if (not kill) (throw 'exit t)
-                  (Omake.kill-project id :force t))))
-            ;; Now there is no running project, so we start it.
-            (let* ((config (Omake.Ocaml.Config.omake-command))
-                   (user-command
-                    (if read-command
-                        (read-from-minibuffer "Command: " (concat config " "))
-                      config)))
-              (message "Starting compilation.")
-              (Omake.Server.create-project
-               :id id
-               :omakeroot-dir root-dir
-               :compilation-dir path
-               :user-command user-command)
-              ;; omake must start and the new project must make it back
-              ;; to this Emacs instance before we can call watch.
-              (Emacs.protect-from-quit (sleep-for 2))
-              (Omake.Project.watch id)
-              (Omake.Frame.maybe-create-status)
-              (Omake.show-status-buffer id)
-              (Omake.Frame.raise-status)))
-          (assert (Omake.Project.find id))
-          (assert (Omake.Project.is-watching id)))))))
+                             (Omake.Project.compilation-dir project) path watch-msg))))
+              (if (not kill) (throw 'exit t)
+                (Omake.kill-project id :force t))))
+          ;; Now there is no running project, so we start it.
+          (let* ((config (Omake.Ocaml.Config.omake-command))
+                 (user-command
+                  (if read-command
+                      (read-from-minibuffer "Command: " (concat config " "))
+                    config)))
+            (message "Starting compilation.")
+            (Omake.Server.create-project
+             :id id
+             :omakeroot-dir root-dir
+             :compilation-dir path
+             :user-command user-command)
+            ;; omake must start and the new project must make it back
+            ;; to this Emacs instance before we can call watch.
+            (Emacs.protect-from-quit (sleep-for 2))
+            (Omake.Project.watch id)
+            (Omake.Frame.maybe-create-status)
+            (Omake.show-status-buffer id)
+            (Omake.Frame.raise-status)))
+        (assert (Omake.Project.find id))
+        (assert (Omake.Project.is-watching id))))))
 
 (defun Omake.watch (&optional id)
   (interactive)

elisp/omake/omake-project.el

 (defun Omake.Project.find (id)
   (assert (Omake.Id.is id))
   (List.find (lambda (p) (equal (Omake.Project.id p) id)) Omake.Project.list))
-;; (Omake.Project.find (Omake.Id.of-path "/home/seanmcl/ocaml"))
+;; (Omake.Project.find (Omake.Id.of-path "/home/seanmcl/ocaml/ocaml1"))
 
 (defun Omake.Project.watch (id)
   (assert (Omake.Id.is id))
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.