unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Carlos Pita <carlosjosepita@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 37826@debbugs.gnu.org
Subject: bug#37826: Very annoying autoraise client/server behavior with -t option
Date: Mon, 21 Oct 2019 05:58:13 -0300	[thread overview]
Message-ID: <CAELgYhec5y8zRB_8u3+aKPWCuTJ5q6oxeSfOdD9LaGWBh3k0PQ@mail.gmail.com> (raw)
In-Reply-To: <83tv84540m.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 740 bytes --]

> We prefer to avoid both unpleasant effects.  But if there's no way to
> solve both, I think we prefer the former, because visiting a file in a
> way that causes an echo-area message is relatively rare.

Here is a patch that narrows the scope of minibuffer-auto-raise to
write/revert actions that require user intervention.

Short of a more selective auto-raise mechanism, I believe this is
preferable to raising and focusing a frame when creating a new one
just because of random uninteresting messages.

Moreover, if the user has explicitly set minibuffer-auto-raise, the
scope won't be narrowed at all. So I think it's safe to reduce its
scope a bit when the user has not even signalled interest by toggling
minibuffer-auto-raise to t.

[-- Attachment #2: 0001-Avoid-autoraising-frame-when-tty-client-is-run-Bug-3.patch --]
[-- Type: text/x-patch, Size: 2204 bytes --]

From 0a80b3c71ac52829bc89036f070f1fb5632ea889 Mon Sep 17 00:00:00 2001
From: memeplex <carlosjosepita@gmail.com>
Date: Mon, 21 Oct 2019 05:12:48 -0300
Subject: [PATCH] Avoid autoraising frame when tty client is run (Bug#37826)

* lisp/server.el (server-visit-files): Narrow scope of minibuffer-auto-rise.
---
 lisp/server.el | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/lisp/server.el b/lisp/server.el
index 45fa55ad6b..46c76895e9 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -1397,9 +1397,7 @@ server-visit-files
 	;; If there is an existing buffer modified or the file is
 	;; modified, revert it.  If there is an existing buffer with
 	;; deleted file, offer to write it.
-	(let* ((minibuffer-auto-raise (or server-raise-frame
-					  minibuffer-auto-raise))
-	       (filen (car file))
+	(let* ((filen (car file))
 	       (obuf (get-file-buffer filen)))
 	  (add-to-history 'file-name-history filen)
 	  (if (null obuf)
@@ -1410,14 +1408,16 @@ server-visit-files
 	    ;; separately for each file, in sync with post-command hooks,
 	    ;; with the new buffer current:
 	    (run-hooks 'pre-command-hook)
-            (cond ((file-exists-p filen)
-                   (when (not (verify-visited-file-modtime obuf))
-                     (revert-buffer t nil)))
-                  (t
-                   (when (y-or-n-p
-                          (concat "File no longer exists: " filen
-                                  ", write buffer to file? "))
-                     (write-file filen))))
+	    (let ((minibuffer-auto-raise (or server-raise-frame
+					     minibuffer-auto-raise)))
+              (cond ((file-exists-p filen)
+                     (when (not (verify-visited-file-modtime obuf))
+                       (revert-buffer t nil)))
+                    (t
+                     (when (y-or-n-p
+                            (concat "File no longer exists: " filen
+                                    ", write buffer to file? "))
+                       (write-file filen)))))
             (unless server-buffer-clients
               (setq server-existing-buffer t)))
           (server-goto-line-column (cdr file))
-- 
2.20.1


  reply	other threads:[~2019-10-21  8:58 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-19 20:46 bug#37826: Very annoying autoraise client/server behavior with -t option Carlos Pita
2019-10-19 21:39 ` Carlos Pita
2019-10-20  6:23   ` Eli Zaretskii
2019-10-21  8:58     ` Carlos Pita [this message]
2019-10-21 10:22       ` Eli Zaretskii
2019-10-21 13:37         ` Carlos Pita
2019-10-21 13:53           ` Eli Zaretskii
2019-10-21 14:18             ` Carlos Pita
2019-10-21 14:52               ` Carlos Pita
2019-10-21 15:13                 ` Carlos Pita
2019-10-21 16:19                 ` Eli Zaretskii
2019-10-21 16:13               ` Eli Zaretskii
2019-10-21 16:21                 ` Carlos Pita
2019-10-21 16:33                   ` Carlos Pita
2019-10-21 16:39                     ` Eli Zaretskii
2019-10-21 16:37                   ` Eli Zaretskii
2019-10-21 15:56             ` Juanma Barranquero
2019-10-21 16:26               ` Eli Zaretskii
2019-10-21 17:02                 ` Juanma Barranquero
2019-10-21 17:13                   ` Eli Zaretskii
2019-10-21 18:40                     ` Carlos Pita
2019-10-21 20:14                       ` Carlos Pita
2019-10-26 10:57                         ` Eli Zaretskii
2019-10-26 15:53                           ` Carlos Pita
2019-10-26 19:02                             ` Eli Zaretskii
2019-10-26 20:27                               ` Carlos Pita
2019-10-27  5:22                                 ` Eli Zaretskii
2019-10-27  5:45                                   ` Carlos Pita
2019-10-27  6:02                                     ` Eli Zaretskii
2019-10-27 15:04                                       ` Carlos Pita
2019-10-27 15:31                                         ` Eli Zaretskii
2019-10-27 16:31                                           ` Carlos Pita
2019-10-27 16:36                                             ` Eli Zaretskii
2019-10-27 17:02                                               ` Carlos Pita
2019-10-27 17:09                                                 ` Eli Zaretskii
2019-10-27 17:19                                                   ` Carlos Pita
2019-10-27 17:50                                                     ` Eli Zaretskii
2019-11-07 17:23                                                       ` Eli Zaretskii
2020-08-09 16:12                                                         ` Lars Ingebrigtsen
2020-08-09 17:16                                                           ` Eli Zaretskii
2020-08-09 17:26                                                             ` Lars Ingebrigtsen
2019-10-22 14:46                     ` Juanma Barranquero
2019-10-21 13:55           ` Carlos Pita
2019-10-21 13:58             ` Eli Zaretskii
2019-10-20  5:55 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAELgYhec5y8zRB_8u3+aKPWCuTJ5q6oxeSfOdD9LaGWBh3k0PQ@mail.gmail.com \
    --to=carlosjosepita@gmail.com \
    --cc=37826@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).