From: Lars Ingebrigtsen <larsi@gnus.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 15469@debbugs.gnu.org, andersk@MIT.EDU
Subject: bug#15469: 24.3; emacsclient -c fails to grab focus when asking “Revert buffer from file?”
Date: Sun, 06 Dec 2020 17:14:45 +0100 [thread overview]
Message-ID: <87o8j67vyi.fsf@gnus.org> (raw)
In-Reply-To: <83pn3maprb.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 06 Dec 2020 18:00:24 +0200")
Eli Zaretskii <eliz@gnu.org> writes:
>> > We ask the question before we switch to the new frame, so I guess the
>> > question appears in the previous frame?
>>
>> No, it appears in the new frame.
>
> OK, but still: we raise the frame only when we are done, right?
Yes. I instrumented raise-frame, and it was indeed called after I
answered "yes" to the "revert" question:
Debugger entered--entering a function:
* raise-frame(#<frame *Minibuf-1* 0x5652caf5a498>)
select-frame-set-input-focus(#<frame *Minibuf-1* 0x5652caf5a498>)
server-switch-buffer(#<buffer foo> nil nil #<frame *Minibuf-1* 0x5652caf5a498>)
server-execute(#<process server <2>> (("/tmp/foo")) nil nil t #<frame *Minibuf-1* 0x5652caf5a498> window-system)
#f(compiled-function () #<bytecode -0x1de923e1af168e73>)()
server-execute-continuation(#<process server <2>>)
server-process-filter(#<process server <2>> "-env SHELL=/bin/bash -env SESSION_MANAGER=local/xo...")
So just raising the frame before we process the buffers seems to fix the
problem for me.
Comments?
diff --git a/lisp/server.el b/lisp/server.el
index 2fd94552dd..aa7297ba48 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -1328,6 +1328,8 @@ server-execute
;; inhibit-quit flag, which is good since `commands' (as well as
;; find-file-noselect via the major-mode) can run arbitrary code,
;; including code that needs to wait.
+ (when (and frame server-raise-frame)
+ (select-frame-set-input-focus frame))
(with-local-quit
(condition-case err
(let ((buffers (server-visit-files files proc nowait)))
@@ -1676,9 +1678,7 @@ server-switch-buffer
(switch-to-buffer next-buffer))
;; After all the above, we might still have ended up with
;; a minibuffer/dedicated-window (if there's no other).
- (error (pop-to-buffer next-buffer)))))))
- (when server-raise-frame
- (select-frame-set-input-focus (window-frame)))))
+ (error (pop-to-buffer next-buffer)))))))))
;;;###autoload
(defun server-save-buffers-kill-terminal (arg)
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
next prev parent reply other threads:[~2020-12-06 16:14 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-27 0:01 bug#15469: 24.3; emacsclient -c fails to grab focus when asking “Revert buffer from file?” Anders Kaseorg
2020-12-06 15:27 ` Lars Ingebrigtsen
2020-12-06 15:32 ` Eli Zaretskii
2020-12-06 15:44 ` Lars Ingebrigtsen
2020-12-06 16:00 ` Eli Zaretskii
2020-12-06 16:14 ` Lars Ingebrigtsen [this message]
2020-12-06 16:51 ` Eli Zaretskii
2020-12-07 13:31 ` Lars Ingebrigtsen
2020-12-23 5:59 ` Lars Ingebrigtsen
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87o8j67vyi.fsf@gnus.org \
--to=larsi@gnus.org \
--cc=15469@debbugs.gnu.org \
--cc=andersk@MIT.EDU \
--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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.