Skip to content

Use haskell-process-compute-process-log-and-command in haskell-process-start #456

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 5 additions & 49 deletions haskell-commands.el
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion haskell-customize.el
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 18 additions & 8 deletions haskell-process.el
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down