Skip to content

Commit 96f6dd3

Browse files
authored
Merge pull request #1733 from jacobilsoe/fix-ghc-compilation
Always use buffer-file-name for ghc compilation
2 parents 0d39c84 + 7ab5ae6 commit 96f6dd3

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

haskell-compile.el

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
;; Copyright (C) 2013 Herbert Valerio Riedel
44
;; 2020 Marc Berkowitz <mberkowitz@github.com>
5+
;; 2020 Jacob Ilsø
56

67
;; Author: Herbert Valerio Riedel <hvr@gnu.org>
78

@@ -170,7 +171,7 @@ base directory for build tools, or the current buffer for
170171
(interactive "P")
171172
(save-some-buffers (not compilation-ask-about-save)
172173
compilation-save-buffers-predicate)
173-
(let (htype dir)
174+
(let (htype dir)
174175
;;test haskell-compiler-type to set htype and dir
175176
(cond
176177
((eq haskell-compiler-type 'cabal)
@@ -180,8 +181,7 @@ base directory for build tools, or the current buffer for
180181
(setq htype 'stack)
181182
(setq dir (locate-dominating-file default-directory "stack.yaml")))
182183
((eq haskell-compiler-type 'ghc)
183-
(setq htype 'ghc)
184-
(setq dir (buffer-file-name)))
184+
(setq htype 'ghc))
185185
((eq haskell-compiler-type 'auto)
186186
(let ((r (haskell-build-type)))
187187
(setq htype (car r))
@@ -204,7 +204,7 @@ base directory for build tools, or the current buffer for
204204
haskell-compile-stack-build-command
205205
haskell-compile-stack-build-alt-command))
206206
((eq htype 'ghc)
207-
(haskell--compile dir edit-command
207+
(haskell--compile (buffer-file-name) edit-command
208208
'haskell--compile-ghc-last
209209
haskell-compile-command
210210
haskell-compile-command)))))

haskell-customize.el

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -409,9 +409,9 @@ imports."
409409
presence of a *.cabal file or stack.yaml file or something similar.")
410410

411411
(defun haskell-build-type ()
412-
"Looks for cabal and stack spec files.
413-
When found, returns a pair (TAG . DIR)
414-
where TAG is 'cabal-project, 'cabal-sandbox. 'cabal, or 'stack;
412+
"Looks for cabal and stack spec files.
413+
When found, returns a pair (TAG . DIR)
414+
where TAG is 'cabal-project, 'cabal-sandbox. 'cabal, or 'stack;
415415
and DIR is the directory containing cabal or stack file.
416416
When none found, DIR is nil, and TAG is 'ghc"
417417
;; REVIEW maybe just 'cabal is enough.

haskell-decl-scan.el

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
;; Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
44
;; Copyright (C) 1997-1998 Graeme E Moss
55
;; Copyright (C) 2016 Chris Gregory
6+
;; Copyright (C) 2020 Jacob Ilsø
67

78
;; Author: 1997-1998 Graeme E Moss <gem@cs.york.ac.uk>
89
;; Maintainer: Stefan Monnier <monnier@gnu.org>
@@ -542,9 +543,6 @@ datatypes) in a Haskell file for the `imenu' package."
542543
(index-imp-alist '()) ;; Imports
543544
(index-inst-alist '()) ;; Instances
544545
(index-type-alist '()) ;; Datatypes
545-
;; Variables for showing progress.
546-
(bufname (buffer-name))
547-
(divisor-of-progress (max 1 (/ (buffer-size) 100)))
548546
;; The result we wish to return.
549547
result)
550548
(goto-char (point-min))

0 commit comments

Comments
 (0)