Commits

Peter Szilagyi committed bfda523

default omake server omake command: jomake if in /janelibs/ocaml-4.00.1+jane1+with-fp/bin:/home/pszilagyi/.dispatch/bin:/home/pszilagyi/bin:/usr/java/default/bin:/home/pszilagyi/bin:/mnt/global/base/bin64:/mnt/global/base/bin:/mnt/office/base/bin64:/mnt/office/base/bin:/mnt/office/test/bin:/mnt/global/dev/bin64:/mnt/global/dev/bin:/mnt/office/dev/bin:/usr/java/default/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/lib64/alliance/bin:/usr/libexec/sdcc:/opt/dell/srvadmin/bin:/mnt/global/dev/etc/alternatives/ocaml/bin:/mnt/global/dev/etc/alternatives/ocaml/bin (else omake)

  • Participants
  • Parent commits 13304ab

Comments (0)

Files changed (3)

   (Omake.next-error) performance
 - tweaked the omake-server protocol to avoid missing errors under load
 - set colors for more of the todo keywords we use in org-mode
+- default omake server omake command: jomake if in $PATH (else omake)
 
 bug fixes
 =========

ocaml/omake/lib/server_config.ml

 
 type t = Config.t
 
-let default_omake_command = "omake -j 12"
+(* CR pszilagyi: This probably goes along with exec et al. *)
+let is_exec prog =
+  if String.contains prog '/' then
+    Unix.access prog [`Exec] |! Result.is_ok
+  else
+    List.exists (String.split ~on:':' (Aunix.getenv "PATH" |! Option.value ~default:""))
+      ~f:(fun d -> Unix.access (d ^ "/" ^ prog) [`Exec] |! Result.is_ok)
+
+(* This is a function rather than a fixed string so jomake can be installed in the path
+   after omake-server starts, e.g., using opam or dispatch. *)
+let default_omake_command () =
+  if is_exec "jomake" then "jomake -j 12" else "omake -j 12"
+
 let default_kill_when_unwatched = false
 let default_warn_when_setting_env_vars = true
 
 let omake_command (t:t) =
-  let key, default = "omake_command", default_omake_command in
+  let key, default = "omake_command", default_omake_command () in
   Config.lookup t ~key ~default
 
 let kill_when_unwatched t =
 to preempt even trying to run omake when the command syntax is
 invalid.
 
-** Discovery of jomake/omake in server config file
-*** seanmcl:
-Now it defaults to jomake, and home users must edit the config by
-hand. This is annoying. Search in the path for jomake, and otherwise
-omake.
-
 ** Jane.auto-modes not working
 At least Haskell, SML and dot-mode are not working with the same
 error: "(void-function <mode-name>)" For haskell the fix is to say
 keymap, they can show through in the various modes.
 * Hold
 * Closed
+** Discovery of jomake/omake in server config file
+*** seanmcl:
+Now it defaults to jomake, and home users must edit the config by
+hand. This is annoying. Search in the path for jomake, and otherwise
+omake.
+
 ** Make M-q inside a comment leave following code alone
 *** dhouse:
 I have a feeling this has an easy answer but I can't think of it.