Subject: 23.0.60; emacs switches focus to graphical frame when server-edit exits terminal frame

From: Gregor Zattler <[email-masked]>
Date: Wed, 21 Jan 2009 22:09:23 +0100

Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.

Your bug report will be posted to the [email-masked] mailing list.

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

When using emacs 23 in daemon mode some graphical emacs frame
gets fokus if an editing session on a terminal window which was
initiated via "emacsclient -t ..." is finished with C-x #
(server-edit).  In order to continue work in the terminal window
I have to manually switch back to the terminal window.

I checked this behaviour with two window managers: icwwm-lite and
xfce4 on a up to date debian sid system.

I consider this behaviour a bug since it is recommended emacs
usage to use one instance of emacs to edit several files in
several buffers and frames.  When exiting emacsclient should
return control to the calling application (the shell) and nothing
should happen with the windows/frames on my graphical display.
Emacs is not a window manager and should not manage windows since
it cannot know which task I want to do next.

This happens dozens of times every day, since I use to edit my
email in a terminal window while there is a graphical emacs frame
in the background of my desktop which I use for editing a org
file:
For emails I use mutt in a gnu screen session running in a
rxvt-unicode terminal window.  For editing emails I use
emacsclient with the "-t" command line option in order to edit
the email in a Text-only frame in the terminal window.  
Most of the time on my desktop there is also a graphical emacs
frame which I use with org-mode.  

When I edit a email the terminal window is on top of the emacs
graphical frame and has the fokus.  When I finish editing the
email emacsclient gives back control to mutt which happens to
show the compose menu.  In order to send the email I have to hit
the "y" key.  But before I can do so, the graphical emacs frame
with the org file swaps in front of the rxvt-unicode terminal
window and gets fokus.  In order to resume sending the email and
reading the next one I have to manually switch to the terminal
window. 

Thank you for emacs, the --daemon command line option which is
great and for your attention to this bug report.

Sincerely, Gregor

If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
If you would like to further debug the crash, please read the file
/usr/share/emacs/23.0.60/etc/DEBUG for instructions.

In GNU Emacs 23.0.60.1 (i486-pc-linux-gnu, GTK+ Version 2.12.11)
 of 2009-01-18 on elegiac, modified by Debian
 (emacs-snapshot package, version 1:20090118-1)
Windowing system distributor `The X.Org Foundation', version 11.0.10402000
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.0.60/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.0.60/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: de_DE@euro
  value of $LC_CTYPE: de_DE@euro
  value of $LC_MESSAGES: C
  value of $LC_MONETARY: de_DE@euro
  value of $LC_NUMERIC: de_DE@euro
  value of $LC_TIME: de_DE@euro
  value of $LANG: de_DE@euro
  value of $XMODIFIERS: nil
  locale-coding-system: iso-latin-9-unix
  default-enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  global-hl-line-mode: t
  display-time-mode: t
  show-paren-mode: t
  tooltip-mode: t
  mouse-wheel-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
  size-indication-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<menu-bar> <help-menu> <send-emacs-bug-report>

Recent messages:
No diary entries for Wednesday, 21 January 2009
Preparing diary...
No diary entries for Wednesday, 21 January 2009
Mark set
Marking diary entries...done
Marking diary entries...done
Loading avoid...done
Starting Emacs daemon.
When done with this frame, type C-x 5 0
call-interactively: Text is read-only [3 times]