Subject: Re: bug#14486: 24.3.50; A very subtle/obscure bug - with-temp-buffer + pop-to-buffer + insert

From: Stefan Monnier <[email-masked]>
Date: Tue, 28 May 2013 00:53:18 -0400

>       (defvar count 1)
>       (defun testing ()
>         (interactive)
>         (forward-line 1)
>         (insert (with-temp-buffer
>                   (insert (format "string-%d\n" (setq count (+ 1 count))))
>                   (pop-to-buffer (current-buffer))
>                   (buffer-string))))

When the outer `insert' is executed, the selected window is not the one
displaying *scratch* but the one displaying *Messages*, so the window's
point is not affected by `insert'.

You're just seeing the effect of the fact that each buffer has N+1
different `point's, where N is the number of windows displaying this buffer.

        Stefan