emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: with-current-buffer


From: Stefan Monnier
Subject: Re: with-current-buffer
Date: Sun, 11 Sep 2005 17:15:53 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

>>> In both cases the insertion is done at the right spot, but in case
>>> 1 point in buffer "FOO" is restored after the code is executed.

>>> Is that intended behavior?

>>> I expected point to be moved permanently in both cases.

>> Which point?

> The point in buffer "FOO", of course.

If foo is displayed in a window, it has 2 points: its own and the one of
the window.

> I expected the point to stay at point max after `with-current-buffer' exits.

It does stay there.  Try

   (progn
     (with-current-buffer "FOO"
       (goto-char (point-max))
       (insert "bar"))
     (with-current-buffer "FOO"
       (point)))

> In the case 1 explained in the original message the code behaves as if it
> were wrapped with `save-excursion'.

No, it's just that the window's point gets copied to the buffer's point,
probably during redisplay.

> Can you reproduce it?

Of course,


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]