Run emacs as separate process from terminal

蓝咒 提交于 2020-01-05 05:47:18

问题


When I run the emacs text editor the process does not return so I cannot use the terminal which is obviously the default behavior.

I cannot find the switch or command in the man but I know it is something very simple.

How can I run emacs as a separate process so I can continue to use the terminal without opening a second one?


回答1:


You can start any program in the background by appending an ampersand to the command, 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.




回答2:


The emacs --help command is giving you a tip:

   --batch             do not do interactive display; implies -q

So run emacs --batch (or maybe emacs --executesomecommand ).

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.

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.

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.



来源:https://stackoverflow.com/questions/17972119/run-emacs-as-separate-process-from-terminal

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!