Questions tagged [emacsclient]

emacsclient is a program which allows the user to connect to the Emacs Server. This is useful when using Emacs as the default editor on Unix-like systems, as it allows Emacs to be invoked without creating a new process, allowing the reuse of shared buffers and command history.

Filter by
Sorted by
Tagged with
16
votes
2answers
508 views

Collapsing undo history

I'm working on an Emacs mode that lets you control Emacs with speech recognition. One of the problems I've ran into is that the way Emacs handles undo doesn't match how you would expect it to work ...
44
votes
7answers
3k views

How can I use my local Emacs client as the $EDITOR for remote machines I access over TRAMP?

I often use TRAMP to manage several remote servers, both for editing files and running remote shells in shell-mode. However, this does not work when a command uses the EDITOR variable to edit a file, ...
44
votes
4answers
18k views

How do I use emacsclient to connect to a remote emacs instance?

I'd like to be able to run emacs on one computer: server $ emacs --daemon And then connect to it from another: local $ emacsclient -c server Is this possible? If so, how?
11
votes
2answers
979 views

Make emacsclient create a frame only if there isn't one already

How can I make emacsclient -a '' -n create a new frame only if there isn't one already? The problem with the -c flag is that it creates a new frame every time. The problem without it is that if there ...
3
votes
1answer
405 views

Prevent emacsclient from blocking other instances

I use emacs in the terminal, typically with many emacs instances running at once in different tabs. This is a perfect use case for emacsclient, but it has always had various glitches that have stopped ...
3
votes
1answer
660 views

emacs --daemon frozen when started with emacsclient file

This is somewhat of a follow up to Prevent emacsclient from blocking other instances. I am using emacsclient -a '' -nw --socket-name=$TTY where TTY=$(basename tty). I use emacs in the terminal and ...
3
votes
1answer
323 views

emacsclient opens a file and does eval simultaneously

I know that emacs can open a file while evaluating an expression: emacs file --eval "(toggle-frame-maximized)" However I failed to replicate this with emacsclient: 1.emacsclient can open a file: ...
8
votes
3answers
3k views

Reload environment variables

This question has been asked at superuser is-there-a-way-to-reload-environment-variables-in-emacs, but no good solution was given. I am using EmacsClient with often more than 30 buffers open, if I ...
7
votes
2answers
4k views

Multiple Emacs instances each with their own server?

In my setup, I have several (GNU) Emacs instances running simultaneously on my local machine, one for each project or task that I'm currently working on. I would like to be able to open buffers in an ...
13
votes
3answers
1k views

Is there any way to run a hook function only once?

The context I'm using the after-make-frame-functions hook to load properly the themes in an emacs client/server configuration. Specifically this is the code snippet that I use to make that (based in ...
9
votes
4answers
4k views

Run emacs GUI from emacsclient

I am running emacs 25.1. I have emacs server starting as a daemon on startup and I can open an emacs terminal session with the following alias: alias em="emacsclient -t" How can I start the emacs ...
8
votes
1answer
1k views

How to prevent emacsclient starting a new frame every time?

I have Ubuntu 12.04 running with Emacs 24.3. On computer startup, emacs --daemon is executed, and I have modified the emacs24.desktop to take emacsclient -c -a "" as exec parameter. However, whenever ...
3
votes
3answers
796 views

Open buffer in a specified frame

Do frames in emacs have a handle the way buffers do? In particular, can I specify that a particular file should be opened in a specified frame? I would like to have two frames where I use one for ...
2
votes
1answer
683 views

server-edit vs kill-buffer to kill an emacsclient buffer

I use emacsclient to open files from my webrowser (pdfs, text files etc). When I'm done with the file, I know I need to close it with C-x # (server-edit); if I use C-x k (kill-buffer) I get a warning ...
2
votes
3answers
191 views

Why is Emacsclient inserting quotes around output strings?

I would like to have output from Emacsclient without quotes, but $ emacsclient -s my-server -e '(princ "hello")' gives output: "hello" Expected output would be: hello
9
votes
3answers
3k views

Emacsclient: One single emacs process all the time from start up & never close & better hide GUI

Since emacsclient can handle long package loading time proerly, I really want to keep at least one emacs process, and most of the time only one emacs process, open as a background process and better ...
4
votes
1answer
643 views

