Fri Apr 23 11:34:26 EDT 2010
Haskell in Emacs: getting rid of :cd ~/.cabal on C-x C-l
In `inferior-haskell-load-file': annoying for debugging local modules:
the Hasell mode in Emacs apparently switches the current directory to
~/.cabal before loading the module.
How to avoid?
If I recall, it somehow tries to guess the proper directory, and if
it's not specified, it will set it to ".cabal".
See inf-haskell.el: It uses `default-directory' which is a variable
that automatically becomes buffer-local when set. The problem seems
to be here:
(inferior-haskell-find-project-root (get-buffer "Function.hs"))
Why is that?
(inferior-haskell-cabal-of-buf (get-buffer "Function.hs"))
=> #<buffer .cabal>
Hmm.. Killing that buffer then messes up some state. Killing+loading
the .hs buffer fixes that (some local variable is bound to the
buffer). Digging deeper, the intelligence seems to be in
Solution seems to be here:
;; Do not change directory to ~/.cabal on load
(setq inferior-haskell-find-project-root nil)