*** src/indent.c 2011-07-10 08:20:10 +0000 --- src/indent.c 2011-07-10 13:03:07 +0000 *************** *** 1984,1991 **** struct it it; struct text_pos pt; struct window *w; ! Lisp_Object old_buffer; ! struct gcpro gcpro1; Lisp_Object lcols = Qnil; double cols IF_LINT (= 0); --- 1984,1991 ---- struct it it; struct text_pos pt; struct window *w; ! Lisp_Object old_buffer, old_pointm; ! struct gcpro gcpro1, gcpro2; Lisp_Object lcols = Qnil; double cols IF_LINT (= 0); *************** *** 2005,2016 **** w = XWINDOW (window); old_buffer = Qnil; ! GCPRO1 (old_buffer); if (XBUFFER (w->buffer) != current_buffer) { /* Set the window's buffer temporarily to the current buffer. */ old_buffer = w->buffer; XSETBUFFER (w->buffer, current_buffer); } if (noninteractive) --- 2005,2019 ---- w = XWINDOW (window); old_buffer = Qnil; ! GCPRO2 (old_buffer, old_pointm); if (XBUFFER (w->buffer) != current_buffer) { /* Set the window's buffer temporarily to the current buffer. */ old_buffer = w->buffer; + old_pointm = w->pointm; XSETBUFFER (w->buffer, current_buffer); + set_marker_both + (w->pointm, w->buffer, BUF_PT (current_buffer), BUF_PT_BYTE (current_buffer)); } if (noninteractive) *************** *** 2131,2137 **** } if (BUFFERP (old_buffer)) ! w->buffer = old_buffer; RETURN_UNGCPRO (make_number (it.vpos)); } --- 2134,2143 ---- } if (BUFFERP (old_buffer)) ! { ! w->buffer = old_buffer; ! w->pointm = old_pointm; ! } RETURN_UNGCPRO (make_number (it.vpos)); }