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

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

Re: Update point in visible but non-selected buffer/window


From: Eli Zaretskii
Subject: Re: Update point in visible but non-selected buffer/window
Date: Fri, 21 Oct 2016 18:16:22 +0300

> From: Joost Kremers <joostkremers@fastmail.fm>
> Date: Fri, 21 Oct 2016 10:39:37 +0200
> 
> I just found out the hard way that changing point programmatically 
> (i.e., from within an Elisp program) in a buffer that is visible 
> in a non-selected window doesn't (necessarily?) update the 
> position of the cursor, and when the window is selected again, 
> point is reset to the cursor position.

This is by design.  That's what window-point is about.  When you
select a window, the buffer shown in that window gets its point reset
to the place of window-point, and the cursor is positioned
accordingly.

> I can see why this behaviour makes sense from a user's 
> perspective, and I figured out that I can call `select-window' 
> inside `with-current-buffer' to force the cursor position to 
> change as well as point. But I haven't been able to find any info 
> on this behaviour in the Elisp manual, so I was wondering if this 
> has been described somewhere and whether the solution I stumbled 
> upon (using `select-window') is the best way to achieve the effect 
> I want, or whether there is a better, more canonical way.

See window-point and set-window-point.



reply via email to

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