From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.bugs Subject: bug#17111: 24.3.50; server: C-x # inconsistent and barely documented Date: Thu, 27 Mar 2014 00:47:08 +0100 Message-ID: <8761n0wmir.fsf@web.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1395877692 1828 80.91.229.3 (26 Mar 2014 23:48:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 26 Mar 2014 23:48:12 +0000 (UTC) To: 17111@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Mar 27 00:48:21 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WSxYT-0002QB-3n for geb-bug-gnu-emacs@m.gmane.org; Thu, 27 Mar 2014 00:48:21 +0100 Original-Received: from localhost ([::1]:50713 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WSxYS-0006uL-Cm for geb-bug-gnu-emacs@m.gmane.org; Wed, 26 Mar 2014 19:48:20 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46154) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WSxYH-0006tG-TO for bug-gnu-emacs@gnu.org; Wed, 26 Mar 2014 19:48:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WSxYA-0007tM-No for bug-gnu-emacs@gnu.org; Wed, 26 Mar 2014 19:48:09 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:50311) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WSxYA-0007tI-L4 for bug-gnu-emacs@gnu.org; Wed, 26 Mar 2014 19:48:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1WSxYA-0007bS-E9 for bug-gnu-emacs@gnu.org; Wed, 26 Mar 2014 19:48:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Heerdegen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 26 Mar 2014 23:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 17111 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.139587768129217 (code B ref -1); Wed, 26 Mar 2014 23:48:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 26 Mar 2014 23:48:01 +0000 Original-Received: from localhost ([127.0.0.1]:51493 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WSxY8-0007bA-Ej for submit@debbugs.gnu.org; Wed, 26 Mar 2014 19:48:00 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:44393) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WSxY5-0007az-77 for submit@debbugs.gnu.org; Wed, 26 Mar 2014 19:47:57 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WSxXx-0007sc-Kc for submit@debbugs.gnu.org; Wed, 26 Mar 2014 19:47:56 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:59018) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WSxXx-0007sY-HI for submit@debbugs.gnu.org; Wed, 26 Mar 2014 19:47:49 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46107) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WSxXr-0006oM-9W for bug-gnu-emacs@gnu.org; Wed, 26 Mar 2014 19:47:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WSxXl-0007ZV-2c for bug-gnu-emacs@gnu.org; Wed, 26 Mar 2014 19:47:43 -0400 Original-Received: from mout.web.de ([212.227.15.4]:49948) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WSxXk-0007Wg-P9 for bug-gnu-emacs@gnu.org; Wed, 26 Mar 2014 19:47:36 -0400 Original-Received: from drachen.dragon ([90.186.242.123]) by smtp.web.de (mrweb103) with ESMTPSA (Nemesis) id 0M7sw0-1XFRWY0sSm-00vQcT for ; Thu, 27 Mar 2014 00:47:34 +0100 X-Provags-ID: V03:K0:iMNmYjraIaavX18az+t5RCXyA94sIHxRZixMfzL9oGjob/lKAEd qh5+iGZPu5+XRIXwR3iUMSuwEnWIkMQTpokCk9WpBZgn3i1d2AbW+0zKmjo24mmJ+9eEWuP y1YEOdH2Vx5LsDWjPzVc8HUnHvvM/tbwxLa/gNXPq9uu0QeUSC8VjTB/CZLH2CW92o+PqHP etaddMtjiFtziTp83GNgw== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:87431 Archived-At: Hello, the doc of server-edit (bound to C-x #) says: | Switch to next server editing buffer; say "Done" for current buffer. It doesn't tell how this switching is done, and how it can be configured. There seem to be several variables that influence the behavior, e.g. `server-kill-new-buffers' or `server-raise-frame'. These, and maybe others, must be mentioned. But even with the default settings, the behavior is so wild and inconsistent that I can't even guess how this is supposed to work. Here are some examples, they all start with emacs -Q, M-x server-start, and an xterm on the desktop I use to call emacsclient. So, at the beginning I always have an xterm and one Emacs frame showing *scratch*. Example 1: In xterm I enter emacsclient -c /path/to/file A new frame showing FILE pops up. I close the other Emacs frame (showing scratch). After editing FILE, I hit C-x #. I get an error: server-delete-client: Attempt to delete the sole visible or iconified frame This error does always happen if you have only one frame with one window showing a client buffer. Example 2a: I open two files from xterm: emacsclient -c /path/to/file1 emacsclient -c /path/to/file2 The frame showing FILE2 has input focus. I hit C-x #. The frame is killed, and the frame showing FILE1 gets focus. Ok. Example 2b: The same as in a, but now, after calling emacsclient -c /path/to/file1 I "work" a bit in Emacs and create a new frame. Then I enter emacsclient -c /path/to/file2 in xterm. Once again, the frame showing FILE2 has input focus. I edit it and hit C-x #. This time, Emacs loses input focus, now the xterm is raised. Strange. Example 3: I start with emacsclient -c /path/to/file (only one file involved this time). I need to view it in dired, I hit C-x d RET. I select the other frame showing *scratch*, do some stuff, and there hit C-x #. I get the message No server buffers remain to edit That is obviously wrong. Comments: - this is all quite the same when using a daemon Emacs - in examples 2a,b, setting `server-raise-frame' to nil makes the behavior more consistent: the xterm has always focus - Note that Emacs is clearly involved in giving its frames input focus. When `server-raise-frame' is t, `server-switch-buffer' can call `select-frame-set-input-focus'. So, any window manager can't be the cause of the different behavior in 2a,b - because it's Emacs that in one case selects another frame, and doesn't do so in the other case. - The example 3 misbehavior happens because `server-switch-buffer' checks this: (when (or (not (process-get proc 'frame)) (eq (process-get proc 'frame) (selected-frame))) (setq next-buffer (car (process-get proc 'buffers)))) which is not fulfilled if (process-get proc 'frame) returns a frame, regardless of whether this frame (still) displays any client buffer or not. - the problem in example 1 is probably easy to fix I don't want to call anything here a bug too loudly, because I don't know which behavior was intended, and it's hard to guess without any doc. But server.el is probably one of the things most newbies try first with Emacs, so it would be a good advertisement if C-x # would be better documented and the behavior would be consistent. Thanks, Michael. In GNU Emacs 24.3.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.7) of 2014-03-25 on drachen Windowing system distributor `The X.Org Foundation', version 11.0.11500000 System Description: Debian GNU/Linux testing (jessie) Important settings: value of $LC_ALL: de_DE.utf8 value of $LC_COLLATE: C value of $LC_TIME: C value of $LANG: de_DE.utf8 locale-coding-system: utf-8-unix Major mode: Emacs-Lisp