Questions tagged [server]

The Emacs server, which allows opening files and running commands in an existing Emacs instance

Emacs can run a server which allows opening files and running commands in an existing Emacs instance.

To start a server in an Emacs instance, run the command server-start. This is automatic if Emacs runs as a .

To open a file or run a command in an existing Emacs instance, use the utility.

Do not use this tag for questions about other kinds of servers! Use a tag that is related to what the server is for.

78 questions
11
votes
1 answer

How to control emacs externally?

I'm developing an app in python which sends commands to a running emacs instance. Currently, I start an emacs server and send the commands through the command line, like this: subprocess.call(['emacsclient', '-e', '(with-current-buffer ' + …
Jesse
  • 1,984
  • 11
  • 19
11
votes
2 answers

Equivalent to --no-wait for emacs

The emacsclient program allows a flag --no-wait (abbreviated as -n) which will cause the emacs server to visit the specified file, and return immediately. emacsclient -n ~/.bashrc If I provide an alternate editor, then this will still work in cases…
nispio
  • 8,175
  • 2
  • 35
  • 73
10
votes
1 answer

How to know if emacs is running as a daemon?

I want to know if emacs is running as a daemon, so I can load some parts of my configuration according, I want to know this from within emacs.
shackra
  • 2,702
  • 18
  • 47
8
votes
2 answers

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 already running Emacs instance, for example by a…
Felix Hoffmann
  • 765
  • 1
  • 7
  • 17
8
votes
1 answer

How to test (programmatically) whether the current Emacs session (among several) is running the Emacs server?

The server-running-p predicate will evaluate to t if the Emacs server is running, irrespective of which Emacs session currently "owns" the server process. Therefore, when there are two or more independent Emacs sessions running simultaneously,…
kjo
  • 3,145
  • 14
  • 42
7
votes
1 answer

after-make-frame-functions does nothing for an otherwise working function

I am using workgroups and I have the following code in my init.el: (defun my-start-emacs (_) (interactive) (message "HI") (sleep-for 1) (if (daemonp) (progn (if (not (boundp 'server-wg)) (progn …
space_voyager
  • 709
  • 5
  • 19
7
votes
3 answers

Emacs 24.5.1 on Windows: How to use server mode?

I used to have Emacs 25.xx on my windows pc and was very happy with the daemon/server mode of emacs. Emacs started via batch-script on startup and everything worked fine -- on every subsequent call Emacs just started instantly. Just as it should.…
itmuckel
  • 267
  • 2
  • 12
7
votes
1 answer

Run elisp from command line in running emacs

How can I execute elisp in the currently running emacs from the command line? The following command echoes 'hi' but doesn't set 'abc in the emacs instance. emacsclient --no-wait --eval '(message "hi") (setq abc)' Is there a way to modify emacs from…
Joe
  • 1,312
  • 1
  • 8
  • 19
5
votes
1 answer

Why does using emacsclient from a remote host connect to the right socket, but I see nothing in my local Emacs?

I'm running a TCP server locally, and I'm trying to open a file from a remote host on my local Emacs through emacsclient. The reason for this is that I have emacspeak running locally which gives me speech, and I want to use this for commands that…
Parham Doustdar
  • 275
  • 2
  • 10
5
votes
1 answer

How to have C-g *not* cancel emacsclient eval commands?

I'm sending some commands to my emacs using emacsclient --eval on a timer. The only problem with this is if at the time I happen to be using emacs and press C-g to cancel something, instead of canceling what I intended to cancel it will cancel the…
Joseph Garvin
  • 2,061
  • 8
  • 21
4
votes
2 answers

Opening file with emacsclientw, file name contains non-latin characters

My first post here about Emacs. I've spent days trying to figure out answer before posting here. I'm running Emacs 26.1 on Windows 10. The setup that I'd like to have is running a single instance of Emacs and to be able to open files from Windows…
4
votes
1 answer

Setting up emacsclient (OSX)

I am trying to set up emacs to run as a server to avoid the time required to open individual sessions for each file. This is on OS X El Capitan. Using the instructions provided here, I have the first item described, the emacs executable I presume,…
Snelephant
  • 814
  • 1
  • 7
  • 17
4
votes
1 answer

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 on Windows to start a single instance and open files…
4
votes
1 answer

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 that the buffer still has a client. This happens…
Tyler
  • 21,719
  • 1
  • 52
  • 92
3
votes
2 answers

How to get the server-name?

When starting a server it's possible to set a name for the server (http://www.gnu.org/software/emacs/manual/html_node/emacs/Emacs-Server.html). These names are to be useful for connecting emacsclients to those servers, however it would be nice to…
Aaron Lee
  • 377
  • 2
  • 8
1
2 3 4 5 6