Subject: bug#6585: 23.1; Hang / CPU 100% on background interaction when in minibuffer

From: "Jason S. Cornez" <[email-masked]>
Date: Thu, 15 Jul 2010 14:05:14 +0200

I believe I have found the problem.  A custom function to switch to a
buffer is being called.  It looks like...

- ----
(defun my::switch-to-buffer (buffer)
  ;; if buffer is in some window, go to it, otherwise switch-to-buffer
  (let ((start (selected-window))
	(current (next-window (selected-window) 'no-minibuffer 'visible))
	(found nil))
    (while (and (not (eq current start))
		(not found))
      (if (eq buffer (window-buffer current))
	  (setq found current))
      (setq current (next-window current 'no-minibuffer 'visible)))
    (if (null found)
	(switch-to-buffer buffer)
      (select-window found))))
- ----

Now, if start == (selected-window) is the minibuffer, then it should be
clear that current == (next-window ... 'no-minibuffer ...) will never
result in (eq start current).  And if the buffer that is passed in isn't
visible then (not found) will never be nil and we are stuck in an
infinite loop.

So this part is not an emacs problem at all.  But I am puzzled as to why
if this is byte-compiled I can't C-g and break out of this.

I'll fix my code and then the problem goes away.  So if you want to
consider this "not-a-bug", ok.  But shouldn't C-g work here?

Thanks,
- -Jason