# Emacs hangs up X11



## multix (Aug 8, 2012)

Hi,

after running *portupgrade -ay*, I find that emacs, which was updated, hangs up my X11 when I start it. It receives no more keyboard or mouse input (clicks, although the mouse moves) until I kill emacs by logging into another shell or having telnet open.

The installed version of emacs is:

```
emacs-24.1.50.109364,1 GNU editing macros
```

I am running:

```
FreeBSD tirith 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan  3 07:15:25 UTC 2012     root@obrian.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
```

If I start *emacs -nw* it works perfectly.

I get several output warnings, like:

```
(emacs:2537): GLib-WARNING **: In call to g_spawn_sync(), exit status of a child process was requested but SIGCHLD action was set to SIG_IGN and ECHILD was received by waitpid(), so exit status can't be returned. This is a bug in the program calling g_spawn_sync(); either don't request the exit status, or don't set the SIGCHLD action.
```
But I got those before too and Emacs did work. I get no other output.

The only strange thing I note is that while emacs is launched but frozen, PS will show:
`# ps -x | grep dbus`

```
2542  ??  Is   0:00.00 /usr/local/bin/dbus-daemon --fork --print-pid 5 --print
 2567   0  RL+  0:00.01 grep dbus
 2541   1  I+   0:00.00 dbus-launch --autolaunch=65bfd4339d47e8593bd3b21a000062
 2548   1  I+   0:00.01 dbus-launch --autolaunch=65bfd4339d47e8593bd3b21a000062
```

after I kill emacs, I only have:
`# ps -x | grep dbus`

```
2569   0  RL+  0:00.01 grep dbus
 2541   1  S    0:00.00 dbus-launch --autolaunch=65bfd4339d47e8593bd3b21a000062
```

Any suggestions? I suppose dbus is acting up? I rebuilt and reinstalled dbus, just to be sure.

Riccardo


----------



## MarcoB (Aug 8, 2012)

Looks familiair. There is a tread on the freebsd-ports mailing list about this. Don't know what the exact cause of the problems are but solutions for me were:
- Build emacs with options DBUS, GCONF and GSETTINGS turned off. After that emacs didn't lock up X anymore, but the gtk file chooser crashed emacs;
- Upgrade the base system to 9.1-PRERELEASE (= 9-STABLE), and emacs works fine. After this I build emacs again with the DBUS options turned on, and it still works ok.

Regards,
Marco


----------



## multix (Aug 8, 2012)

I hope upgrading is not a must... I suspect... I will try turning dbus support off too.


----------



## jrm@ (Aug 8, 2012)

Building emacs without dbus solved this problem for me.  If you want dbus you have to launch it properly.  For example, put the line below in ~/.xinitrc.


```
exec ck-launch-session dbus-launch --exit-with-session fluxbox
```


----------



## jrm@ (Aug 8, 2012)

This is a little off topic, but potentially helpful for those that want to reduce the port's dependencies.  If you aren't running gnome and don't want GCONF and GSETTINGS and don't require ImageMagick support (MAGICK option) you might require many fewer dependencies.  I think it was a difference of about 50 ports for me.


----------



## multix (Aug 9, 2012)

Turning DBUS and GCONF off helped me. I dont' run GNOME so it is not a big deal.

However, since before the update Emacs was running properly with those options and it launched dbus automatically, I think there is a bug.


----------

