branch: elpa/haskell-ts-mode
commit 11de5820ce74b3e14821c01477b5caad0c7070b9
Author: Pranshu Sharma <pran...@bauherren.ovh>
Commit: Pranshu Sharma <pran...@bauherren.ovh>

    Finally fixed haskell ghci thing
    
    Now it won't load the file by default, but you will actually be able
    to specify the commands you want in dir locals or smth, so 'cabal ghci'
    can work
---
 haskell-ts-mode.el | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/haskell-ts-mode.el b/haskell-ts-mode.el
index 5a08ccac09..16788ca482 100644
--- a/haskell-ts-mode.el
+++ b/haskell-ts-mode.el
@@ -49,7 +49,11 @@
   "The command to be called to run ghci."
   :type 'string)
 
-(defcustom haskell-ts-ghci-buffer-name "Inferior Haskell"
+(defcustom haskell-ts-ghci-switches nil
+  "Arguments passwed to `haskell-ts-ghci'."
+  :type 'string)
+
+(defcustom haskell-ts-ghci-buffer-name "*Inferior Haskell*"
   "Buffer name for the ghci prcoess."
   :type 'string)
 
@@ -630,14 +634,22 @@ If region is active, format the code using the comand 
specified in
 (defun run-haskell ()
   "Run an inferior Haskell process."
   (interactive)
-  (let ((buffer (concat "*" haskell-ts-ghci-buffer-name "*")))
+  (let ((buffer (get-buffer-create haskell-ts-ghci-buffer-name))
+        (ghci haskell-ts-ghci)
+        (switches haskell-ts-ghci-switches))
     (pop-to-buffer-same-window
      (if (comint-check-proc buffer)
          buffer
-       (make-comint haskell-ts-ghci-buffer-name haskell-ts-ghci nil 
buffer-file-name)))))
+       (with-current-buffer buffer
+         (apply 'make-comint-in-buffer
+                "Haskell"
+                buffer
+                ghci
+                nil
+                switches))))))
 
 (defun haskell-ts-haskell-session ()
-  (get-buffer-process (concat "*" haskell-ts-ghci-buffer-name "*")))
+  (get-buffer-process haskell-ts-ghci-buffer-name))
 
 (when (treesit-ready-p 'haskell)
   (add-to-list 'auto-mode-alist '("\\.hs\\'" . haskell-ts-mode)))

Reply via email to