Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!think!snorkelwacker!bloom-beacon!shelby!mcnc!rti!talos!kjones From: kjones@talos.uu.net (Kyle Jones) Newsgroups: gnu.emacs.bug Subject: Re: Suspected bug in set-window-point Message-ID: <1990Jan23.133024.29492@talos.uu.net> Date: 23 Jan 90 13:30:24 GMT References: <9001230152.AA02410@tarski.mit.edu> Reply-To: kjones@talos.uu.net Lines: 38 drw@BOURBAKI.MIT.EDU writes about: > I believe there is a bug in the code for set-window-point. [...] > The apparent cause is that the code of set-window-point is: > > if WINDOW == selected-window() > then goto-char(POS) > else set-marker(WINDOW->pointm, POS, WINDOW->buffer) > > This appears to omit a check that the current buffer is the buffer of > WINDOW, as is done in window-point: > > if WINDOW == selected-window() && current-buffer() == WINDOW->buffer > then return point() > else return marker-position(WINDOW->pointm) Correct. I reported this bug and received this new definition of Fset_window_point from RMS to test; it fixes the problem. Since it hasn't made it into the distribution yet, here it is. DEFUN ("set-window-point", Fset_window_point, Sset_window_point, 2, 2, 0, "Make point value in WINDOW be at position POS in WINDOW's buffer.") (window, pos) Lisp_Object window, pos; { register struct window *w = decode_window (window); CHECK_NUMBER_COERCE_MARKER (pos, 1); if (w == XWINDOW (selected_window)) { struct buffer *obuf = bf_cur; Fset_buffer (w->buffer); Fgoto_char (pos); SetBfp (obuf); } else Fset_marker (w->pointm, pos, w->buffer); return pos; }