Emacs/Guix: Wait for process termination when install profiles.
parent
293197b88f
commit
c04fd76c12
|
@ -128,19 +128,34 @@ If MANIFEST is nil, it is queried from the manifests found in `ambrevar/guix-man
|
|||
|
||||
(defun ambrevar/run-in-eshell (command)
|
||||
(let ((eshell-buffer-name "*guix*"))
|
||||
(eshell)
|
||||
(when (eshell-interactive-process)
|
||||
(eshell t))
|
||||
(eshell)
|
||||
(when (eshell-interactive-process)
|
||||
(eshell t))
|
||||
(if (get-buffer-process (current-buffer))
|
||||
(message "Try again after current process termination.")
|
||||
(eshell-interrupt-process)
|
||||
(insert command)
|
||||
(eshell-send-input)))
|
||||
(eshell-send-input))))
|
||||
|
||||
(defun ambrevar/run-in-shell (command)
|
||||
(shell (generate-new-buffer (generate-new-buffer-name "*guix*")))
|
||||
(goto-char (point-max))
|
||||
(comint-delete-input)
|
||||
(insert command)
|
||||
(comint-send-input))
|
||||
(shell (get-buffer-create "*guix*"))
|
||||
(let ((process (get-buffer-process (current-buffer))))
|
||||
(when process
|
||||
(accept-process-output process 0.1)))
|
||||
(if (ambrevar/helm-ff-shell-alive-p)
|
||||
(message "Try again after current process termination.")
|
||||
(goto-char (point-max))
|
||||
(comint-delete-input)
|
||||
(insert command)
|
||||
(comint-send-input)))
|
||||
|
||||
(defun ambrevar/helm-ff-shell-alive-p () ; TODO: Use function from Helm 3.6.3 once out.
|
||||
"Returns non nil when a process is running inside `shell-mode' buffer."
|
||||
(save-excursion
|
||||
(comint-goto-process-mark)
|
||||
(or (null comint-last-prompt)
|
||||
(not (eql (point)
|
||||
(marker-position (cdr comint-last-prompt)))))))
|
||||
|
||||
(defun ambrevar/guix-install-manifest (&optional manifest channel)
|
||||
"Install Guix manifest to `ambrevar/guix-extra-profiles'.
|
||||
|
|
|
@ -35,10 +35,10 @@ prefix arg shell buffer doesn't exists, create it and switch to it."
|
|||
(car bufs)))
|
||||
(switch-to-buffer it)
|
||||
(shell))
|
||||
;; TODO: Can we check if a process is currently running within the running shell?
|
||||
(funcall cd-shell)))
|
||||
|
||||
(advice-add 'helm-ff-switch-to-eshell :override 'ambrevar/helm-ff-switch-to-shell)
|
||||
;; TODO: Above code can be removed with Helm 3.6.3.
|
||||
|
||||
(defun ambrevar/shell-setup ()
|
||||
(set (make-variable-buffer-local 'comint-input-history-ignore)
|
||||
|
|
Loading…
Reference in New Issue