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: mbork
Subject: Re: Please explain to me what happens with the point!
Date: Tue, 27 May 2025 20:41:42 +0200

On 2025-05-27, at 20:31, Stephen Berman <stephen.berman@gmx.net> wrote:

> 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.

That still seems not to explain the observed behavior - since the window
is not selected, how does `window-point' insertion type be relevant?
I'm confused.

Thanks,

-- 
Marcin Borkowski
https://mbork.pl
https://crimsonelevendelightpetrichor.net/



reply via email to

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