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

From: Iñaki García Etxebarria <[email-masked]>
Date: Fri, 17 Apr 2015 12:10:13 +0200

Hi Tassilo,

On Thu, 2015-04-16 at 21:58 +0200, Tassilo Horn wrote:
> 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.
Right, exactly. Sorry for the wrong wording! I will try to be more
accurate below, let's see how it goes :)

> 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. :-)
Thanks for the hint! This works better, but still in a somewhat
surprising fashion at times. Again with a clean installation of AUCTeX
11.88.4 (setting "TeX-source-correlate-mode" to t in my .emacs), I
observe the following:
I run "emacs draft5.tex". Then, inside that emacs frame: "C-x 5 2". That
creates a new frame still showing draft5.tex. In that new frame, I open
"BC-tiling.tex" using the "Open File" toolbar button. I open draft5.pdf
in evince from a terminal. So far so good, this is what I see:
https://www.mpp.mpg.de/~inaki/auctex3.png

Now select (i.e. give focus in the WM) the frame showing draft5.tex. If
I Ctrl+Click in evince this frame changes to the right place, good:
https://www.mpp.mpg.de/~inaki/auctex4.png

If instead I have the frame showing BC-tiling.tex with focus, and
Ctrl+Click in evince, it is the frame showing BC-tiling.tex that reacts,
and I get the following:
https://www.mpp.mpg.de/~inaki/auctex5.png
The frame showing draft5.tex does not react at all in this case (I
scrolled a bit the position in that buffer before ctrl+clicking in
evince to make that manifest).

It seems like in this case emacs should have enough info to say
something like "if I am showing draft5.tex in some frame, just bring
that (WM) window forward, and don't touch any other frames", which is
ideal, I think. Would something like this be possible?

> Tassilo (Embeddings for the non-toric Pezzo singularities, what?!?) :-)
Sorry, using whatever I have at hand for examples :)

Thanks,
Iñaki