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.

See also Emacs-Server (GNU Emacs Manual) and Emacs Client (emacswiki).

326 questions
13
votes
2 answers

start emacsclient with focus from command line

When I start emacsclient from command line as below: emacsclient -a '' -c "$@" It always starts in the background (terminal window on top of emacsclient window), so I have to use mouse to click the window to switch to emacsclient. It's really…
lucky1928
  • 1,666
  • 10
  • 28
11
votes
1 answer

Emacs not responding to keyboard input

Sometimes Emacs stops responding to keyboard input. It responds to mouse input though. If I do killall -s SIGUSR2 emacs, the debugger shows this (but remains unresponsive to keyboard): Debugger entered--entering a function: * company-pre-command() …
Hatshepsut
  • 565
  • 3
  • 15
11
votes
4 answers

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 gui in a similar fashion?
dagda1
  • 615
  • 1
  • 4
  • 17
11
votes
1 answer

How do I use emacsclient as EDITOR or VISUAL?

Scenario: I'm in zsh and I want to edit a long shell command in an already open instance of Emacs. I've set $VISUALto emacsclient -n -c. When I run C-x C-e from zsh, a new Emacs frame opens, populated with contents of the zsh line. After editing and…
cg433n
  • 285
  • 2
  • 6
8
votes
1 answer

Determine graphical display on startup for emacs server/client

I am trying to have specific settings when I start a new emacs frame in X as opposed to in the terminal while using emacs-server. My initial attempt was using this solution, but it appears it isn't working for me (using Emacs 24.4.1). Basically, my…
rottweiler
  • 83
  • 5
7
votes
1 answer

How to open a file with emacsclient from Thunar?

I want to use emacsclient to open files from Thunar in Linux Mint 17 xfce. I have tried right-click+"open with other application"+"emacsclient -c", but this does nothing. I have also tried writing a custom emacsclient.desktop launcher. Emacs daemon…
GPeraza
  • 121
  • 3
6
votes
1 answer

Is it possible to use emacsclient remotely?

I'd like to use emacsclient on my laptop to connect to an emacs server on my desktop. I think I know that the emacs server process listens to a unix socket in "/tmp/emacs${UID}". So I need to make a connection between a unix socket in…
Realraptor
  • 1,283
  • 7
  • 17
6
votes
3 answers

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 me from using it. In particular, sometimes one…
asmeurer
  • 1,572
  • 12
  • 32
6
votes
2 answers

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: emacsclient file 2.And it can also evaluate an…
5
votes
2 answers

How can I get emacsclient --eval not to print things in an emacs buffer, but only on the command line?

So I have a hack to get my emacs org-clock to display in polybar (a system panel utility). It involves a script that looks like this: CLOCKSTRING=`emacsclient --eval "(if (org-clocking-p)(print (org-clock-get-clock-string))(print -1))))"` if [[…
Jonathan
  • 597
  • 5
  • 22
4
votes
1 answer

Running code on emacsclient connect

My emacs installation has over time grown so that the startup has started taking multiple seconds. The only feasible way to run emacs then is in daemon mode and then connecting with emacsclient. In my init.el I have the following snippet: (lambda…
Rovanion
  • 987
  • 7
  • 20
4
votes
1 answer

Run command after opening a file with emacsclient

Is it possible to specify an argument for emacsclient to run a command in the opened file? I would like to set the editor of a program to emacsclient -r '(search-forward-regexp "^<<<")'. Addition 1 While I can run emacs file --eval '(search-forward…
jo-so
  • 51
  • 5
4
votes
1 answer

How to open a file in another window by clicking on a file in my window manager?

When I double click to open a file, a new Emacs session is launched, like this: So now there are two sessions. What I want to do is that when I double click a file, it will be opened in another window in the existing session, so there is only one…
Zimou Zhang
  • 111
  • 7
4
votes
1 answer

How to 'fix' gnuclient after opening a second instance of emacs?

If I open a second instance of emacs accidentally (which happens more often than I am willing to admit) and then close it, gnuclient starts responding with the following error: gnuclient: Connection refused gnuclient: unable to connect to local Is…
davidrmcharles
  • 307
  • 1
  • 8
3
votes
3 answers

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
Håkon Hægland
  • 3,648
  • 1
  • 22
  • 51
1
2 3 4