Forrest logo
tool overview
On this page you find all important commands for the CLI tool emacsclient. If the command you are looking for is missing please ask our AI.

emacsclient

Emacsclient is a command-line tool used to interact with the Emacs text editor. It allows you to open files or buffers within an existing Emacs session, making it faster and more efficient than starting a new instance of Emacs every time.

Here are a few key features and uses of emacsclient:

  1. Efficient file editing: By using emacsclient to open files, you can avoid the startup time and memory footprint of launching a new Emacs instance. It connects to an existing Emacs server process and utilizes its resources.

  2. Buffer management: Emacsclient provides a way to create and manage multiple buffers within an Emacs session. It allows you to switch between buffers, split windows, and navigate through your work more efficiently.

  3. Scripting and automation: You can use emacsclient to execute commands, functions, or scripts directly within Emacs. This can be useful for automating tasks, writing custom scripts, or integrating Emacs with other tools or workflows.

  4. Server-client architecture: Emacsclient works as a client that communicates with an Emacs server process. The server runs continuously in the background and can be started with the 'emacs --daemon' command. Multiple clients can connect to the same server, allowing for collaborative editing or remote control of an Emacs session.

  5. Customizable and extensible: As with Emacs itself, emacsclient can be customized and extended using Emacs Lisp. You can define your own functions, shortcuts, and key bindings to tailor the client behavior to your needs.

Overall, emacsclient enhances the versatility and productivity of Emacs by providing a lightweight interface to interact with an existing Emacs session, making it a powerful tool for text editing and development workflows.

List of commands for emacsclient:

  • emacsclient:tldr:07a3b emacsclient: Evaluate a command, printing the output to `stdout`, and then quit.
    $ emacsclient --eval '(${command})'
    try on your machine
    explain this command
  • emacsclient:tldr:43a5e emacsclient: Open a file in an existing Emacs server (using GUI if available).
    $ emacsclient ${filename}
    try on your machine
    explain this command
  • emacsclient:tldr:5974e emacsclient: Specify an alternative editor in case no Emacs server is running.
    $ emacsclient --alternate-editor ${editor} ${filename}
    try on your machine
    explain this command
  • emacsclient:tldr:70b1a emacsclient: Open a file in console mode (without an X window).
    $ emacsclient --no-window-system ${filename}
    try on your machine
    explain this command
  • emacsclient:tldr:ca0e1 emacsclient: Open a file in a new Emacs window.
    $ emacsclient --create-frame ${filename}
    try on your machine
    explain this command
  • emacsclient:tldr:e488f emacsclient: Stop a running Emacs server and all its instances, asking for confirmation on unsaved files.
    $ emacsclient --eval '(save-buffers-kill-emacs)'
    try on your machine
    explain this command
tool overview