Skip to content

haskell-load-opens-repl: new custom #795

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions haskell-customize.el
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ when showing type information about symbols."
:link '(custom-manual "(haskell-mode)haskell-interactive-mode")
:group 'haskell)

;;;###autoload
(defcustom haskell-load-opens-repl t
"Whether `haskell-process-load-file' should open the REPL."
:group 'haskell-interactive
:type 'boolean)

;;;###autoload
(defcustom haskell-process-path-ghci
"ghci"
Expand Down
9 changes: 5 additions & 4 deletions haskell-interactive-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -499,10 +499,10 @@ FILE-NAME only."
t)))))

;;;###autoload
(defun haskell-interactive-mode-reset-error (session)
(defun haskell-interactive-mode-reset-error (session &optional no-window-popup)
"Reset the error cursor position."
(interactive)
(with-current-buffer (haskell-session-interactive-buffer session)
(with-current-buffer (haskell-session-interactive-buffer session no-window-popup)
(haskell-interactive-mode-goto-end-point)
(let ((mrk (point-marker)))
(haskell-session-set session 'next-error-locus nil)
Expand All @@ -512,7 +512,7 @@ FILE-NAME only."
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Misc

(defun haskell-session-interactive-buffer (s)
(defun haskell-session-interactive-buffer (s &optional no-window-popup)
"Get the session interactive buffer."
(let ((buffer (haskell-session-get s 'interactive-buffer)))
(if (and buffer (buffer-live-p buffer))
Expand All @@ -522,7 +522,8 @@ FILE-NAME only."
(with-current-buffer buffer
(haskell-interactive-mode)
(haskell-session-assign s))
(switch-to-buffer-other-window buffer)
(unless no-window-popup
(switch-to-buffer-other-window buffer))
buffer))))

(defun haskell-process-cabal-live (state buffer)
Expand Down
8 changes: 5 additions & 3 deletions haskell.el
Original file line number Diff line number Diff line change
Expand Up @@ -377,11 +377,12 @@ If `haskell-process-load-or-reload-prompt' is nil, accept `default'."
(pop-to-buffer buffer)))

;;;###autoload
(defun haskell-process-load-file ()
(defun haskell-process-load-file (&optional no-window-popup)
"Load the current buffer file."
(interactive)
(save-buffer)
(haskell-interactive-mode-reset-error (haskell-session))
(haskell-interactive-mode-reset-error (haskell-session) (or no-window-popup
(not haskell-load-opens-repl)))
(haskell-process-file-loadish (format "load \"%s\"" (replace-regexp-in-string
"\""
"\\\\\""
Expand All @@ -407,7 +408,8 @@ If `haskell-process-load-or-reload-prompt' is nil, accept `default'."
(if haskell-reload-p
"Now running :reload."
"Now running :load <buffer-filename>.")))
(if haskell-reload-p (haskell-process-reload-file) (haskell-process-load-file))))
(if haskell-reload-p (haskell-process-reload-file) (haskell-process-load-file
(not haskell-load-opens-repl)))))

;;;###autoload
(defun haskell-process-cabal-build ()
Expand Down