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: Stephen Berman
Subject: Re: Please explain to me what happens with the point!
Date: Tue, 27 May 2025 20:31:47 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

On Tue, 27 May 2025 18:17:02 +0200 mbork@mbork.pl wrote:

> Hi all,
>
> I'm stuck.
>
> Evaluate this in emacs -Q:
>
> (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))))
>
> 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?

M-: (setq window-point-insertion-type t)

 -- Variable: window-point-insertion-type
     This variable specifies the marker insertion type (*note Marker
     Insertion Types::) of ‘window-point’.  The default is ‘nil’, so
     ‘window-point’ will stay behind text inserted there.

Steve Berman



reply via email to

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