diff --git a/config.el b/config.el index caba09c4d..1623f4705 100644 --- a/config.el +++ b/config.el @@ -234,7 +234,10 @@ This function assumes that root of the project contains either \"shell.nix\" or "ghcid -c \"cabal repl\" -o errors.err --lint=hlint")) ;; Maybe `comint-exec' would be better? (build-command* (format "cached-nix-shell --run '%s'" build-command)) - (term-buffer (ansi-term build-command* "haskell-build")) + ;; `ansi-term' function adds asterisks on its own. + (term-buffer-name (format "haskell-build::%s" default-directory)) + (term-buffer (or (get-buffer (format "*%s*" term-buffer-name)) + (ansi-term build-command* term-buffer-name))) (watcher-process (get-buffer-process term-buffer))) ;; Disable the confirmation query on whether I am okay with killing the process. (when (processp watcher-process) @@ -242,12 +245,13 @@ This function assumes that root of the project contains either \"shell.nix\" or ;; Useful to switch there and resize the window. (with-current-buffer term-buffer (evil-normal-state)) + (display-buffer term-buffer) ;; No idea why, but `save-current-buffer' does not work here: ocus ;; stays in the ansi-term window. (switch-to-buffer current-buffer))) (push - '("\\*haskell-build\\*" + '("\\*haskell-build::.*\\*" (display-buffer-in-side-window) (side . top) (window-height . 12)