https://wikemacs.org/api.php?action=feedcontributions&user=Saulrh&feedformat=atomWikEmacs - User contributions [en]2024-03-29T10:07:42ZUser contributionsMediaWiki 1.35.14https://wikemacs.org/index.php?title=Emacs_server&diff=1592Emacs server2012-03-29T17:23:10Z<p>Saulrh: Looks like {{command}} doesn't work in a heading. Changed to <code>.</p>
<hr />
<div>Emacs includes an optional client-server architecture.<br />
<br />
== Starting the Server ==<br />
<br />
=== With <code>server-start</code> ===<br />
To start a server in an existing Emacs session, run {{Command|server-start}}. A server started in this manner will close when the last visible Emacs frame closes. If you want Emacs to automatically run a server on startup, add the following to your configuration file.<br />
<br />
<syntaxhighlight lang="lisp"><br />
(server-start)<br />
</syntaxhighlight><br />
<br />
=== With <tt>--daemon</tt> ===<br />
Emacs 23 and higher provide the <tt>--daemon</tt> command-line argument, which will cause Emacs to immediately start a server and fork into the background. A server started in this manner is fully daemonized and will remain running even with no visible Emacs frames and after its parent terminal has closed (for example, after an SSH session has disconnected). <br />
<br />
Note that, if using <tt>--daemon</tt>, your configuration file will be run while Emacs is still in a terminal. This may affect your theming if you usually use graphical Emacs.<br />
<br />
This option is not supported on [[Windows]].<br />
<br />
== Using Clients ==<br />
<br />
Once the server is started you may use the <code>emacsclient</code> command outside of Emacs to send a file to Emacs for editing, e.g. <code>emacsclient ~/.emacs.d/init.el</code> to modify your init file. On a GNU/Linux system it might be a good idea to set your <tt>EDITOR</tt> environment variable to <tt>emacsclient</tt> or <tt>emacsclient -t</tt>. Using <tt>emacsclient</tt> without any arguments will cause the calling process to simply pause and wait for the Emacs server to report that it's done editing. Using <tt>emacsclient -t</tt> will cause the calling process to put up a text-mode frame in the same terminal.<br />
<br />
If the server was started using <tt>--daemon</tt>, you should run <tt>emacsclient -t</tt> or <tt>emacsclient -nc</tt> to create a visible frame to interact with.<br />
<br />
== Finishing Up ==<br />
<br />
Once you have finished with a buffer that was opened via <tt>emacsclient</tt> you should use the {{CommandKeys|C-x #|server-edit}} to properly close the loop. Killing the buffer normally will not send the signal to <tt>emacsclient</tt> that Emacs has finished with the file.<br />
<br />
If you're in an Emacs session that was started using <tt>--daemon</tt>, {{Keys|C-x C-c}} will only close the frame that it was invoked in. It will also signal to the client that owns the frame that its editing job is done, so <tt>emacsclient -c</tt> or <tt>emacsclient -t</tt> as <tt>EDITOR</tt> will behave much like a full <tt>emacs</tt> or <tt>emacs -nw</tt>.<br />
<br />
To entirely close a server started with <tt>--daemon</tt>, run {{Command|save-buffers-kill-emacs}} in a frame.</div>Saulrhhttps://wikemacs.org/index.php?title=User:Saulrh&diff=854User:Saulrh2012-03-27T06:43:36Z<p>Saulrh: Create user page ~~~~</p>
<hr />
<div>I'm moving toward being an [[:Category:Intermediate|intermediate]] Emacs user, having used it extensively since 2009. I figured that I should give at least a little bit back to the community that's continually helping me finish my homework :P.</div>Saulrhhttps://wikemacs.org/index.php?title=Emacs_server&diff=847Emacs server2012-03-27T06:18:59Z<p>Saulrh: /* Finishing Up */ move words around</p>
<hr />
<div>Emacs includes an optional client-server architecture.<br />
<br />
== Starting the Server ==<br />
=== With <code>server-start</code> ===<br />
To start a server in an existing Emacs session, run <code>server-start</code>. A server started in this manner will close when the last visible Emacs frame closes. If you want Emacs to automatically run a server on startup, it makes sense to add <code>server-start</code> to your configuration file somewhere.<br />
=== With <tt>--daemon</tt> ===<br />
Emacs 24 and higher provide the <tt>--daemon</tt> command-line argument, which will cause Emacs to immediately start a server and fork into the background. A server started in this manner is fully daemonized and will remain running even with no visible Emacs frames and after its parent terminal has closed (for example, after an SSH session has disconnected).<br />
<br />
Note that, if using <tt>--daemon</tt>, your configuration file will be run while Emacs is still in a terminal. This may affect your theming if you usually use graphical Emacs.<br />
<br />
== Using Clients ==<br />
<br />
Once the server is started you may use the <code>emacsclient</code> command outside of Emacs to send a file to Emacs for editing, e.g. <code>emacsclient ~/.emacs.d/init.el</code> to modify your init file. On a GNU/Linux system it might be a good idea to set your <tt>EDITOR</tt> environment variable to <tt>emacsclient</tt> or <tt>emacsclient -t</tt>. Using <tt>emacsclient</tt> without any arguments will cause the calling process to simply pause and wait for the Emacs server to report that it's done editing. Using <tt>emacsclient -t</tt> will cause the calling process to put up a text-mode frame in the same terminal.<br />
<br />
If the server was started using <tt>--daemon</tt>, you should run <tt>emacsclient -t</tt> or <tt>emacsclient -nc</tt> to create a visible frame to interact with.<br />
<br />
== Finishing Up ==<br />
<br />
Once you have finished with a buffer that was opened via <tt>emacsclient</tt> you should use the <code>C-x #</code> (<code>server-edit</code>) to properly close the loop. Killing the buffer normally will not send the signal to <tt>emacsclient</tt> that Emacs has finished with the file.<br />
<br />
If you're in an Emacs session that was started using <tt>--daemon</tt>, <code>C-x C-c</code> will only close the frame that it was invoked in. It will also signal to the client that owns the frame that its editing job is done, so <tt>emacsclient -c</tt> or <tt>emacsclient -t</tt> as <tt>EDITOR</tt> will behave much like a full <tt>emacs</tt> or <tt>emacs -nw</tt>.<br />
<br />
To entirely close a server started with <tt>--daemon</tt>, run <code>save-buffers-kill-emacs</tt> in a frame.</div>Saulrhhttps://wikemacs.org/index.php?title=Emacs_server&diff=843Emacs server2012-03-27T06:17:41Z<p>Saulrh: /* With --daemon */ typo</p>
<hr />
<div>Emacs includes an optional client-server architecture.<br />
<br />
== Starting the Server ==<br />
=== With <code>server-start</code> ===<br />
To start a server in an existing Emacs session, run <code>server-start</code>. A server started in this manner will close when the last visible Emacs frame closes. If you want Emacs to automatically run a server on startup, it makes sense to add <code>server-start</code> to your configuration file somewhere.<br />
=== With <tt>--daemon</tt> ===<br />
Emacs 24 and higher provide the <tt>--daemon</tt> command-line argument, which will cause Emacs to immediately start a server and fork into the background. A server started in this manner is fully daemonized and will remain running even with no visible Emacs frames and after its parent terminal has closed (for example, after an SSH session has disconnected).<br />
<br />
Note that, if using <tt>--daemon</tt>, your configuration file will be run while Emacs is still in a terminal. This may affect your theming if you usually use graphical Emacs.<br />
<br />
== Using Clients ==<br />
<br />
Once the server is started you may use the <code>emacsclient</code> command outside of Emacs to send a file to Emacs for editing, e.g. <code>emacsclient ~/.emacs.d/init.el</code> to modify your init file. On a GNU/Linux system it might be a good idea to set your <tt>EDITOR</tt> environment variable to <tt>emacsclient</tt> or <tt>emacsclient -t</tt>. Using <tt>emacsclient</tt> without any arguments will cause the calling process to simply pause and wait for the Emacs server to report that it's done editing. Using <tt>emacsclient -t</tt> will cause the calling process to put up a text-mode frame in the same terminal.<br />
<br />
If the server was started using <tt>--daemon</tt>, you should run <tt>emacsclient -t</tt> or <tt>emacsclient -nc</tt> to create a visible frame to interact with.<br />
<br />
== Finishing Up ==<br />
<br />
Once you have finished with a buffer that was opened via <tt>emacsclient</tt> you should use the <code>C-x #</code> (<code>server-edit</code>) to properly close the loop. Killing the buffer normally will not send the signal to <tt>emacsclient</tt> that Emacs has finished with the file.<br />
<br />
If you're in an Emacs session that was started using <tt>--daemon</tt>, <code>C-x C-c</code> will only close the frame that it was invoked in. It will also signal to the client that owns the frame that its editing job is done, so <tt>emacsclient -c</tt> or <tt>emacsclient -t</tt> as <tt>EDITOR</tt> will behave much like a full <tt>emacs</tt> or <tt>emacs -nw</tt>.<br />
<br />
To close a server started with <tt>--daemon</tt> entirely, run <code>save-buffers-kill-emacs</tt> in a frame.</div>Saulrhhttps://wikemacs.org/index.php?title=Emacs_server&diff=842Emacs server2012-03-27T06:17:06Z<p>Saulrh: /* With --daemon */</p>
<hr />
<div>Emacs includes an optional client-server architecture.<br />
<br />
== Starting the Server ==<br />
=== With <code>server-start</code> ===<br />
To start a server in an existing Emacs session, run <code>server-start</code>. A server started in this manner will close when the last visible Emacs frame closes. If you want Emacs to automatically run a server on startup, it makes sense to add <code>server-start</code> to your configuration file somewhere.<br />
=== With <tt>--daemon</tt> ===<br />
Emacs 24 and higher provide the <tt>--daemon</tt> command-line argument, which will cause Emacs to immediately start a server and fork into the background. A server started in this manner is fully daemonized and will remain running even with no visible Emacs frames and after its parent terminal has closed (for example, after an SSH session has disconnected).<br />
<br />
Note that, if using <tt>--daemon</tt>, your configuration file will be run while Emacs is still in a terminal. This may affect your theming if you use usually graphical Emacs.<br />
<br />
== Using Clients ==<br />
<br />
Once the server is started you may use the <code>emacsclient</code> command outside of Emacs to send a file to Emacs for editing, e.g. <code>emacsclient ~/.emacs.d/init.el</code> to modify your init file. On a GNU/Linux system it might be a good idea to set your <tt>EDITOR</tt> environment variable to <tt>emacsclient</tt> or <tt>emacsclient -t</tt>. Using <tt>emacsclient</tt> without any arguments will cause the calling process to simply pause and wait for the Emacs server to report that it's done editing. Using <tt>emacsclient -t</tt> will cause the calling process to put up a text-mode frame in the same terminal.<br />
<br />
If the server was started using <tt>--daemon</tt>, you should run <tt>emacsclient -t</tt> or <tt>emacsclient -nc</tt> to create a visible frame to interact with.<br />
<br />
== Finishing Up ==<br />
<br />
Once you have finished with a buffer that was opened via <tt>emacsclient</tt> you should use the <code>C-x #</code> (<code>server-edit</code>) to properly close the loop. Killing the buffer normally will not send the signal to <tt>emacsclient</tt> that Emacs has finished with the file.<br />
<br />
If you're in an Emacs session that was started using <tt>--daemon</tt>, <code>C-x C-c</code> will only close the frame that it was invoked in. It will also signal to the client that owns the frame that its editing job is done, so <tt>emacsclient -c</tt> or <tt>emacsclient -t</tt> as <tt>EDITOR</tt> will behave much like a full <tt>emacs</tt> or <tt>emacs -nw</tt>.<br />
<br />
To close a server started with <tt>--daemon</tt> entirely, run <code>save-buffers-kill-emacs</tt> in a frame.</div>Saulrhhttps://wikemacs.org/index.php?title=Emacs_server&diff=841Emacs server2012-03-27T06:16:09Z<p>Saulrh: Add info about --daemon behavior. Organize into sections.</p>
<hr />
<div>Emacs includes an optional client-server architecture.<br />
<br />
== Starting the Server ==<br />
=== With <code>server-start</code> ===<br />
To start a server in an existing Emacs session, run <code>server-start</code>. A server started in this manner will close when the last visible Emacs frame closes. If you want Emacs to automatically run a server on startup, it makes sense to add <code>server-start</code> to your configuration file somewhere.<br />
=== With <tt>--daemon</tt> ===<br />
Emacs 24 or higher provides the <tt>--daemon</tt> command-line argument, which will cause Emacs to immediately start a server and fork into the background. A server started in this manner is fully daemonized and will remain running even with no visible Emacs frames and after its parent terminal has closed (for example, after an SSH session has disconnected).<br />
<br />
Note that, if using <tt>--daemon</tt>, your configuration file will be run while Emacs is still in a terminal. This may affect your theming if you use usually graphical Emacs.<br />
<br />
== Using Clients ==<br />
<br />
Once the server is started you may use the <code>emacsclient</code> command outside of Emacs to send a file to Emacs for editing, e.g. <code>emacsclient ~/.emacs.d/init.el</code> to modify your init file. On a GNU/Linux system it might be a good idea to set your <tt>EDITOR</tt> environment variable to <tt>emacsclient</tt> or <tt>emacsclient -t</tt>. Using <tt>emacsclient</tt> without any arguments will cause the calling process to simply pause and wait for the Emacs server to report that it's done editing. Using <tt>emacsclient -t</tt> will cause the calling process to put up a text-mode frame in the same terminal.<br />
<br />
If the server was started using <tt>--daemon</tt>, you should run <tt>emacsclient -t</tt> or <tt>emacsclient -nc</tt> to create a visible frame to interact with.<br />
<br />
== Finishing Up ==<br />
<br />
Once you have finished with a buffer that was opened via <tt>emacsclient</tt> you should use the <code>C-x #</code> (<code>server-edit</code>) to properly close the loop. Killing the buffer normally will not send the signal to <tt>emacsclient</tt> that Emacs has finished with the file.<br />
<br />
If you're in an Emacs session that was started using <tt>--daemon</tt>, <code>C-x C-c</code> will only close the frame that it was invoked in. It will also signal to the client that owns the frame that its editing job is done, so <tt>emacsclient -c</tt> or <tt>emacsclient -t</tt> as <tt>EDITOR</tt> will behave much like a full <tt>emacs</tt> or <tt>emacs -nw</tt>.<br />
<br />
To close a server started with <tt>--daemon</tt> entirely, run <code>save-buffers-kill-emacs</tt> in a frame.</div>Saulrhhttps://wikemacs.org/index.php?title=Emacs_server&diff=775Emacs server2012-03-27T05:13:35Z<p>Saulrh: Add information about --daemon</p>
<hr />
<div>Emacs includes an optional client-server architecture.<br />
<br />
To start the server, run <code>server-start</code> in an existing Emacs, or (in Emacs 24 or higher) run Emacs with the <tt>--daemon</tt> argument to have Emacs start a server and immediately fork into the background. The <tt>--daemon</tt> argument allows you to keep Emacs running without any visible frames, but your configuration file will be run as if in a terminal frame and your graphical theming may be affected. If you want to start a server automatically, add <code>server-start</code> somewhere in your configuration file.<br />
<br />
Once this is done you may use the <code>emacsclient</code> command outside of Emacs to send a file to Emacs for editing, e.g. <code>emacsclient ~/.emacs.d/init.el</code> to modify your init file. On a GNU/Linux system it might be a good idea to set your <tt>EDITOR</tt> environment variable to <tt>emacsclient</tt>.<br />
<br />
Once you have finished with a buffer that was opened via <tt>emacsclient</tt> you should use the <code>C-x #</code> (<code>server-edit</code>) to properly close the loop. Killing the buffer normally will not send the signal to <tt>emacsclient</tt> that Emacs has finished with the file.</div>Saulrh