从 emacs 向终端发送命令

spi*_*ike 6 emacs macos

我想在 elisp 的正在运行的 iterm 选项卡(或终端等)中运行命令。我希望使用emacs的下运行终端仿真器,因为我还没有找到一个手柄输出以及一个独立的终端模拟器。

这可能吗?

我基本上需要这个,但对于不在 emacs 下运行的进程:

(term-simple-send proc "echo hello")
Run Code Online (Sandbox Code Playgroud)

wdk*_*nls 3

如果您真的只关心输出质量,为什么不使用-hold这样的选项调用 uxterm 呢?

(defun external-xterm-shell-command (COMMAND)
  "Run a terminal command in an external xterm window."
  (interactive "sShell Command: ")
  (shell-command (concat "uxterm -hold -e " COMMAND)))
Run Code Online (Sandbox Code Playgroud)

  • 无论如何,我不知道要这样做,抱歉。为什么不将输出附加到文件中?Emacs 非常擅长显示这些;) (2认同)