diff options
| author | Richard M. Stallman | 1994-04-13 06:24:06 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-04-13 06:24:06 +0000 |
| commit | 69eaf10d0311af95cd82ec419a91020c22db389a (patch) | |
| tree | d730e41951a351d310f939b35dec5c114ae21440 /src | |
| parent | 6e4b48e2a8cbdc1d69408d5ce69bdf64dbbe9c06 (diff) | |
| download | emacs-69eaf10d0311af95cd82ec419a91020c22db389a.tar.gz emacs-69eaf10d0311af95cd82ec419a91020c22db389a.zip | |
(compute_motion): Do not abort if window shows some other buffer.
(Fcompute_motion): Use whatever buffer is current.
Diffstat (limited to 'src')
| -rw-r--r-- | src/indent.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/src/indent.c b/src/indent.c index ad876b555d7..f18723cd39b 100644 --- a/src/indent.c +++ b/src/indent.c | |||
| @@ -450,9 +450,9 @@ compute_motion (from, fromvpos, fromhpos, to, tovpos, tohpos, width, hscroll, ta | |||
| 450 | register int ctl_arrow = !NILP (current_buffer->ctl_arrow); | 450 | register int ctl_arrow = !NILP (current_buffer->ctl_arrow); |
| 451 | register struct Lisp_Vector *dp = window_display_table (win); | 451 | register struct Lisp_Vector *dp = window_display_table (win); |
| 452 | int selective | 452 | int selective |
| 453 | = XTYPE (current_buffer->selective_display) == Lisp_Int | 453 | = (XTYPE (current_buffer->selective_display) == Lisp_Int |
| 454 | ? XINT (current_buffer->selective_display) | 454 | ? XINT (current_buffer->selective_display) |
| 455 | : !NILP (current_buffer->selective_display) ? -1 : 0; | 455 | : !NILP (current_buffer->selective_display) ? -1 : 0); |
| 456 | int prev_vpos, prev_hpos = 0; | 456 | int prev_vpos, prev_hpos = 0; |
| 457 | int selective_rlen | 457 | int selective_rlen |
| 458 | = (selective && dp && XTYPE (DISP_INVIS_VECTOR (dp)) == Lisp_Vector | 458 | = (selective && dp && XTYPE (DISP_INVIS_VECTOR (dp)) == Lisp_Vector |
| @@ -463,9 +463,6 @@ compute_motion (from, fromvpos, fromhpos, to, tovpos, tohpos, width, hscroll, ta | |||
| 463 | Lisp_Object prop, position; | 463 | Lisp_Object prop, position; |
| 464 | #endif | 464 | #endif |
| 465 | 465 | ||
| 466 | if (! BUFFERP (win->buffer) || XBUFFER (win->buffer) != current_buffer) | ||
| 467 | abort (); | ||
| 468 | |||
| 469 | if (tab_width <= 0 || tab_width > 1000) tab_width = 8; | 466 | if (tab_width <= 0 || tab_width > 1000) tab_width = 8; |
| 470 | for (pos = from; pos < to; pos++) | 467 | for (pos = from; pos < to; pos++) |
| 471 | { | 468 | { |
| @@ -636,8 +633,10 @@ margin; this is usually taken from a window's hscroll member.\n\ | |||
| 636 | TAB-OFFSET is the number of columns of the first tab that aren't\n\ | 633 | TAB-OFFSET is the number of columns of the first tab that aren't\n\ |
| 637 | being displayed, perhaps because the line was continued within it.\n\ | 634 | being displayed, perhaps because the line was continued within it.\n\ |
| 638 | If OFFSETS is nil, HSCROLL and TAB-OFFSET are assumed to be zero.\n\ | 635 | If OFFSETS is nil, HSCROLL and TAB-OFFSET are assumed to be zero.\n\ |
| 636 | \n\ | ||
| 639 | WINDOW is the window to operate on. Currently this is used only to\n\ | 637 | WINDOW is the window to operate on. Currently this is used only to\n\ |
| 640 | find the buffer and the display table.\n\ | 638 | find the display table. It does not matter what buffer WINDOW displays;\n\ |
| 639 | `compute-motion' always operates on the current buffer.\n\ | ||
| 641 | \n\ | 640 | \n\ |
| 642 | The value is a list of five elements:\n\ | 641 | The value is a list of five elements:\n\ |
| 643 | (POS HPOS VPOS PREVHPOS CONTIN)\n\ | 642 | (POS HPOS VPOS PREVHPOS CONTIN)\n\ |
| @@ -664,7 +663,6 @@ DEFUN ("compute-motion", Fcompute_motion, Scompute_motion, 7, 7, 0, | |||
| 664 | Lisp_Object bufpos, hpos, vpos, prevhpos, contin; | 663 | Lisp_Object bufpos, hpos, vpos, prevhpos, contin; |
| 665 | struct position *pos; | 664 | struct position *pos; |
| 666 | int hscroll, tab_offset; | 665 | int hscroll, tab_offset; |
| 667 | struct buffer *old_buffer; | ||
| 668 | 666 | ||
| 669 | CHECK_NUMBER_COERCE_MARKER (from, 0); | 667 | CHECK_NUMBER_COERCE_MARKER (from, 0); |
| 670 | CHECK_CONS (frompos, 0); | 668 | CHECK_CONS (frompos, 0); |
| @@ -691,17 +689,12 @@ DEFUN ("compute-motion", Fcompute_motion, Scompute_motion, 7, 7, 0, | |||
| 691 | else | 689 | else |
| 692 | CHECK_LIVE_WINDOW (window, 0); | 690 | CHECK_LIVE_WINDOW (window, 0); |
| 693 | 691 | ||
| 694 | /* Might as well use the buffer on the specified window, rather than | ||
| 695 | generating an error. */ | ||
| 696 | old_buffer = current_buffer; | ||
| 697 | current_buffer = XBUFFER (XWINDOW (window)->buffer); | ||
| 698 | pos = compute_motion (XINT (from), XINT (XCONS (frompos)->cdr), | 692 | pos = compute_motion (XINT (from), XINT (XCONS (frompos)->cdr), |
| 699 | XINT (XCONS (frompos)->car), | 693 | XINT (XCONS (frompos)->car), |
| 700 | XINT (to), XINT (XCONS (topos)->cdr), | 694 | XINT (to), XINT (XCONS (topos)->cdr), |
| 701 | XINT (XCONS (topos)->car), | 695 | XINT (XCONS (topos)->car), |
| 702 | XINT (width), hscroll, tab_offset, | 696 | XINT (width), hscroll, tab_offset, |
| 703 | XWINDOW (window)); | 697 | XWINDOW (window)); |
| 704 | current_buffer = old_buffer; | ||
| 705 | 698 | ||
| 706 | XFASTINT (bufpos) = pos->bufpos; | 699 | XFASTINT (bufpos) = pos->bufpos; |
| 707 | XSET (hpos, Lisp_Int, pos->hpos); | 700 | XSET (hpos, Lisp_Int, pos->hpos); |
| @@ -853,12 +846,17 @@ vmotion (from, vtarget, width, hscroll, window) | |||
| 853 | DEFUN ("vertical-motion", Fvertical_motion, Svertical_motion, 1, 2, 0, | 846 | DEFUN ("vertical-motion", Fvertical_motion, Svertical_motion, 1, 2, 0, |
| 854 | "Move to start of screen line LINES lines down.\n\ | 847 | "Move to start of screen line LINES lines down.\n\ |
| 855 | If LINES is negative, this is moving up.\n\ | 848 | If LINES is negative, this is moving up.\n\ |
| 856 | The optional second argument WINDOW specifies the window\n\ | 849 | \n\ |
| 857 | to use for computations.\n\ | 850 | The optional second argument WINDOW specifies the window to use for\n\ |
| 851 | parameters such as width, horizontal scrolling, and so on.\n\ | ||
| 852 | the default is the selected window.\n\ | ||
| 853 | It does not matter what buffer is displayed in WINDOW.\n\ | ||
| 854 | `vertical-motion' always uses the current buffer.\n\ | ||
| 855 | \n\ | ||
| 858 | Sets point to position found; this may be start of line\n\ | 856 | Sets point to position found; this may be start of line\n\ |
| 859 | or just the start of a continuation line.\n\ | 857 | or just the start of a continuation line.\n\ |
| 860 | Returns number of lines moved; may be closer to zero than LINES\n\ | 858 | Returns number of lines moved; may be closer to zero than LINES\n\ |
| 861 | if beginning or end of buffer was reached.") | 859 | if beginning or end of buffer was reached.") |
| 862 | (lines, window) | 860 | (lines, window) |
| 863 | Lisp_Object lines, window; | 861 | Lisp_Object lines, window; |
| 864 | { | 862 | { |
| @@ -872,6 +870,7 @@ Returns number of lines moved; may be closer to zero than LINES\n\ | |||
| 872 | XSET (window, Lisp_Window, selected_window); | 870 | XSET (window, Lisp_Window, selected_window); |
| 873 | 871 | ||
| 874 | w = XWINDOW (window); | 872 | w = XWINDOW (window); |
| 873 | |||
| 875 | pos = *vmotion (point, XINT (lines), window_internal_width (w) - 1, | 874 | pos = *vmotion (point, XINT (lines), window_internal_width (w) - 1, |
| 876 | /* Not XFASTINT since perhaps could be negative */ | 875 | /* Not XFASTINT since perhaps could be negative */ |
| 877 | XINT (w->hscroll), window); | 876 | XINT (w->hscroll), window); |