Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to install emacs server on ubuntu

139 views
Skip to first unread message

n179911

unread,
Nov 25, 2009, 6:06:36 PM11/25/09
to help-gn...@gnu.org
Hi,
I read this follow wiki entry trying to install emacs server on ubuntu:
http://www.emacswiki.org/emacs/EmacsClient#toc5

I have download the following script and cp it to /etc/init.d/emacsd
http://www.emacswiki.org/emacs/EmacsdInitScript

And I restart my ubuntu, and I run 'emacsclient'.
I still get:
$ emacsclient
emacsclient: file name or argument required
Try `emacsclient --help' for more information

Thank you for your help.


to...@tuxteam.de

unread,
Nov 26, 2009, 12:38:09 AM11/26/09
to n179911, help-gn...@gnu.org
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Well? Did you try ;-)

Thing is that the client needs a cookie file to know "where" the server
is (and to show the server that it's allowed to). So, provided this
server is running, it has put this cookie file somewhere (typically in
your home dir, in emacs.d/server/server). I don't know how Ubuntu
customizes this in partticular.

Regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFLDhRBBcgs9XrR2kYRAssFAJ9wIKj9igqkLUCLZQFaMT0oN/eZUACfZG6e
Z+9MKt6IL5rcQliLxjkZuZM=
=s32I
-----END PGP SIGNATURE-----


n179911

unread,
Nov 26, 2009, 3:35:09 AM11/26/09
to to...@tuxteam.de, help-gn...@gnu.org
I tried following this, I want emacs daemon starts/kills automatically:
http://www.emacswiki.org/emacs/emacsd, which I did this (as root).
  1. cp emacsd /etc/init.d/
  2. chmod 755 /etc/init.d/emacsd
  3. update-rc.d emacsd defaults
But I still get this error when I 
$ emacsclient -c examples.desktop 
emacsclient: can't find socket; have you started the server?
To start the server in Emacs, type "M-x server-start".
emacsclient: error executing alternate editor "emacs -Q"

Thank you for any help.

to...@tuxteam.de

unread,
Nov 26, 2009, 3:58:03 AM11/26/09
to n179911, help-gn...@gnu.org
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, Nov 26, 2009 at 12:35:09AM -0800, n179911 wrote:
> I tried following this, I want emacs daemon starts/kills automatically:
> http://www.emacswiki.org/emacs/emacsd, which I did this (as root).

Meh. This init script is nice and all -- but so un-unixy that I want to
cry ;-)

>
> 1. cp emacsd /etc/init.d/
> 2. chmod 755 /etc/init.d/emacsd
> 3. update-rc.d emacsd defaults

Did you copy it as-is? Then you'd have to make sure that you are user
1000 on the system.

You can find out by typing the command id into a shell.

> But I still get this error when I
> $ emacsclient -c examples.desktop
> emacsclient: can't find socket; have you started the server?
> To start the server in Emacs, type "M-x server-start".
> emacsclient: error executing alternate editor "emacs -Q"

As already stated, you have to provide emacsclient with a file which

(a) gives it a hint on how to contact the server
(b) gives it the authority to do so.

Typically, the server makes this file at start.

What's in this "example.desktop" file?

Basically, I think it's not a good idea to start the server from init.d
- -- it's a user thing, so it should be started on user session.

Regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFLDkMbBcgs9XrR2kYRAt7KAJ0cjuXzSzX1o4vTowLxISUNTTJA/ACdHe0h
qH/QRTeBQyu4cRyC4pQN5nI=
=7K/3
-----END PGP SIGNATURE-----


n179911

unread,
Nov 26, 2009, 1:09:13 PM11/26/09
to to...@tuxteam.de, help-gn...@gnu.org
On Thu, Nov 26, 2009 at 12:58 AM, <to...@tuxteam.de> wrote:

Basically, I think it's not a good idea to start the server from init.d
- -- it's a user thing, so it should be started on user session.

Thank you. Tomas.

How can I unstall the script? 
>    1. cp emacsd /etc/init.d/
>    2. chmod 755 /etc/init.d/emacsd
>    3. update-rc.d emacsd defaults

I did the last step 'update-rc.d', how can I reverse the change done by that 'update-rc.d' script?

Thank you.

Richard Riley

unread,
Nov 26, 2009, 1:35:59 PM11/26/09
to help-gn...@gnu.org
to...@tuxteam.de writes:

> On Wed, Nov 25, 2009 at 03:06:36PM -0800, n179911 wrote:
>> Hi,
>> I read this follow wiki entry trying to install emacs server on ubuntu:
>> http://www.emacswiki.org/emacs/EmacsClient#toc5
>>
>> I have download the following script and cp it to /etc/init.d/emacsd
>> http://www.emacswiki.org/emacs/EmacsdInitScript
>>
>> And I restart my ubuntu, and I run 'emacsclient'.
>> I still get:
>> $ emacsclient
>> emacsclient: file name or argument required
>> Try `emacsclient --help' for more information
>
> Well? Did you try ;-)
>
> Thing is that the client needs a cookie file to know "where" the server
> is (and to show the server that it's allowed to). So, provided this
> server is running, it has put this cookie file somewhere (typically in
> your home dir, in emacs.d/server/server). I don't know how Ubuntu
> customizes this in partticular.

By far the easiest, and oft overlooked, method to start the server is to
use the alternative-editor parameter. My EDITOR env is ~/bin/edit where
"edit" is the following simply bash script:

,----
| #!/bin/bash
| # edit
| export GDK_NATIVE_WINDOWS=1
| exec emacsclient --alternate-editor="" -c "$@"
`----

emacsclient will start the daemon if it's not already started.


Sven Bretfeld

unread,
Nov 26, 2009, 3:50:49 PM11/26/09
to n179911, help-gn...@gnu.org
Hi

n179911 <n17...@gmail.com> writes:

> I have download the following script and cp it to /etc/init.d/emacsd
> http://www.emacswiki.org/emacs/EmacsdInitScript

I really don't see the advantage of this script. I've also tried it
once. I merely start the daemon once I log in with 'emacs --daemon'
under Ubuntu Karmic, and that's it. You can also let that command be
executed by an auto-start script under Gnome, KDE or whatever. Once the
daemon is started, you can do 'emacsclient -c' either by using alt-F2 or
with a prepared icon.

By the way, under Ubuntu you have to take care that you start the
correct version of the client fitting to the version of the server,
since you might have more than one Emacs version installed (emacs22,
emacs23 and emacs-snapshot are available in the standard repo). In case
you have, you should start daemon and client with 'emacs.emacs-snapshot
--daemon' etc.

Good luck

Sven


Richard Riley

unread,
Nov 26, 2009, 4:14:50 PM11/26/09
to help-gn...@gnu.org
"Sven Bretfeld" <sven.b...@gmx.ch> writes:

Alternatively use update-alternatives

>
> Good luck
>
> Sven
>

--

to...@tuxteam.de

unread,
Nov 27, 2009, 12:29:33 AM11/27/09
to n179911, help-gn...@gnu.org
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

With 'update-rc.d' itself: just type

update-rc.d emacsd remove

Note that it won't delete the script in /etc/init.d/emacsd. It will set
up things so that in won't be called at start/stop of the system.

(You can learn such things by invoking the manual page of update-rc.d:
just type at a terminal window: "man update-rc.d").

Did you investigate the other avenues? Do you now know why it didn't
work?

Regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFLD2O9Bcgs9XrR2kYRAmXQAJ9K+gD5yuFNVweTLZ064e6SrbHjsgCff6lE
33/6jTBv3AmC3EjxU98lJlo=
=PjMV
-----END PGP SIGNATURE-----


n179911

unread,
Nov 28, 2009, 3:34:36 AM11/28/09
to to...@tuxteam.de, help-gn...@gnu.org
Thank you Tomas.

I use this way, which works for me:

My EDITOR env is ~/bin/edit where
"edit" is the following simply bash script:

,----
| #!/bin/bash
| # edit
| export GDK_NATIVE_WINDOWS=1
| exec emacsclient --alternate-editor="" -c "$@"
`----

emacsclient will start the daemon if it's not already started.


to...@tuxteam.de

unread,
Nov 28, 2009, 6:16:28 AM11/28/09
to n179911, help-gn...@gnu.org
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sat, Nov 28, 2009 at 12:34:36AM -0800, n179911 wrote:
> Thank you Tomas.
>
> I use this way, which works for me:
>
> My EDITOR env is ~/bin/edit where
> "edit" is the following simply bash script:

[...]

> emacsclient will start the daemon if it's not already started.

Yes, to me this makes much more sense than starting in /etc/init.d.

Alternatively, if you want to be spared the waiting time for the first
invocation, you could do the server-starting business at the start of
your "session" (i.e. when your desktop environment is started or on your
(first) login shell).

Regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFLEQaMBcgs9XrR2kYRAqfuAJ9hYNYWLBUU7rYLxDy8f2rCMiLJlgCggYk/
GtvKuj0c8Q3xQv+ZHlgKFVM=
=5rk7
-----END PGP SIGNATURE-----


0 new messages