Skip to content

Commit 35633bf

Browse files
cocreaturechrisdone
authored andcommitted
Use process-log-and-compute in process-start
1 parent 17639e6 commit 35633bf

File tree

3 files changed

+24
-58
lines changed

3 files changed

+24
-58
lines changed

haskell-commands.el

Lines changed: 5 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -47,58 +47,14 @@
4747
(haskell-process-set-session process session)
4848
(haskell-process-set-cmd process nil)
4949
(haskell-process-set (haskell-session-process session) 'is-restarting nil)
50-
(let ((default-directory (haskell-session-cabal-dir session)))
50+
(let ((default-directory (haskell-session-cabal-dir session))
51+
(log-and-command (haskell-process-compute-process-log-and-command session (haskell-process-type))))
5152
(haskell-session-pwd session)
5253
(haskell-process-set-process
5354
process
54-
(cl-ecase (haskell-process-type)
55-
('ghci
56-
(haskell-process-log
57-
(propertize (format "Starting inferior GHCi process %s ..."
58-
haskell-process-path-ghci)
59-
'face font-lock-comment-face))
60-
(apply #'start-process
61-
(append (list (haskell-session-name session)
62-
nil
63-
haskell-process-path-ghci)
64-
haskell-process-args-ghci)))
65-
('cabal-repl
66-
(haskell-process-log
67-
(propertize
68-
(format "Starting inferior `cabal repl' process using %s ..."
69-
haskell-process-path-cabal)
70-
'face font-lock-comment-face))
71-
72-
(apply #'start-process
73-
(append (list (haskell-session-name session)
74-
nil
75-
haskell-process-path-cabal)
76-
'("repl") haskell-process-args-cabal-repl
77-
(let ((target (haskell-session-target session)))
78-
(if target (list target) nil)))))
79-
('cabal-ghci
80-
(haskell-process-log
81-
(propertize
82-
(format "Starting inferior cabal-ghci process using %s ..."
83-
haskell-process-path-cabal-ghci)
84-
'face font-lock-comment-face))
85-
(start-process (haskell-session-name session)
86-
nil
87-
haskell-process-path-cabal-ghci))
88-
('cabal-dev
89-
(let ((dir (concat (haskell-session-cabal-dir session)
90-
"/cabal-dev")))
91-
(haskell-process-log
92-
(propertize (format "Starting inferior cabal-dev process %s -s %s ..."
93-
haskell-process-path-cabal-dev
94-
dir)
95-
'face font-lock-comment-face))
96-
(start-process (haskell-session-name session)
97-
nil
98-
haskell-process-path-cabal-dev
99-
"ghci"
100-
"-s"
101-
dir))))))
55+
(progn
56+
(haskell-process-log (propertize (car log-and-command)))
57+
(apply #'start-process (cdr log-and-command)))))
10258
(progn (set-process-sentinel (haskell-process-process process) 'haskell-process-sentinel)
10359
(set-process-filter (haskell-process-process process) 'haskell-process-filter))
10460
(haskell-process-send-startup process)

haskell-customize.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ and returns a possibly-modified list.
5757
The following example function arranges for all haskell process
5858
commands to be started in the current nix-shell environment:
5959
60-
(lambda (argv) (append (list \"nix-shell\" \"default.nix\" \"--command\" )
60+
(lambda (argv) (append (list \"nix-shell\" \"-I\" \".\" \"--command\" )
6161
(list (mapconcat 'identity argv \" \"))))
6262
6363
See Info Node `(emacs)Directory Variables' for a way to set this option on

haskell-process.el

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,28 +79,38 @@ HPTYPE is the result of calling `'haskell-process-type`' function."
7979
(let ((session-name (haskell-session-name session)))
8080
(cl-ecase hptype
8181
('ghci
82-
(append (list (format "Starting inferior GHCi process %s ..." haskell-process-path-ghci)
82+
(append (list (format "Starting inferior GHCi process %s ..."
83+
haskell-process-path-ghci)
8384
session-name
8485
nil)
85-
(apply haskell-process-wrapper-function (list (cons haskell-process-path-ghci haskell-process-args-ghci)))))
86+
(apply haskell-process-wrapper-function
87+
(list
88+
(cons haskell-process-path-ghci haskell-process-args-ghci)))))
8689
('cabal-repl
87-
(append (list (format "Starting inferior `cabal repl' process using %s ..." haskell-process-path-cabal)
90+
(append (list (format "Starting inferior `cabal repl' process using %s ..."
91+
haskell-process-path-cabal)
8892
session-name
8993
nil)
90-
(apply haskell-process-wrapper-function (list (cons haskell-process-path-cabal (cons "repl" haskell-process-args-cabal-repl))))
94+
(apply haskell-process-wrapper-function
95+
(list
96+
(cons haskell-process-path-cabal (cons "repl" haskell-process-args-cabal-repl))))
9197
(let ((target (haskell-session-target session)))
9298
(if target (list target) nil))))
9399
('cabal-ghci
94-
(append (list (format "Starting inferior cabal-ghci process using %s ..." haskell-process-path-cabal-ghci)
100+
(append (list (format "Starting inferior cabal-ghci process using %s ..."
101+
haskell-process-path-cabal-ghci)
95102
session-name
96103
nil)
97-
(apply haskell-process-wrapper-function (list (list haskell-process-path-cabal-ghci)))))
104+
(apply haskell-process-wrapper-function
105+
(list (list haskell-process-path-cabal-ghci)))))
98106
('cabal-dev
99107
(let ((dir (concat (haskell-session-cabal-dir session) "/cabal-dev")))
100-
(append (list (format "Starting inferior cabal-dev process %s -s %s ..." haskell-process-path-cabal-dev dir)
108+
(append (list (format "Starting inferior cabal-dev process %s -s %s ..."
109+
haskell-process-path-cabal-dev dir)
101110
session-name
102111
nil)
103-
(apply haskell-process-wrapper-function (list (cons haskell-process-path-cabal-dev (list "ghci" "-s" dir))))))))))
112+
(apply haskell-process-wrapper-function
113+
(list (cons haskell-process-path-cabal-dev (list "ghci" "-s" dir))))))))))
104114

105115
(defun haskell-process-make (name)
106116
"Make an inferior Haskell process."

0 commit comments

Comments
 (0)