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: Joost Kremers
Subject: Re: Update point in visible but non-selected buffer/window
Date: Fri, 21 Oct 2016 23:37:33 +0200
User-agent: mu4e 0.9.17; emacs 25.1.50.1


On Fri, Oct 21 2016, Eli Zaretskii wrote:
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.

Yeah, I assumed it was by design, because it makes sense.

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.

Thanks. I missed that.

--
Joost Kremers
Life has its moments



reply via email to

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