On 14 June 2017 at 18:26, Noam Postavsky <npostavs@users.sourceforge.net> wrote:
On Wed, Jun 14, 2017 at 5:45 AM, Elias Mårtenson <lokedhs@gmail.com> wrote:
>
>     (progn
>       (set-buffer "z")
>       (goto-char LOCATION))
>
> When I do this, point doesn't move. Or rather, it does move, but after the
> conclusion of the ‘progn’ form, the cursor returns to its original location.

Is the buffer "z" visible? You probably need to set-window-point too.

The same behaviour is seen regardless of whether the buffer is visible or not.

It's easy to reproduce:

Just create a buffer "z", fill it with some text and place point in a random position. Then open ‘ielm’ and type:

    (progn (set-buffer "z") (goto-char (point-min)))

Then switch to buffer "z" and observe that point is still in its original position.