Skip to content

Commit c72ceab

Browse files
committed
no need for %s folder interpolation
1 parent 96d689e commit c72ceab

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

haskell-compile.el

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,30 +38,30 @@
3838
:group 'haskell)
3939

4040
(defcustom haskell-compile-cabal-build-command
41-
"cd %s && cabal build --ghc-option=-ferror-spans"
41+
"cabal build --ghc-option=-ferror-spans"
4242
"Default build command to use for `haskell-cabal-build' when a cabal file is detected.
43-
The `%s' placeholder is replaced by the cabal package top folder."
43+
For legacy compat, `%s' is replaced by the cabal package top folder."
4444
:group 'haskell-compile
4545
:type 'string)
4646

4747
(defcustom haskell-compile-cabal-build-alt-command
48-
"cd %s && cabal clean -s && cabal build --ghc-option=-ferror-spans"
48+
"cabal clean -s && cabal build --ghc-option=-ferror-spans"
4949
"Alternative build command to use when `haskell-cabal-build' is called with a negative prefix argument.
50-
The `%s' placeholder is replaced by the cabal package top folder."
50+
For legacy compat, `%s' is replaced by the cabal package top folder."
5151
:group 'haskell-compile
5252
:type 'string)
5353

5454
(defcustom haskell-compile-stack-build-command
55-
"cd %s && stack build --fast"
55+
"stack build --fast"
5656
"Default build command to use for `haskell-stack-build' when a stack file is detected.
57-
The `%s' placeholder is replaced by the stack package top folder."
57+
For legacy compat, `%s' is replaced by the stack package top folder."
5858
:group 'haskell-compile
5959
:type 'string)
6060

6161
(defcustom haskell-compile-stack-build-alt-command
62-
"cd %s && stack clean && stack build --fast"
62+
"stack clean && stack build --fast"
6363
"Alternative build command to use when `haskell-stack-build' is called with a negative prefix argument.
64-
The `%s' placeholder is replaced by the stack package top folder."
64+
For legacy compat, `%s' is replaced by the stack package top folder."
6565
:group 'haskell-compile
6666
:type 'string)
6767

@@ -197,15 +197,19 @@ base directory for build tools, or the current buffer for
197197
('- alt)
198198
(_ (compilation-read-command default))))
199199
(command (format template dir-or-file))
200+
(dir (if (directory-name-p dir-or-file)
201+
dir-or-file
202+
default-directory))
200203
(name (if (directory-name-p dir-or-file)
201204
(file-name-base (directory-file-name dir-or-file))
202205
(file-name-nondirectory dir-or-file))))
203206
(unless (eq edit'-)
204207
(set last-sym template))
205-
(compilation-start
206-
command
207-
'haskell-compilation-mode
208-
(lambda (mode) (format "*%s* <%s>" mode name)))))
208+
(let ((default-directory dir))
209+
(compilation-start
210+
command
211+
'haskell-compilation-mode
212+
(lambda (mode) (format "*%s* <%s>" mode name))))))
209213

210214
(provide 'haskell-compile)
211215
;;; haskell-compile.el ends here

0 commit comments

Comments
 (0)