@@ -111,29 +111,15 @@ See `haskell-process-do-cabal' for more details."
111
111
:type '(choice (const auto) (const ghci) (const cabal-repl) (const cabal-dev) (const cabal-ghci))
112
112
:group 'haskell-interactive )
113
113
114
- (defcustom haskell-process-wrapper
115
- nil
116
- " A wrapper to launch the Haskell process defined by `haskell-process-type`.
117
- Nix users may want to use the value (\" nix-shell\" \" --command\" ),
118
- Docker users may want to use something like \" run-my-docker\" ."
119
- :group 'haskell-interactive
120
- :type '(choice string (repeat string)))
114
+ (defcustom haskell-process-wrapper-function
115
+ #'identity
116
+ " A default wrapper function to deal with an eventual haskell-process-wrapper.
121
117
122
- (defun haskell-process-stringify-cmd (cmd &optional args )
123
- " Stringify the CMD with optional ARGS."
124
- (format " %s " (mapconcat 'identity (cons cmd args) " " )))
125
-
126
- (defun haskell-process-wrapper-command (cmd &optional cmd-args )
127
- " Compute the haskell command to execute to launch the haskell-process type.
128
- if haskell-process-wrapper is set, return a wrapper of the CMD as list.
129
- Otherwise, return CMD as list.
130
- Deal with optional CMD-ARGS for the CMD."
131
- (if haskell-process-wrapper
132
- (let ((wrapped-cmd (haskell-process-stringify-cmd cmd cmd-args)))
133
- (if (stringp haskell-process-wrapper)
134
- (list haskell-process-wrapper wrapped-cmd)
135
- (append haskell-process-wrapper (list wrapped-cmd))))
136
- (cons cmd cmd-args)))
118
+ If no wrapper is needed, then using 'identify function is sufficient.
119
+ Otherwise, define a function which takes a list of arguments.
120
+ For example: (lambda (argv)
121
+ (append '(\" nix-shell\" \" haskell-lab.nix\" \" --command\" )
122
+ (shell-quote-argument argv)))" )
137
123
138
124
(defcustom haskell-process-log
139
125
nil
@@ -1044,25 +1030,25 @@ HPTYPE is the result of calling `'haskell-process-type`' function."
1044
1030
(append (list (format " Starting inferior GHCi process %s ... " haskell-process-path-ghci)
1045
1031
session-name
1046
1032
nil )
1047
- (haskell-process-wrapper-command haskell-process-path-ghci haskell-process-args-ghci)))
1033
+ (apply haskell-process-wrapper-function ( list ( cons haskell-process-path-ghci haskell-process-args-ghci)) )))
1048
1034
('cabal-repl
1049
1035
(append (list (format " Starting inferior `cabal repl' process using %s ... " haskell-process-path-cabal)
1050
1036
session-name
1051
1037
nil )
1052
- (haskell-process-wrapper-command haskell-process-path-cabal (cons " repl" haskell-process-args-cabal-repl))
1038
+ (apply haskell-process-wrapper-function ( list ( cons haskell-process-path-cabal (cons " repl" haskell-process-args-cabal-repl)) ))
1053
1039
(let ((target (haskell-session-target session)))
1054
1040
(if target (list target) nil ))))
1055
1041
('cabal-ghci
1056
1042
(append (list (format " Starting inferior cabal-ghci process using %s ... " haskell-process-path-cabal-ghci)
1057
1043
session-name
1058
1044
nil )
1059
- (haskell-process-wrapper-command haskell-process-path-cabal-ghci)))
1045
+ (apply haskell-process-wrapper-function ( list ( list haskell-process-path-cabal-ghci)) )))
1060
1046
('cabal-dev
1061
1047
(let ((dir (concat (haskell-session-cabal-dir session) " /cabal-dev" )))
1062
1048
(append (list (format " Starting inferior cabal-dev process %s -s %s ... " haskell-process-path-cabal-dev dir)
1063
1049
session-name
1064
1050
nil )
1065
- (haskell-process-wrapper-command haskell-process-path-cabal-dev (list " ghci" " -s" dir))))))))
1051
+ (apply haskell-process-wrapper-function ( list ( cons haskell-process-path-cabal-dev (list " ghci" " -s" dir)) ))))))))
1066
1052
1067
1053
;;;### autoload
1068
1054
(defun haskell-process-start (session )
0 commit comments