tldr/pages/common/emacsclient.md

30 lines
819 B
Markdown
Raw Normal View History

2017-12-28 10:00:04 +00:00
# emacsclient
2021-06-14 23:27:30 +01:00
> Open files in an existing Emacs server.
> See also `emacs`.
2019-06-08 01:04:00 +01:00
> More information: <https://www.emacswiki.org/emacs/EmacsClient>.
2017-12-28 10:00:04 +00:00
2021-06-14 23:27:30 +01:00
- Open a file in an existing Emacs server (using GUI if available):
2018-01-03 08:42:26 +00:00
2021-06-14 23:27:30 +01:00
`emacsclient {{path/to/file}}`
2018-01-03 08:42:26 +00:00
2021-06-14 23:27:30 +01:00
- Open a file in console mode (without an X window):
2017-12-28 10:00:04 +00:00
2021-06-14 23:27:30 +01:00
`emacsclient --no-window-system {{path/to/file}}`
2017-12-28 10:00:04 +00:00
2021-06-14 23:27:30 +01:00
- Open a file in a new Emacs window:
2017-12-28 10:00:04 +00:00
2021-06-14 23:27:30 +01:00
`emacsclient --create-frame {{path/to/file}}`
2020-07-17 21:17:43 +01:00
2021-06-14 23:27:30 +01:00
- Evaluate a command, printing the output to stdout, and then quit:
2020-07-17 21:17:43 +01:00
2021-06-14 23:27:30 +01:00
`emacsclient --eval '({{command}})'`
2020-07-17 21:17:43 +01:00
2021-06-14 23:27:30 +01:00
- Specify an alternative editor in case no Emacs server is running:
2020-07-17 21:17:43 +01:00
2021-06-14 23:27:30 +01:00
`emacsclient --alternate-editor {{editor}} {{path/to/file}}`
- Stop a running Emacs server and all its instances, asking for confirmation on unsaved files:
`emacsclient --eval '(save-buffers-kill-emacs)'`