Subject: bug#8552: Error with multiple frames

From: Stefan Monnier <[email-masked]>
Date: Mon, 25 Apr 2011 14:54:53 -0300

Package: Emacs,Gnus
Version: 24.0.50

I use the following patch which doesn't do quite the right thing
I think, but at least doesn't burp in my use.  The problem is of course
that get-buffer-window may return nil rather than a window.

I've bumped into it when I select a group, then select an article in the
summary, then do C-x 5 b *Group* and then from the summary buffer hit
`q'.  Sadly, this recipe doesn't reproduce the problem, and I'm not sure
exactly what sequence of actions reproduces it, other than the fact that
it happens when I leave a summary buffer and the *Group* buffer is
already displayed in some other frame.  If/when I bump into it again,
I'll send you the corresponding backtrace.

        Stefan

--- lisp/gnus/gnus-sum.el	2011-04-25 15:40:15 +0000
+++ lisp/gnus/gnus-sum.el	2011-04-25 16:36:28 +0000
@@ -7786,7 +7786,8 @@
 	  ;; Somehow or other, we may now have selected a different
 	  ;; window.  Make point go back to the summary buffer.
 	  (when (eq current-summary (current-buffer))
-	    (select-window (get-buffer-window current-summary)))
+            ;; FIXME: This burps when get-buffer-window returns nil.
+	    (select-window (get-buffer-window current-summary 0)))
 	  (gnus-summary-walk-group-buffer
 	   gnus-newsgroup-name cmd unread backward point))))))))

In GNU Emacs 24.0.50.1 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2011-04-21 on ceviche
Windowing system distributor `The X.Org Foundation', version 11.0.10905000
configured using `configure  'CFLAGS=-Wall -Wno-pointer-sign -DUSE_LISP_UNION_TYPE -DSYNC_INPUT -DENABLE_CHECKING -DXASSERTS -DFONTSET_DEBUG -g -O1 -I/usr/include/GNUstep' '--enable-maintainer-mode' '--with-x-toolkit=lucid''

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: fr_CH.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Message

Minor modes in effect:
  diff-auto-refine-mode: t
  gnus-message-citation-mode: t
  mml-mode: t
  flyspell-mode: t
  electric-pair-mode: t
  electric-indent-mode: t
  url-handler-mode: t
  global-reveal-mode: t
  reveal-mode: t
  auto-insert-mode: t
  savehist-mode: t
  minibuffer-electric-default-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t
  abbrev-mode: t

Recent input:
<down> <left> <right> <down> <left> <down> <right> 
<left> <down> <right> <left> <right> <up> <up> <left> 
<right> <up> <left> <right> <up> <left> <right> <down> 
<left> <right> <down> <left> <right> <down> <left> 
<down> <right> <left> <right> <up> <up> <up> <up> <up> 
<left> <right> <down> <left> <right> <down> <left> 
<right> <down> <left> <right> <down> <left> <right> 
<down> <left> <right> <up> <up> <up> <up> <left> <right> 
<down> <left> <right> <down> <left> <right> <down> 
<left> <right> <down> <left> <right> <up> <up> <up> 
<up> <up> <left> <right> <down> <left> <right> <down> 
<left> <right> <down> <left> <right> <up> <right> <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> <right> <right> <right> s C-a <C-up> 
<left> <right> <up> <left> <right> <down> <left> <right> 
<up> <left> <right> <up> <left> <right> <down> <left> 
<right> <down> <left> <right> <down> <left> <right> 
<down> <left> <right> <down> <left> <right> <down> 
<left> <right> <up> <up> <left> <right> <up> <left> 
<right> <up> <left> <right> <down> <left> <right> <down> 
<left> <right> <down> <left> <down> <right> <left> 
<right> <switch-frame> <switch-frame> <switch-frame> 
<switch-frame> <switch-frame> <switch-frame> <switch-frame> 
<switch-frame> <switch-frame> <switch-frame> <switch-frame> 
<switch-frame> <switch-frame> <switch-frame> <switch-frame> 
<switch-frame> <switch-frame> <switch-frame> <switch-frame> 
<select-window> <switch-frame> <left> <right> <up> 
<left> <right> <up> <left> <right> <down> <left> <down> 
<right> <left> SPC SPC I f / w h e n SPC I S-SPC c 
<backspace> g e t SPC SPC <backspace> <M-backspace> 
g e t A <up> C-a <down> <left> <right> <down> <left> 
<backspace> C-a <right> <up> <left> <left> <right> 
<down> <left> <right> <down> <left> <right> <up> <up> 
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> 
<up> <right> <right> <right> <right> M-x r e p o - 
e m - b u <tab> <return>

Recent messages:
Retrieving newsgroup: nnimap+diro:nanda...
Fetching headers for nnimap+diro:nanda...done
Scoring...done
Generating summary...done
No more unseen articles
No more articles [2 times]
Expiring articles...done
Auto-saving...done
Auto-saving...done
Scanning for dabbrevs...100%

Load-path shadows:
None found.

Features:
(shadow dabbrev emacsbug gnus-dup rect woman tutorial help-macro man
info-look info help-at-pt ehelp apropos edebug debug utf-7 nnfolder
gnus-topic bbdb-mua cus-edit cus-start cus-load multi-isearch vc-bzr
filecache bbdb-com bbdb timezone canlock sha1 hex-util gnus-html
browse-url xml url-cache mm-url url url-proxy url-privacy url-expand
url-methods url-history url-cookie url-util gnus-fun diff-mode jka-compr
pp supercite regi executable copyright flow-fill mule-util sort smiley
ansi-color gnus-cite mail-extr gnus-async gnus-bcklg qp gnus-ml
disp-table nndraft nnmh rfc2104 network-stream starttls nnimap
parse-time tls utf7 netrc nnagent nnml gnus-agent gnus-srvr gnus-score
score-mode nnvirtual gnus-msg gnus-art mm-uu mml2015 epg-config mm-view
mml-smime smime dig mailcap nntp gnus-cache nnir gnus-sum nnoo
gnus-group gnus-undo nnmail mail-source server gnus-start gnus-spec
gnus-int gnus-range message sendmail format-spec rfc822 mml mml-sec
mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045
ietf-drums mailabbrev gmm-utils mailheader gnus-win gnus gnus-ems
nnheader mail-utils wid-edit noutline outline easy-mmode flyspell ispell
eldoc checkdoc regexp-opt thingatpt help-mode easymenu view prog-mode
electric url-handlers url-parse auth-source warnings eieio byte-opt
bytecomp byte-compile cconv macroexp assoc gnus-util time-date
password-cache url-vars mm-util mail-prsvr reveal autoinsert uniquify
advice help-fns advice-preload savehist minibuf-eldef cl cl-loaddefs
proof-site proof-autoloads pg-vars bbdb-autoloads agda2 tooltip
ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd
fontset image fringe lisp-mode register page newcomment menu-bar
rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax
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 minibuffer loaddefs button faces
cus-face files text-properties overlay md5 base64 format env code-pages
mule custom widget hashtable-print-readable backquote
make-network-process dbusbind dynamic-setting system-font-setting
font-render-setting x-toolkit x multi-tty emacs)