2

I am trying to get my LaTeX View command to work properly in Emacs, but for some reason I just can make it happen.

Whenever I hit C-CC-C and enter the View command, Emacs automatically suggests TeX-evince-sync-view. However when I confirm that command, the minibuffer hangs until it eventually spits out:

D-Bus error: "Message recipient disconnected from message bus without replying"

I have tried exporting my DBUS_SESSION_BUS_ADDRESS environment variable, but if Emacs is able to connect to DBus as it seems to be (given the error message), this shouldn't be the issue. I've also had a look here and a few other pages, but I couldn't get rid of that error.

In the meantime, whenever I want to run a View command, I have to erase the default TeX-evince-sync-view and manually type in evince document.pdf which gets annoying after while. I have also tried making this other command the default View command, but no matter what I do about this, Emacs still gives me TeX-evince-sync-view every time.

A few other things:

  • I am using Emacs 25.3.1 on Arch Linux
  • My AuCTeX version is 12.1.1 (used to be 11.92.0, but nothing changed after the upgrade).
  • I don't have any View-related config in my ~/.emacs.
  • I have upgraded all my packages just in case before asking here.

Any ideas? Ideally I'd like TeX-evince-sync-view to work, but if it doesn't I'd like the simple evince command to pop up as the default.

  • Hi John. Since we're both Linux and TeX users, and you posted this, I thought you might be interested in tex.stackexchange.com/q/481892/3406. Can you reproduce this? And if so, any idea why (a) it's happening (b) ideas how to unstick dbus? – Faheem Mitha Mar 28 at 12:13
2

Some playing around with dbus-monitor got me an answer for that one after all. Apologies for being off-topic: the problem wasn't coming from Emacs.

Looking at the output, it appeared that Emacs was indeed calling an Evince DBus method for org.gnome.evince.Daemon. I actually had no idea that Evince came with a daemon (evinced) so I took the liberty of looking for it in /usr. I came across the Evince systemd user unit, which manages /usr/lib/evince/evinced.

A look at systemctl --user status evinced then gave me:

systemd: Starting Evince document viewer...
systemd: Started Evince document viewer.
evinced: Unable to init server: Could not connect: Connection refused
evinced: Cannot parse arguments: Cannot open display:

Which means that the request does indeed reach the Evince daemon, however the latter fails to connect to the Xorg display (fine, whatever), and to report its error via DBus (thanks...).

A closer look at the error will actually reveal that evinced does not have a name for the display, which is why it cannot reach it. This means the DISPLAY environment variable is not available when it starts. Indeed, if I have a look at..

$ systemctl --user show-environment

DISPLAY is nowhere to be found (same for XAUTHORITY). This can easily be fixed with one of these:

$ systemctl --user set-environment DISPLAY="$DISPLAY" XAUTHORITY="$XAUTHORITY"
$ dbus-update-activation-environment --systemd DISPLAY XAUTHORITY

depending on whether you prefer to act at the DBus or systemd level. As a matter for fact, this should be done by default when you start your X server (see /etc/X11/xinit/xinitrc.d/50-systemd-user.sh). In my case, since I wrote my own .xinitrc, that script is not run. If you use /etc/X11/xinit/xinitrc as a template for this file, then the systemd-user script will be called. In my case, I fixed the issue by adding the following to my own .xinitrc file, which is all I was missing from the template:

if [ -d /etc/X11/xinit/xinitrc.d ] ; then
    for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
        [ -x "$f" ] && . "$f"
    done
    unset f
fi

For more information, have a look here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.