emacs: Make "@haskell-run-watcher" function idempotent
Now it creates at most one watcher process per project (as defined by "package.yaml"), and displays buffer of existing one if found.
This commit is contained in:
parent
e055f2406b
commit
fdb47eef2b
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue