Subject: bug#4702: 23.1.50; named frame switching in terminal + emacsclient

From: Jose Antonio Ortega Ruiz <[email-masked]>
Date: Mon, 12 Oct 2009 00:48:15 +0200

There seem to be several situations where, if one has more than one
frame in a terminal-based emacs session and opens another one in a
different terminal, the frame selected in the first terminal changes as
a consequence. 

You can reproce the effect in a simple way:

 (0) emacs -nw -Q -daemon
 (1) open a new terminal and execute `emacsclient -t' (you're in frame F2)
 (2) eval (make-frame '((name . "test"))) (you're still in frame F2)
 (3) open a *second* xterm and `emacsclient -t' in it
 (4) the frame focused in the first terminal (opened at (1)) is now in
     frame "test", instead of F2

The frame jump does *not* happen if the frame you create in step (2) has
no name parameter (i.e. Fn is assigned by `make-frame'
internally). These frame jumps happen in other situations, but they're
difficult to reproduce; they always involve some activity by a second
emacsclient, and always have an explicitly name frame as
destination. Also, sometimes they're provoked also by calls of the form
`emacsclient -e <exp>', instead of -t as in (3), but not in this simple
case.

Thanks!

In GNU Emacs 23.1.50.1 (i486-pc-linux-gnu, GTK+ Version 2.18.2)
 of 2009-10-10 on elegiac, modified by Debian
 (emacs-snapshot package, version 1:20091010-1)
configured using `configure  '--build' 'i486-linux-gnu' '--host' 'i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/23.1.50/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.1.50/site-lisp:/usr/share/emacs/site-lisp' '--with-x=yes' '--with-x-toolkit=gtk' 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -DSITELOAD_PURESIZE_EXTRA=5000 -g -O2' 'LDFLAGS=-g -Wl,--as-needed' 'CPPFLAGS=''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
( m a k e - f r a m ESC TAB ESC TAB SPC C-b C-b C-h 
f RET SPC DEL C-e ' ( ( n a m e SPC . SPC " t e s t 
" ) ) ) C-j C-x 1 <switch-frame> C-x 5 o C-x b RET 
<switch-frame> C-n C-p <switch-frame> C-x 5 0 C-x 5 
2 C-x 5 o C-x b RET <switch-frame> C-p C-n C-p C-p 
C-x 5 0 <switch-frame> C-x 5 0 <switch-frame> C-x 5 
0 C-p C-p C-x 5 0 C-x 5 2 ( s e t - f r a m e - n ESC 
TAB SPC " t e s t " ) C-j C-x 5 0 C-x b m e s RET <switch-frame> 
C-x 5 C-g <switch-frame> C-p C-n C-n C-p C-p <switch-frame> 
C-x 5 o C-x 5 o <switch-frame> C-x 5 0 C-x b s DEL 
RET ESC x o t h e r - f r a TAB RET C-x 5 o C-x 5 o 
C-p C-k C-p C-e C-x 5 2 C-j C-x 5 o C-x b m e s RET 
C-x 5 o C-x 5 o <switch-frame> ESC x r e m p o r TAB 
DEL DEL DEL DEL p o r TAB RET

Recent messages:
("emacs")
Starting Emacs daemon.
When done with this frame, type C-x 5 0
Making completion list...
Complete, but not unique
Type C-x 4 C-o RET to restore the other window, C-M-v to scroll help.
When done with this frame, type C-x 5 0 [5 times]

Load-path shadows:
/usr/share/emacs/23.1.50/site-lisp/debian-startup hides /usr/share/emacs/site-lisp/debian-startup
/usr/share/emacs/23.1.50/site-lisp/ruby1.8-elisp/ruby-mode hides /usr/share/emacs/23.1.50/lisp/progmodes/ruby-mode

Features:
(shadow mail-extr message ecomplete rfc822 mml mml-sec password-cache
mm-decode mm-bodies mm-encode mailcap mail-parse rfc2231 rfc2047 rfc2045
qp ietf-drums mailabbrev nnheader gnus-util netrc mm-util mail-prsvr
gmm-utils wid-edit mailheader canlock sha1 hex-util hashcash mail-utils
emacsbug sendmail regexp-opt help-fns pp time-date time help-mode
easymenu view server tooltip ediff-hook vc-hooks lisp-float-type mwheel
x-win x-dnd tool-bar dnd fontset image fringe lisp-mode register page
menu-bar rfn-eshadow timer select scroll-bar mldrag mouse jit-lock
font-lock syntax facemenu font-core frame cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew
greek romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev loaddefs button
minibuffer faces cus-face text-properties overlay md5 base64 format env
code-pages mule custom widget hashtable-print-readable backquote
make-network-process dbusbind gtk x-toolkit x multi-tty emacs)