【问题标题】:emacs process in background without `&` [closed]没有`&`的后台emacs进程[关闭]
【发布时间】:2011-09-21 18:48:47
【问题描述】:

您好,我使用 emacs 作为我的默认编辑器。我希望 emacs 从 shell 在后台运行一个进程,而不在最后输入& 我该如何定制?

gaurish108 ~:emacs hello.cpp &

[1] 3889

gaurish108 ~:

【问题讨论】:

  • 如果您忘记输入&,您通常可以使用C-z 中断前台进程,然后输入bg 以在后台重新启动它(或fg 以再次在前台重新启动)。

标签: shell emacs


【解决方案1】:

正如 Burton Samograd 所说,这是 shell 语法的一部分。如果您想隐藏它,请尝试将其保存为 emacs.sh

emacs "$@" &

然后,chmod +x emacs.sh,只要emacs.sh 在你的 PATH 目录中,你应该可以运行 emacs

emacs.sh filename

【讨论】:

    【解决方案2】:

    我总是这样

     emacs --daemon
    

    它实际上使用了一个非常酷的 emacs 功能,其中 emacs 作为服务器运行。

    然后你通过连接

     emacsclient -nw       ## text mode, say via ssh on text connect
    

     emacsclient -c &      ## new x11 windows, return to prompt
    

    最好的部分是实际缓冲区在后台 emacs 服务器中保持活动状态,而前端客户端可以上升或下降 --- 状态编辑,特别是对于会话模式(shell、SQL、R、. ..) 它有很大的不同。

    【讨论】:

      【解决方案3】:

      令人讨厌的 & 是您在 shell 后台运行进程的方式。这样您就可以在运行程序后返回命令提示符。没有办法绕过它,它只是 shell 语法。

      【讨论】:

      • 那么可以自定义shell语法吗?
      • 不,您不能自定义该部分的 shell 语法。如果它真的困扰您,您可以将其隐藏在一个小脚本中。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-11-02
      • 1970-01-01
      • 1970-01-01
      • 2021-02-25
      • 2015-11-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多