GNU bug report logs - #14486
24.3.50; A very subtle/obscure bug - with-temp-buffer + pop-to-buffer + insert

Previous Next

Package: emacs;

Reported by: Jambunathan K <kjambunathan <at> gmail.com>

Date: Tue, 28 May 2013 02:49:02 UTC

Severity: normal

Tags: notabug

Found in version 24.3.50

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 14486 in the body.
You can then email your comments to 14486 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#14486; Package emacs. (Tue, 28 May 2013 02:49:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jambunathan K <kjambunathan <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 28 May 2013 02:49:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jambunathan K <kjambunathan <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.50;
	A very subtle/obscure bug - with-temp-buffer + pop-to-buffer + insert
Date: Tue, 28 May 2013 08:16:41 +0530
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 <at> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14486; Package emacs. (Tue, 28 May 2013 04:55:01 GMT) Full text and rfc822 format available.

Message #8 received at 14486 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Jambunathan K <kjambunathan <at> gmail.com>
Cc: 14486 <at> debbugs.gnu.org
Subject: Re: bug#14486: 24.3.50;
	A very subtle/obscure bug - with-temp-buffer + pop-to-buffer + insert
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




Added tag(s) notabug. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 12 Jun 2013 00:09:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 14486 <at> debbugs.gnu.org and Jambunathan K <kjambunathan <at> gmail.com> Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 12 Jun 2013 00:09:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 10 Jul 2013 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 348 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.