Next: , Previous: , Up: Consoles; Devices; Frames; Windows   [Contents][Index]

21.2 Point

Recall that every buffer has a current insertion position, called point. Now, two or more windows may be displaying the same buffer, and the text cursor in the two windows (i.e. point) can be in two different places. You may ask, how can that be, since each buffer has only one value of point? The answer is that each window also has a value of point that is squirreled away in it. There is only one selected window, and the value of “point” in that buffer corresponds to that window. When the selected window is changed from one window to another displaying the same buffer, the old value of point is stored into the old window’s “point” and the value of point from the new window is retrieved and made the value of point in the buffer. This means that window-point for the selected window is potentially inaccurate, and if you want to retrieve the correct value of point for a window, you must special-case on the selected window and retrieve the buffer’s point instead. This is related to why save-window-excursion does not save the selected window’s value of point.