Mercurial > emacs
diff src/indent.c @ 6846:a6803ff29cca
(compute_motion): Do not abort if window shows some other buffer.
(Fcompute_motion): Use whatever buffer is current.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Wed, 13 Apr 1994 06:24:06 +0000 |
parents | d84152a9b7e5 |
children | cd81dba38a49 |
line wrap: on
line diff
--- a/src/indent.c Wed Apr 13 05:37:24 1994 +0000 +++ b/src/indent.c Wed Apr 13 06:24:06 1994 +0000 @@ -450,9 +450,9 @@ register int ctl_arrow = !NILP (current_buffer->ctl_arrow); register struct Lisp_Vector *dp = window_display_table (win); int selective - = XTYPE (current_buffer->selective_display) == Lisp_Int - ? XINT (current_buffer->selective_display) - : !NILP (current_buffer->selective_display) ? -1 : 0; + = (XTYPE (current_buffer->selective_display) == Lisp_Int + ? XINT (current_buffer->selective_display) + : !NILP (current_buffer->selective_display) ? -1 : 0); int prev_vpos, prev_hpos = 0; int selective_rlen = (selective && dp && XTYPE (DISP_INVIS_VECTOR (dp)) == Lisp_Vector @@ -463,9 +463,6 @@ Lisp_Object prop, position; #endif - if (! BUFFERP (win->buffer) || XBUFFER (win->buffer) != current_buffer) - abort (); - if (tab_width <= 0 || tab_width > 1000) tab_width = 8; for (pos = from; pos < to; pos++) { @@ -636,8 +633,10 @@ TAB-OFFSET is the number of columns of the first tab that aren't\n\ being displayed, perhaps because the line was continued within it.\n\ If OFFSETS is nil, HSCROLL and TAB-OFFSET are assumed to be zero.\n\ +\n\ WINDOW is the window to operate on. Currently this is used only to\n\ -find the buffer and the display table.\n\ +find the display table. It does not matter what buffer WINDOW displays;\n\ +`compute-motion' always operates on the current buffer.\n\ \n\ The value is a list of five elements:\n\ (POS HPOS VPOS PREVHPOS CONTIN)\n\ @@ -664,7 +663,6 @@ Lisp_Object bufpos, hpos, vpos, prevhpos, contin; struct position *pos; int hscroll, tab_offset; - struct buffer *old_buffer; CHECK_NUMBER_COERCE_MARKER (from, 0); CHECK_CONS (frompos, 0); @@ -691,17 +689,12 @@ else CHECK_LIVE_WINDOW (window, 0); - /* Might as well use the buffer on the specified window, rather than - generating an error. */ - old_buffer = current_buffer; - current_buffer = XBUFFER (XWINDOW (window)->buffer); pos = compute_motion (XINT (from), XINT (XCONS (frompos)->cdr), XINT (XCONS (frompos)->car), XINT (to), XINT (XCONS (topos)->cdr), XINT (XCONS (topos)->car), XINT (width), hscroll, tab_offset, XWINDOW (window)); - current_buffer = old_buffer; XFASTINT (bufpos) = pos->bufpos; XSET (hpos, Lisp_Int, pos->hpos); @@ -853,12 +846,17 @@ DEFUN ("vertical-motion", Fvertical_motion, Svertical_motion, 1, 2, 0, "Move to start of screen line LINES lines down.\n\ If LINES is negative, this is moving up.\n\ -The optional second argument WINDOW specifies the window\n\ - to use for computations.\n\ +\n\ +The optional second argument WINDOW specifies the window to use for\n\ +parameters such as width, horizontal scrolling, and so on.\n\ +the default is the selected window.\n\ +It does not matter what buffer is displayed in WINDOW.\n\ +`vertical-motion' always uses the current buffer.\n\ +\n\ Sets point to position found; this may be start of line\n\ - or just the start of a continuation line.\n\ +or just the start of a continuation line.\n\ Returns number of lines moved; may be closer to zero than LINES\n\ - if beginning or end of buffer was reached.") +if beginning or end of buffer was reached.") (lines, window) Lisp_Object lines, window; { @@ -872,6 +870,7 @@ XSET (window, Lisp_Window, selected_window); w = XWINDOW (window); + pos = *vmotion (point, XINT (lines), window_internal_width (w) - 1, /* Not XFASTINT since perhaps could be negative */ XINT (w->hscroll), window);