* bug#14486: 24.3.50; A very subtle/obscure bug - with-temp-buffer + pop-to-buffer + insert
@ 2013-05-28 2:46 Jambunathan K
2013-05-28 4:53 ` Stefan Monnier
0 siblings, 1 reply; 2+ messages in thread
From: Jambunathan K @ 2013-05-28 2:46 UTC (permalink / raw)
To: 14486
A very subtle/obscure bug. I have a hard time explaining the observed
behaviour.
1. emacs -Q
2. In the scratch buffer copy the following snippet and install it.
(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))))
3. M->
4. M-x testing
C-x o
M-x testing
C-x o
M-x testing
C-x o
5. Expected behaviour: Point should be at the END of the scratch buffer
Observed behaviour: Not as expected.
Now comment out the `pop-to-buffer' in the snippet above, install the
changes and repeat. You will see that the point is at END of the
scratch buffer.
In GNU Emacs 24.3.50.3 (i686-pc-linux-gnu, GTK+ Version 2.20.1)
of 2013-05-27 on debian-6.05
Bzr revision: 112737 monnier@iro.umontreal.ca-20130527010843-s4qzq34vq5x532aj
Windowing system distributor `The X.Org Foundation', version 11.0.10707000
Important settings:
value of $LANG: en_IN
locale-coding-system: iso-latin-1-unix
default enable-multibyte-characters: t
^ permalink raw reply [flat|nested] 2+ messages in thread
* bug#14486: 24.3.50; A very subtle/obscure bug - with-temp-buffer + pop-to-buffer + insert
2013-05-28 2:46 bug#14486: 24.3.50; A very subtle/obscure bug - with-temp-buffer + pop-to-buffer + insert Jambunathan K
@ 2013-05-28 4:53 ` Stefan Monnier
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2013-05-28 4:53 UTC (permalink / raw)
To: Jambunathan K; +Cc: 14486
> (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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-05-28 4:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-28 2:46 bug#14486: 24.3.50; A very subtle/obscure bug - with-temp-buffer + pop-to-buffer + insert Jambunathan K
2013-05-28 4:53 ` Stefan Monnier
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.