emacs - 设置 emacs shell

标签 emacs startup

当我重新启动 Emacs 时,我经常(每周)做这种事情:

  1. 打开连接到 RSH 服务器的 shell,执行一些命令,重命名缓冲区
  2. 对几台不同的远程机器重复步骤 1

我在想:有没有办法让我可以在启动脚本中对这些设置进行硬编码?

最佳答案

这是一个启动 shell、ssh-es 到主机并在进入交互式 shell 之前运行命令的函数:

(defun start-remote-shell (host command)
  (shell (format "*shell-%s*" host))
  (sleep-for 0 500)  ; Wait half a second for the prompt to appear
  (insert (format "ssh -t %s %s'; exec bash -i'"
                  (shell-quote-argument host)
                  (shell-quote-argument (shell-quote-argument command))))
  (comint-send-input))

您可以将此片段放入您的.emacs 文件中,然后是您想要的特定调用,例如:

(start-remote-shell "server-one" "apache start")
(start-remote-shell "server-two" "mysql start")
(start-remote-shell "server-three" "foo start")

关于emacs - 设置 emacs shell,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11605478/

相关文章:

regex - 恢复 Emacs 中的垂直缓冲区位置

python - Emacs python 模式

emacs - 为什么 Emacs 中的 fixnums 只有 29 位?

emacs - Emacs 中的缓冲区重定位分配器是什么?

logging - Log4j - 如何从 log4j 隐藏启动配置消息

Emacs:将 eval 的输出发送到新缓冲区

intellij-idea - IntelliJ IDEA Ultimate-打开错误Mac : java.lang.IllegalArgumentException

linux - Spring Boot 应用程序即服务

java - 在 Windows 上使用startup.bat 运行 Tomcat8 时的 JVM 选项

air - 是否可以在启动时运行 AIR 应用程序?