diff --git a/haskell-commands.el b/haskell-commands.el index d507ec625..6d467843a 100644 --- a/haskell-commands.el +++ b/haskell-commands.el @@ -47,58 +47,14 @@ (haskell-process-set-session process session) (haskell-process-set-cmd process nil) (haskell-process-set (haskell-session-process session) 'is-restarting nil) - (let ((default-directory (haskell-session-cabal-dir session))) + (let ((default-directory (haskell-session-cabal-dir session)) + (log-and-command (haskell-process-compute-process-log-and-command session (haskell-process-type)))) (haskell-session-pwd session) (haskell-process-set-process process - (cl-ecase (haskell-process-type) - ('ghci - (haskell-process-log - (propertize (format "Starting inferior GHCi process %s ..." - haskell-process-path-ghci) - 'face font-lock-comment-face)) - (apply #'start-process - (append (list (haskell-session-name session) - nil - haskell-process-path-ghci) - haskell-process-args-ghci))) - ('cabal-repl - (haskell-process-log - (propertize - (format "Starting inferior `cabal repl' process using %s ..." - haskell-process-path-cabal) - 'face font-lock-comment-face)) - - (apply #'start-process - (append (list (haskell-session-name session) - nil - haskell-process-path-cabal) - '("repl") haskell-process-args-cabal-repl - (let ((target (haskell-session-target session))) - (if target (list target) nil))))) - ('cabal-ghci - (haskell-process-log - (propertize - (format "Starting inferior cabal-ghci process using %s ..." - haskell-process-path-cabal-ghci) - 'face font-lock-comment-face)) - (start-process (haskell-session-name session) - nil - haskell-process-path-cabal-ghci)) - ('cabal-dev - (let ((dir (concat (haskell-session-cabal-dir session) - "/cabal-dev"))) - (haskell-process-log - (propertize (format "Starting inferior cabal-dev process %s -s %s ..." - haskell-process-path-cabal-dev - dir) - 'face font-lock-comment-face)) - (start-process (haskell-session-name session) - nil - haskell-process-path-cabal-dev - "ghci" - "-s" - dir)))))) + (progn + (haskell-process-log (propertize (car log-and-command))) + (apply #'start-process (cdr log-and-command))))) (progn (set-process-sentinel (haskell-process-process process) 'haskell-process-sentinel) (set-process-filter (haskell-process-process process) 'haskell-process-filter)) (haskell-process-send-startup process) diff --git a/haskell-customize.el b/haskell-customize.el index 31a381daa..ef334cfd5 100644 --- a/haskell-customize.el +++ b/haskell-customize.el @@ -57,7 +57,7 @@ and returns a possibly-modified list. The following example function arranges for all haskell process commands to be started in the current nix-shell environment: - (lambda (argv) (append (list \"nix-shell\" \"default.nix\" \"--command\" ) + (lambda (argv) (append (list \"nix-shell\" \"-I\" \".\" \"--command\" ) (list (mapconcat 'identity argv \" \")))) See Info Node `(emacs)Directory Variables' for a way to set this option on diff --git a/haskell-process.el b/haskell-process.el index 7bf57f8c0..ecf890082 100644 --- a/haskell-process.el +++ b/haskell-process.el @@ -79,28 +79,38 @@ HPTYPE is the result of calling `'haskell-process-type`' function." (let ((session-name (haskell-session-name session))) (cl-ecase hptype ('ghci - (append (list (format "Starting inferior GHCi process %s ..." haskell-process-path-ghci) + (append (list (format "Starting inferior GHCi process %s ..." + haskell-process-path-ghci) session-name nil) - (apply haskell-process-wrapper-function (list (cons haskell-process-path-ghci haskell-process-args-ghci))))) + (apply haskell-process-wrapper-function + (list + (cons haskell-process-path-ghci haskell-process-args-ghci))))) ('cabal-repl - (append (list (format "Starting inferior `cabal repl' process using %s ..." haskell-process-path-cabal) + (append (list (format "Starting inferior `cabal repl' process using %s ..." + haskell-process-path-cabal) session-name nil) - (apply haskell-process-wrapper-function (list (cons haskell-process-path-cabal (cons "repl" haskell-process-args-cabal-repl)))) + (apply haskell-process-wrapper-function + (list + (cons haskell-process-path-cabal (cons "repl" haskell-process-args-cabal-repl)))) (let ((target (haskell-session-target session))) (if target (list target) nil)))) ('cabal-ghci - (append (list (format "Starting inferior cabal-ghci process using %s ..." haskell-process-path-cabal-ghci) + (append (list (format "Starting inferior cabal-ghci process using %s ..." + haskell-process-path-cabal-ghci) session-name nil) - (apply haskell-process-wrapper-function (list (list haskell-process-path-cabal-ghci))))) + (apply haskell-process-wrapper-function + (list (list haskell-process-path-cabal-ghci))))) ('cabal-dev (let ((dir (concat (haskell-session-cabal-dir session) "/cabal-dev"))) - (append (list (format "Starting inferior cabal-dev process %s -s %s ..." haskell-process-path-cabal-dev dir) + (append (list (format "Starting inferior cabal-dev process %s -s %s ..." + haskell-process-path-cabal-dev dir) session-name nil) - (apply haskell-process-wrapper-function (list (cons haskell-process-path-cabal-dev (list "ghci" "-s" dir)))))))))) + (apply haskell-process-wrapper-function + (list (cons haskell-process-path-cabal-dev (list "ghci" "-s" dir)))))))))) (defun haskell-process-make (name) "Make an inferior Haskell process."