From an external script, open file and run some simple expression whether emacs already running or not

Context / initial need (works fine) I wrote and use a script that generates a file and uses emacsclient to edit it in an existing or new instance of emacs, in a new window. Similar to Set up Emacs ...
3
votes
1answer
199 views

emacsclient directly start eshell command command line

Both of the following work to call a graphical/terminal eshell: emacs -f eshell emacs -nw -f eshell Furthermore, this 2-step process also works: `emacsclient -t -a '' /some/real/file/name Metax ...
2
votes
1answer
187 views

tool-bar in emacsclient

I have the following for ridding of the toolbar on startup in graphical mode in my init configuration: (if window-system (tool-bar-mode -1) ) the issue: it works fine (albeit slow...see this ...
2
votes
1answer
451 views

Opening frames from emacs-daemon

How do I open a frame at start-up when using emacs --daemon? I don't run emacs --daemon directly. Instead, I use emacsclient -c -a '' which starts an emacs-server if there isn't one running already. ...
1
vote
1answer
164 views

emacs --daemon crashes when parent ssh session dies

I'm using emacs 26.1 (although I don't think this is a new issue with this verison). Note - this is not the GTK bug which results in the daemon crashing if X Connectivity is lost. I am aware of that ...
1
vote
0answers
126 views

Possible to pass arguments to emacsclient alternate-editor?

Currently this works: emacsclient ..args.. --alternate-editor=some_editor However this does not: emacsclient ..args.. --alternate-editor="some_editor --args" Is there a way to call the alternate-...
6
votes
4answers
1k views

Emacs cursor color is different in daemon and non-daemon modes

There's some weird stuff I encounter when running Emacs under KDE. Here's how it looks when I run it normally, via the emacs command: If I run it as a daemon, here's what I see: And if I run ...
3
votes
0answers
247 views

emacsclient doesn't start when visiting a file that is already open

I start emacsclient with emacsclient -a 'emacs-server-start' -nw --socket-name=$TTY, where emacs-server-start is a script that runs emacs --daemon="$TTY" (I use $TTY to get a different client for each ...
3
votes
1answer
725 views

Attempt to delete minibuffer or sole ordinary window

I have a daemonized emacs, and I'm able to close any emacs frame, even the last one, using the window manager or old good C-x C-c, just to be able to retrieve all my buffers when i ask the daemon for ...
2
votes
1answer
702 views

How to gracefully kill clientless daemon from commandline?

summary What to utter from commandline to cause a running clientless Emacs daemon/server process to gracefully shutdown--i.e., clean up after itself, then exit--without creating additional Emacs ...
2
votes
1answer
110 views

Why are emacsclient and emacs separate programs?

I really like the client-server structure of emacs. However, I feel uncomfortable to run 'emacsclient' to attach to running emacs server. Is there any specific reason that emacs seperated emacsclient ...
2
votes
1answer
191 views

How do you grep from within emacs ( git grep 'foo' | grep baa )

I do this often after shelling out to bash $ git grep 'banner-image' | grep mb3 Can I do it without leaving emacs?
1
vote
1answer
377 views

What is the use for server-edit (C-x #)

This is my current Emacs workflow: emacs --daemon emacsclient -c then editing few files and saving some of them (and keeping some of them unsaved and open on the server for later edit); then ...
1
vote
1answer
264 views

How to check for emacs being initialized in daemon mode?

I use emacs gui in daemon mode and also in standalone terminal mode. There is a package that I just want to use when I'm using emacs in terminal mode. the problem is that I can't use (display-...
1
vote
2answers
152 views

Avoid to create a new window in sql mode

I use a monitor and a laptop screen as my multimonitor setup. Unfortunately the monitor and the laptop differs in resolution. So I use 2 frames, one frame on the monitor and one frame on the laptop ...
1
vote
2answers
106 views

local-function-key-map gets overwritten by emacsclient

The following .emacs file works as expected, so long as I invoke emacs the "normal" way (ie by launching the emacs executable directly). (global-unset-key (kbd "C-]")) (global-set-key (kbd "H-C-]") '...
0
votes
0answers
110 views

Running Emacs as a client does not load my settings

I'm using the new systemd daemon option with Emacs 26. I have a problem, though. If I open a client instance (emacsclient -c) no config files (my .emacs) are loaded. So I don't see the usefulness in ...