help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Please explain to me what happens with the point!


From: Eli Zaretskii
Subject: Re: Please explain to me what happens with the point!
Date: Tue, 27 May 2025 21:19:33 +0300

> From: mbork@mbork.pl
> Date: Tue, 27 May 2025 18:17:02 +0200
> 
> --8<---------------cut here---------------start------------->8---
> (defun point-and-window-test ()
>   "What is happening?"
>   (interactive)
>   (setq test-buffer (get-buffer-create "*test*"))
>   (with-current-buffer test-buffer
>     (insert "1-2-3-testing\n")
>     (message "point: %s" (point))))
> --8<---------------cut here---------------end--------------->8---
> 
> and perform two experiments.
> 
> 1. Do this:
> 
> M-x point-and-window-test
>   => 15
> M-x point-and-window-test
>   => 29
> M-x point-and-window-test
>   => 44
> 
> So far, so good.
> 
> 2. Now start emacs -Q afresh, evaluate the same `defun', and do this:
> 
> C-x 4 b *test* RET
> C-x o
> M-x point-and-window-test
>   => 15
> M-x point-and-window-test
>   => 15
> M-x point-and-window-test
>   => 15
> 
> What is going on here?  I studied the manual chapter on "window point",
> but I can't understand why the point in my second example seemingly does
> not move, since the `*test*' buffer is never in the selected window.
> 
> Any ideas?

Is switch-to-buffer-preserve-window-point part of the puzzle, perhaps?



reply via email to

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