Subject: bug#37826: Very annoying autoraise client/server behavior with -t option

From: Carlos Pita <[email-masked]>
Date: Sat, 19 Oct 2019 17:46:26 -0300

In client/server mode, if I have a focused client open in a X frame
and then focus a terminal and open a file in that tty in a second
emacs client, the X client is automatically raised and focused (more
precisely, I just get an "emacs is ready" notification because of
gnome/mutter focus stealing prevention). I can go back and forth
between the two clients producing the same effect as many times as
desired.

I understand why this is happening. In server-visit-files:

(let* ((minibuffer-auto-raise (or server-raise-frame
  minibuffer-auto-raise))
...
  (set-buffer (find-file-noselect filen))
...

The problem is that if, for example, I open a bash shell in the tty
buffer, I get a message like "Indentation setup for shell type bash"
in the X minibuffer, so the X frame is autoraised. There are a couple
of issues mixed here, I believe:

1. Maybe the scope of minibuffer-auto-raise = t should be restricted
to the revert/write operations so that focus is not stolen because of
any "accidental" little message.

2. The "Indentation setup for shell type bash" message clearly belongs
to the tty frame but somehow is showing in the other frame. This seems
harder to fix but I'm going to investigate it.

Best regards
--
Carlos