bash 将 emacs 作为独立于终端的进程运行
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17972119/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Run emacs as separate process from terminal
提问by ojhawkins
When I run the emacs
text editor the process does not return so I cannot use the terminal which is obviously the default behavior.
当我运行emacs
文本编辑器时,进程不会返回,因此我无法使用终端,这显然是默认行为。
I cannot find the switch or command in the man
but I know it is something very simple.
我在 中找不到开关或命令,man
但我知道它非常简单。
How can I run emacs
as a separate process so I can continue to use the terminal without opening a second one?
如何emacs
作为一个单独的进程运行,以便我可以继续使用终端而无需打开第二个?
回答by Dan
You can start any program in the background by appending an ampersand to the command, emacs &
.
您可以通过在命令emacs &
.
There's a whole framework for working with backgrounded processes, see for example man jobs
, disown
, fg
, bg
, and try Ctrl-Z
on a running process, which will suspend it and give you the terminal, allowing you to resume that process either in the foreground or background at your pleasure. Normally when your shell closes, all those programs will end, disown
allows you to tell a program to keep running after you end your session.
有与转到后台处理工作的整体框架,见例如man jobs
,disown
,fg
,bg
,并尝试Ctrl-Z
对正在运行的进程,这将暂停,并给你的终端,让你恢复这一进程要么在你的快乐前景或背景。通常当你的 shell 关闭时,所有这些程序都会结束,disown
允许你告诉程序在你结束会话后继续运行。
回答by Basile Starynkevitch
The emacs --help
command is giving you a tip:
该emacs --help
命令为您提供了一个提示:
--batch do not do interactive display; implies -q
So run emacs --batch
(or maybe emacs --execute
somecommand).
所以运行emacs --batch
(或者可能emacs --execute
somecommand)。
If you have a desktop (or some X11 display) and want emacs
to open an X11 windows and give you back a shell prompt, run it in the background (e.g. emacs &
) as many commented.
如果您有一个桌面(或一些 X11 显示器)并且想要emacs
打开 X11 窗口并返回一个 shell 提示,请在后台运行它(例如emacs &
)。
And I find very useful to start programs (or shells) within emacs, e.g. with Emacs commands: M-x shell
, or M-x compile
(for make
etc...), or M-x gdb
for a debugger.
而且我发现在 emacs 中启动程序(或 shell)非常有用,例如使用 Emacs 命令:M-x shell
,或M-x compile
(用于make
等...),或M-x gdb
用于调试器。
You usually start one single emacs
at the beginning of a working day. You could use emacsclient
(or set your EDITOR
environment variable to it) for other editions using the same emacs
.
你通常emacs
在工作日开始时开始一首单曲。您可以使用emacsclient
(或将您的EDITOR
环境变量设置为)其他版本使用相同的emacs
.