From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#37826: Very annoying autoraise client/server behavior with -t option Date: Sun, 27 Oct 2019 07:22:20 +0200 Message-ID: <834kzuu5ir.fsf@gnu.org> References: <83tv84540m.fsf@gnu.org> <83v9si2y9u.fsf@gnu.org> <83a79u2oih.fsf@gnu.org> <83y2xe12ut.fsf@gnu.org> <83r23610oc.fsf@gnu.org> <83ftjfvkov.fsf@gnu.org> <83imobtjnc.fsf@gnu.org> Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="77991"; mail-complaints-to="usenet@blaine.gmane.org" Cc: lekktu@gmail.com, 37826@debbugs.gnu.org To: Carlos Pita Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Oct 27 06:23:11 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iOb1D-000K8U-Gc for geb-bug-gnu-emacs@m.gmane.org; Sun, 27 Oct 2019 06:23:11 +0100 Original-Received: from localhost ([::1]:44100 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iOb1B-0006jU-OX for geb-bug-gnu-emacs@m.gmane.org; Sun, 27 Oct 2019 01:23:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58861) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iOb15-0006j4-9A for bug-gnu-emacs@gnu.org; Sun, 27 Oct 2019 01:23:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iOb14-0000uQ-Am for bug-gnu-emacs@gnu.org; Sun, 27 Oct 2019 01:23:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:32788) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iOb14-0000uI-7Y for bug-gnu-emacs@gnu.org; Sun, 27 Oct 2019 01:23:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iOb14-0005nU-1x for bug-gnu-emacs@gnu.org; Sun, 27 Oct 2019 01:23:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 27 Oct 2019 05:23:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37826 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 37826-submit@debbugs.gnu.org id=B37826.157215375622235 (code B ref 37826); Sun, 27 Oct 2019 05:23:01 +0000 Original-Received: (at 37826) by debbugs.gnu.org; 27 Oct 2019 05:22:36 +0000 Original-Received: from localhost ([127.0.0.1]:41609 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iOb0e-0005mZ-71 for submit@debbugs.gnu.org; Sun, 27 Oct 2019 01:22:36 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:49781) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iOb0c-0005mL-EK for 37826@debbugs.gnu.org; Sun, 27 Oct 2019 01:22:34 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:51742) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iOb0X-0000ik-B0; Sun, 27 Oct 2019 01:22:29 -0400 Original-Received: from [176.228.60.248] (port=3262 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iOb0W-0004MX-Q6; Sun, 27 Oct 2019 01:22:29 -0400 In-reply-to: (message from Carlos Pita on Sat, 26 Oct 2019 17:27:02 -0300) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:170230 Archived-At: > From: Carlos Pita > Date: Sat, 26 Oct 2019 17:27:02 -0300 > Cc: Juanma Barranquero , 37826@debbugs.gnu.org > > Only if minibuffer-auto-rise is also nil: > > (let* ((minibuffer-auto-raise (or server-raise-frame minibuffer-auto-raise)) Yes, but minibuffer-auto-raise is nil by default. > Anyway, I want the frame to be raised when it's switched to, just not > another frame and specially not because of barely relevant messages. I understand. So here's an idea. Does the following change work for you in your original scenario? diff --git a/lisp/server.el b/lisp/server.el index 45fa55a..b23fdc4 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -1405,7 +1405,9 @@ server-visit-files (if (null obuf) (progn (run-hooks 'pre-command-hook) - (set-buffer (find-file-noselect filen))) + (set-buffer + (let (minibuffer-auto-raise) + (find-file-noselect filen)))) (set-buffer obuf) ;; separately for each file, in sync with post-command hooks, ;; with the new buffer current: If this works, then can you test this in several situations different from yours, including: . invoking emacsclient without -t when there's a GUI client frame that is iconified . an existing client frame is visible (not iconified) . visiting a file that is already visited and maybe others, and see if the message displayed by shell-script-mode appears as expected, and causes the right frame to be raised (if needed)? (It might be that in some of these situations we need to avoid binding minibuffer-auto-raise to nil, in which case server-visit-files will need some additional logic or an additional argument to discern between them.) Thanks.