Subject: Re: bug#20340: 11.88; Evince reverse search opens buffer in all frames

From: Tassilo Horn <[email-masked]>
Date: Thu, 16 Apr 2015 21:58:08 +0200

Inaki Garcia Etxebarria <[email-masked]> writes:

Hi Inaki,

> I removed my .emacs and .emacs.d, upgraded to the latest version in
> ELPA (11.88.4), and for me it still opens the file in all windows
> (although it is now a bit better, in that the opened file only takes
> half the emacs window).

BTW, what confused me a bit is your wording.  Emacs calls the WM
windows, i.e., the things with the menu/tool-bar and window decorations
"frames".  Windows in emacs are the panes that display a buffer which
you can split with C-x 2 and C-x 3.

So your problem is that after clicking in Evince, all (single) windows
of your two emacs frames show the buffer of the tex file from which the
pdf was generated.

> I made some screenshots to show better what happens: In
> https://www.mpp.mpg.de/~inaki/auctex1.png I opened a couple of tex
> files (draft5.tex and BC-O5.tex), and the pdf corresponding to one of
> them (draft5.pdf). Then I Ctrl+Clicked in evince, getting the results
> in https://www.mpp.mpg.de/~inaki/auctex2.png As you can see,
> draft5.tex got opened in the window for BC-O5.tex too, which is not
> what I intended.

Ah, what a luck that you included the terminal window in the screenshot!
Now I know what the problem is.

You fire up two emacs instances, i.e., two completely separate emacs
processes.  When Evince sends the SyncSource signal via DBUS, both emacs
processe will receive it and act accordingly, i.e., pop to the
corresponding tex buffer.

There is no (simple) way that these two separate emacs processes could
talk to each other in order to negotiate which one should open the file.

Since a few years, one single emacs process can have arbitrarily frames
no matter if graphical or tty frames.  You start emacs once, and when
you want to, you can open another frame using `C-x 5 2'.  Then use one
frame for document1, the other for document2, yet another one for
document3.

And then, because there is only one single emacs process, inverse search
with Evince will magically work. :-)

This one emacs, many frames thingy is documented in

  (info "(emacs)Emacs Server")

Bye,
Tassilo (Embeddings for the non-toric Pezzo singularities, what?!?) :-)