all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: help-gnu-emacs@gnu.org
Subject: Re: closing emacsclient always focuses another emacs window
Date: Mon, 10 Mar 2014 05:30:42 +0100	[thread overview]
Message-ID: <87wqg28ykt.fsf@web.de> (raw)
In-Reply-To: 831tyapvp6.fsf@gnu.org

Eli Zaretskii <eliz@gnu.org> writes:

> Not sure, because it doesn't match what we see.  Could be.

I think I found something which I hope could explain the confusion.

When the OP hits C-x #, this is executed in `server-edit':

    (apply 'server-switch-buffer (server-done))

`server-done' returns a list (nil ...), so this code at the beginning of
`server-switch-buffer' is executed:

(if (null next-buffer)
      (progn
	(let ((rest server-clients))
	  (while (and rest (not next-buffer))
	    (let ((proc (car rest)))
	      ;; Only look at frameless clients, or those in the selected
	      ;; frame.
	      (when (or (not (process-get proc 'frame))
			(eq (process-get proc 'frame) (selected-frame)))
		(setq next-buffer (car (process-get proc 'buffers))))
	      (setq rest (cdr rest)))))
	(and next-buffer (server-switch-buffer next-buffer killed-one))
	(unless (or next-buffer killed-one (window-dedicated-p))
	  ;; (switch-to-buffer (other-buffer))
	  (message "No server buffers remain to edit"))) ...

It seems that (selected-frame) is intended to "mean" the frame focused
when we hit C-x #.  But note that evaluating the argument (server-done)
has the side effect of deleting that frame.  Under the right
circumstances, the selected frame now can be any frame, including the
other emacsclient frame.  In this case, `next-buffer' will be set and
the newly selected frame will be focused by the recursive call of
`server-switch-buffer'.


Regards,

Michael.




  reply	other threads:[~2014-03-10  4:30 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-06 19:22 closing emacsclient always focuses another emacs window trygve.flathen
2014-03-06 19:28 ` trygve.flathen
2014-03-06 22:11 ` Gregor Zattler
2014-03-07 12:02   ` lee
2014-03-07 14:15     ` Gregor Zattler
2014-03-07 15:28       ` lee
     [not found] ` <mailman.16651.1394143948.10748.help-gnu-emacs@gnu.org>
2014-03-07 18:24   ` trygve.flathen
2014-03-07 18:31     ` Gregor Zattler
     [not found]     ` <mailman.16685.1394217122.10748.help-gnu-emacs@gnu.org>
2014-03-08 13:18       ` trygve.flathen
2014-03-08 13:26         ` Eli Zaretskii
2014-03-08 14:30           ` Yuri Khan
2014-03-08 15:04             ` Eli Zaretskii
2014-03-08 17:45               ` Michael Heerdegen
2014-03-08 17:57                 ` Eli Zaretskii
2014-03-08 21:55                   ` Michael Heerdegen
2014-03-08 23:18                     ` Michael Heerdegen
2014-03-09  0:30                       ` Michael Heerdegen
     [not found]               ` <mailman.16740.1394300785.10748.help-gnu-emacs@gnu.org>
2014-03-08 18:42                 ` trygve.flathen
2014-03-09  0:44                   ` Michael Heerdegen
     [not found]                   ` <mailman.16766.1394325871.10748.help-gnu-emacs@gnu.org>
2014-03-09 18:22                     ` trygve.flathen
2014-03-09 18:54                       ` Michael Heerdegen
     [not found]                       ` <mailman.16808.1394391268.10748.help-gnu-emacs@gnu.org>
2014-03-09 19:50                         ` trygve.flathen
2014-03-09 21:36                           ` Michael Heerdegen
2014-03-10  3:40                             ` Eli Zaretskii
2014-03-10  4:30                               ` Michael Heerdegen [this message]
2014-03-10  5:00                                 ` Michael Heerdegen
2014-03-10 16:27                                 ` Eli Zaretskii
2014-03-10 19:40                                   ` Michael Heerdegen
2014-03-10 20:03                                     ` Eli Zaretskii
2014-03-10 20:29                                       ` Eli Zaretskii
2014-03-10 22:11                                         ` Michael Heerdegen
2014-03-10 23:06                                           ` Michael Heerdegen
2014-03-11  4:25                                             ` Michael Heerdegen
2014-03-11 17:23                                               ` Eli Zaretskii
2014-03-12  0:31                                                 ` Michael Heerdegen
     [not found]                                                 ` <mailman.17005.1394584349.10748.help-gnu-emacs@gnu.org>
2014-03-12 17:58                                                   ` trygve.flathen
2014-03-13  7:57                                                     ` Michael Heerdegen
2014-03-26 23:57                                                       ` Michael Heerdegen
     [not found]                                               ` <mailman.16982.1394558617.10748.help-gnu-emacs@gnu.org>
2014-03-12 17:49                                                 ` trygve.flathen
2014-03-10  2:40                           ` Michael Heerdegen
     [not found]                           ` <mailman.16841.1394419242.10748.help-gnu-emacs@gnu.org>
2014-03-10 22:18                             ` trygve.flathen
2014-03-10 22:34                               ` Michael Heerdegen
2014-03-10 22:48                               ` Michael Heerdegen
     [not found]             ` <mailman.16731.1394291075.10748.help-gnu-emacs@gnu.org>
2014-03-08 15:53               ` Dan Espen
2014-03-08 17:28                 ` Eli Zaretskii
     [not found]         ` <mailman.16729.1394285215.10748.help-gnu-emacs@gnu.org>
2014-03-08 15:58           ` trygve.flathen
2014-03-08 17:38             ` Eli Zaretskii
2014-03-08 17:54               ` Eli Zaretskii
     [not found]               ` <mailman.16742.1394301274.10748.help-gnu-emacs@gnu.org>
2014-03-08 18:49                 ` trygve.flathen
     [not found]             ` <mailman.16739.1394300339.10748.help-gnu-emacs@gnu.org>
2014-03-08 19:06               ` trygve.flathen
2014-03-08 19:37                 ` 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

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

  git send-email \
    --in-reply-to=87wqg28ykt.fsf@web.de \
    --to=michael_heerdegen@web.de \
    --cc=help-gnu-emacs@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.