GNU bug report logs - #17111
24.3.50; server: C-x # inconsistent and barely documented

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: minor; Reported by: Michael Heerdegen <michael_heerdegen@HIDDEN>; dated Wed, 26 Mar 2014 23:48:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 17111 <at> debbugs.gnu.org:


Received: (at 17111) by debbugs.gnu.org; 27 Mar 2014 14:31:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 27 10:31:38 2014
Received: from localhost ([127.0.0.1]:52871 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1WTBLB-0008HD-1u
	for submit <at> debbugs.gnu.org; Thu, 27 Mar 2014 10:31:38 -0400
Received: from pruche.dit.umontreal.ca ([132.204.246.22]:44019)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <monnier@HIDDEN>) id 1WTBL3-0008Gt-Fb
 for 17111 <at> debbugs.gnu.org; Thu, 27 Mar 2014 10:31:30 -0400
Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242])
 by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id s2REVN8O005944;
 Thu, 27 Mar 2014 10:31:24 -0400
Received: by pastel.home (Postfix, from userid 20848)
 id 9421C60217; Thu, 27 Mar 2014 10:31:23 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Michael Heerdegen <michael_heerdegen@HIDDEN>
Subject: Re: bug#17111: 24.3.50;
 server: C-x # inconsistent and barely documented
Message-ID: <jwvha6jzpf4.fsf-monnier+emacsbugs@HIDDEN>
References: <8761n0wmir.fsf@HIDDEN>
Date: Thu, 27 Mar 2014 10:31:23 -0400
In-Reply-To: <8761n0wmir.fsf@HIDDEN> (Michael Heerdegen's message of "Thu, 27
 Mar 2014 00:47:08 +0100")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-NAI-Spam-Flag: NO
X-NAI-Spam-Threshold: 5
X-NAI-Spam-Score: 0
X-NAI-Spam-Rules: 1 Rules triggered
	RV4894=0
X-NAI-Spam-Version: 2.3.0.9362 : core <4894> : inlines <652> : streams
 <1145576> : uri <1711559>
X-Spam-Score: -1.7 (-)
X-Debbugs-Envelope-To: 17111
Cc: 17111 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

> 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.

IIUC the behavior was "designed" without taking into account the many
different use cases (e.g. it was designed in a single-frame context), so
there is probably no such thing as a "behavior [that] was intended" for
those cases you mention.

> 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.

I think C-x # deserves a good rethink/redesign, yes.


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#17111; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 26 Mar 2014 23:48:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 26 19:48:01 2014
Received: from localhost ([127.0.0.1]:51493 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1WSxY8-0007bA-Ej
	for submit <at> debbugs.gnu.org; Wed, 26 Mar 2014 19:48:00 -0400
Received: from eggs.gnu.org ([208.118.235.92]:44393)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1WSxY5-0007az-77
 for submit <at> debbugs.gnu.org; Wed, 26 Mar 2014 19:47:57 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1WSxXx-0007sc-Kc
 for submit <at> debbugs.gnu.org; Wed, 26 Mar 2014 19:47:56 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM
 autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:59018)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1WSxXx-0007sY-HI
 for submit <at> debbugs.gnu.org; Wed, 26 Mar 2014 19:47:49 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:46107)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1WSxXr-0006oM-9W
 for bug-gnu-emacs@HIDDEN; Wed, 26 Mar 2014 19:47:49 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1WSxXl-0007ZV-2c
 for bug-gnu-emacs@HIDDEN; Wed, 26 Mar 2014 19:47:43 -0400
Received: from mout.web.de ([212.227.15.4]:49948)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1WSxXk-0007Wg-P9
 for bug-gnu-emacs@HIDDEN; Wed, 26 Mar 2014 19:47:36 -0400
Received: from drachen.dragon ([90.186.242.123]) by smtp.web.de (mrweb103)
 with ESMTPSA (Nemesis) id 0M7sw0-1XFRWY0sSm-00vQcT for
 <bug-gnu-emacs@HIDDEN>; Thu, 27 Mar 2014 00:47:34 +0100
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 24.3.50; server: C-x # inconsistent and barely documented
Date: Thu, 27 Mar 2014 00:47:08 +0100
Message-ID: <8761n0wmir.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
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-Received-From: 2001:4830:134:3::11
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)


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





Acknowledgement sent to Michael Heerdegen <michael_heerdegen@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#17111; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.