Emacs lisp: is it possible (using lisp) to execute a command in eshell running in a different buffer?

I have an executable instance eshellin one buffer, and I am writing a C ++ source in another. I bound compileto <F5>, and I am wondering if it is possible to run the output (compilation) file in an eshell instance running in a different buffer?

If not, is there perhaps a way to open eshell in a new frame and automatically start compilation output in it?

Thank you in advance.

+3
source share
2 answers

Usually, if you want to start something after the compilation is complete, add it to the compilation command. For example, instead of

M-x compile RET make RET

You can enter

M-x compile RET make && ./test RET

- ,

M-x compile RET make test RET

, , eshell, .


, eshell, compilation-finish-functions:

. : , .

, , "finished\n", . - :

(defun run-compilation-output-in-eshell (buf msg)
  "If compilation finished successfully, switch to eshell and execute a command."
  (when (string= msg "finished\n")
    (eshell)
    (goto-char (point-max))
    (eshell-kill-input)
    (insert "echo command goes here")
    (eshell-send-input)))

(add-hook 'compilation-finish-functions #'run-compilation-output-in-eshell)

: eshell , . , .

+5

Emacs, , Elisp.

, F5 , ; , F5 ++:

  • eshell
  • ++
+2

Source: https://habr.com/ru/post/1776394/


All Articles