patrick@COS.COM (Patrick Steranka) (08/28/87)
I have a question I hope someone can help me with. How can I update a buffer's point IF/WHEN the buffer is NOT in a window? The only solution I currently know of to modify a buffers point is by using the command "set-window-point", and of course that requires the buffer to be in a window. patrick (Patrick Steranka @ Corporation for Open Systems) -- patrick@cos.com -- patrick%cos.com@uunet.uu.net -- {uunet, sundc, decuac, hqda-ai, hadron}!cos!patrick P.S. I know of ways to get around the problem, so I don't want suggestions which achieve the result by putting the buffer into a window, and then updating the point. :^) But thanks anyway.
tom@uw-warp.UUCP (08/30/87)
In article <421@cos.COM> patrick@COS.COM (Patrick Steranka) writes: >I have a question I hope someone can help me with. >How can I update a buffer's point IF/WHEN the buffer is NOT >in a window? > >The only solution I currently know of to modify a buffers point is >by using the command "set-window-point", and of course that requires >the buffer to be in a window. There are two flavors of point, one for buffers and one for windows. To set the point in "some-buffer" to 50, say, you can use (save-excursion (set-buffer "some-buffer") (goto-char 50)) This sets the buffer point regardless of whether the buffer is in a window or not. However, any windows displaying "some-buffer" will not have their window points changed. So if you now switch to a window which is already displaying "some-buffer", the buffer point (which was just set to 50) is set again to match the window point. If instead you select "some-buffer" in a window which is not already displaying it, the window point will be set to match the buffer point and you will find the cursor at character 50. Put simply, goto-char sets a buffer point. set-window-point sets a window point. When a buffer is newly selected in a window, the window point is set to the buffer point. When the cursor is moved to a window, the buffer point is set to the window point. When the cursor is moved within a window, both points change. -- Tom May uw-nsr!uw-warp!tom@beaver.cs.washington.edu uw-beaver!uw-nsr!uw-warp!tom