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

From: Tassilo Horn <[email-masked]>
Date: Fri, 17 Apr 2015 16:13:20 +0200

Iñaki García Etxebarria <[email-masked]> writes:

Hi Iñaki,

> 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?

Yes, it is.

,----[ C-h v display-buffer-reuse-frames RET ]
| display-buffer-reuse-frames is a variable defined in `window.el'.
| Its value is nil
| 
|   This variable is obsolete since 24.3;
|   use a `reusable-frames' alist entry in `display-buffer-alist'.
| 
| Documentation:
| Non-nil means `display-buffer' should reuse frames.
| If the buffer in question is already displayed in a frame, raise
| that frame.
| 
| You can customize this variable.
| 
| This variable was introduced, or its default value was changed, in
| version 21.1 of Emacs.
`----

,----[ C-h v display-buffer-alist RET ]
| display-buffer-alist is a variable defined in `window.el'.
| Its value is nil
| 
|   This variable may be risky if used as a file-local variable.
| 
| Documentation:
| Alist of conditional actions for `display-buffer'.
| This is a list of elements (CONDITION . ACTION), where:
| 
|  CONDITION is either a regexp matching buffer names, or a
|   function that takes two arguments - a buffer name and the
|   ACTION argument of `display-buffer' - and returns a boolean.
| 
|  ACTION is a cons cell (FUNCTION . ALIST), where FUNCTION is a
|   function or a list of functions.  Each such function should
|   accept two arguments: a buffer to display and an alist of the
|   same form as ALIST.  See `display-buffer' for details.
| 
| `display-buffer' scans this alist until it either finds a
| matching regular expression or the function specified by a
| condition returns non-nil.  In any of these cases, it adds the
| associated action to the list of actions it will try.
| 
| You can customize this variable.
| 
| This variable was introduced, or its default value was changed, in
| version 24.1 of Emacs.
`----

Wow, quite complex.  But I think this is the value you want:

  (setq display-buffer-alist
        '((".*" . (display-buffer-reuse-window . ((reusable-frames . visible))))))

Tested only briefly, though.

Bye,
Tassilo