diff options
| author | Gerd Moellmann | 2000-02-25 15:41:43 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-02-25 15:41:43 +0000 |
| commit | 719eaeb1b62f89d6d4efbe6bc60a10377053982e (patch) | |
| tree | f4ddef0dab44f8ec4ce0b15b35f791fc811a6d0e /src/window.c | |
| parent | 449c3c5259ac56b1f4d7c69655f858ef5cace91b (diff) | |
| download | emacs-719eaeb1b62f89d6d4efbe6bc60a10377053982e.tar.gz emacs-719eaeb1b62f89d6d4efbe6bc60a10377053982e.zip | |
(select_window_1): If selected_window is nil,
don't "swap out" the buffer's point.
(Fset_window_configuration): Set selected_window to nil
before calling Fselect_window.
(unshow_buffer): Don't set point in buffer from window's point
if another more recently selected window also shows the buffer.
Diffstat (limited to 'src/window.c')
| -rw-r--r-- | src/window.c | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/src/window.c b/src/window.c index be6bf813920..e55cf0dac63 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -882,9 +882,6 @@ unshow_buffer (w) | |||
| 882 | if (b != XMARKER (w->pointm)->buffer) | 882 | if (b != XMARKER (w->pointm)->buffer) |
| 883 | abort (); | 883 | abort (); |
| 884 | 884 | ||
| 885 | if (w == XWINDOW (b->last_selected_window)) | ||
| 886 | b->last_selected_window = Qnil; | ||
| 887 | |||
| 888 | #if 0 | 885 | #if 0 |
| 889 | if (w == XWINDOW (selected_window) | 886 | if (w == XWINDOW (selected_window) |
| 890 | || ! EQ (buf, XWINDOW (selected_window)->buffer)) | 887 | || ! EQ (buf, XWINDOW (selected_window)->buffer)) |
| @@ -903,7 +900,10 @@ unshow_buffer (w) | |||
| 903 | /* Point in the selected window's buffer | 900 | /* Point in the selected window's buffer |
| 904 | is actually stored in that buffer, and the window's pointm isn't used. | 901 | is actually stored in that buffer, and the window's pointm isn't used. |
| 905 | So don't clobber point in that buffer. */ | 902 | So don't clobber point in that buffer. */ |
| 906 | if (! EQ (buf, XWINDOW (selected_window)->buffer)) | 903 | if (! EQ (buf, XWINDOW (selected_window)->buffer) |
| 904 | /* This line helps to fix Horsley's testbug.el bug. */ | ||
| 905 | && !(w != XWINDOW (b->last_selected_window) | ||
| 906 | && EQ (buf, XWINDOW (b->last_selected_window)->buffer))) | ||
| 907 | temp_set_point_both (b, | 907 | temp_set_point_both (b, |
| 908 | clip_to_bounds (BUF_BEGV (b), | 908 | clip_to_bounds (BUF_BEGV (b), |
| 909 | XMARKER (w->pointm)->charpos, | 909 | XMARKER (w->pointm)->charpos, |
| @@ -911,6 +911,9 @@ unshow_buffer (w) | |||
| 911 | clip_to_bounds (BUF_BEGV_BYTE (b), | 911 | clip_to_bounds (BUF_BEGV_BYTE (b), |
| 912 | marker_byte_position (w->pointm), | 912 | marker_byte_position (w->pointm), |
| 913 | BUF_ZV_BYTE (b))); | 913 | BUF_ZV_BYTE (b))); |
| 914 | |||
| 915 | if (w == XWINDOW (b->last_selected_window)) | ||
| 916 | b->last_selected_window = Qnil; | ||
| 914 | } | 917 | } |
| 915 | 918 | ||
| 916 | /* Put replacement into the window structure in place of old. */ | 919 | /* Put replacement into the window structure in place of old. */ |
| @@ -2476,13 +2479,16 @@ selects the buffer of the selected window before each command.") | |||
| 2476 | return select_window_1 (window, 1); | 2479 | return select_window_1 (window, 1); |
| 2477 | } | 2480 | } |
| 2478 | 2481 | ||
| 2482 | /* Note that selected_window can be nil | ||
| 2483 | when this is called from Fset_window_configuration. */ | ||
| 2484 | |||
| 2479 | static Lisp_Object | 2485 | static Lisp_Object |
| 2480 | select_window_1 (window, recordflag) | 2486 | select_window_1 (window, recordflag) |
| 2481 | register Lisp_Object window; | 2487 | register Lisp_Object window; |
| 2482 | int recordflag; | 2488 | int recordflag; |
| 2483 | { | 2489 | { |
| 2484 | register struct window *w; | 2490 | register struct window *w; |
| 2485 | register struct window *ow = XWINDOW (selected_window); | 2491 | register struct window *ow; |
| 2486 | struct frame *sf; | 2492 | struct frame *sf; |
| 2487 | 2493 | ||
| 2488 | CHECK_LIVE_WINDOW (window, 0); | 2494 | CHECK_LIVE_WINDOW (window, 0); |
| @@ -2496,10 +2502,14 @@ select_window_1 (window, recordflag) | |||
| 2496 | if (EQ (window, selected_window)) | 2502 | if (EQ (window, selected_window)) |
| 2497 | return window; | 2503 | return window; |
| 2498 | 2504 | ||
| 2499 | if (! NILP (ow->buffer)) | 2505 | if (!NILP (selected_window)) |
| 2500 | set_marker_both (ow->pointm, ow->buffer, | 2506 | { |
| 2501 | BUF_PT (XBUFFER (ow->buffer)), | 2507 | ow = XWINDOW (selected_window); |
| 2502 | BUF_PT_BYTE (XBUFFER (ow->buffer))); | 2508 | if (! NILP (ow->buffer)) |
| 2509 | set_marker_both (ow->pointm, ow->buffer, | ||
| 2510 | BUF_PT (XBUFFER (ow->buffer)), | ||
| 2511 | BUF_PT_BYTE (XBUFFER (ow->buffer))); | ||
| 2512 | } | ||
| 2503 | 2513 | ||
| 2504 | selected_window = window; | 2514 | selected_window = window; |
| 2505 | sf = SELECTED_FRAME (); | 2515 | sf = SELECTED_FRAME (); |
| @@ -4383,6 +4393,10 @@ the return value is nil. Otherwise the value is t.") | |||
| 4383 | #endif | 4393 | #endif |
| 4384 | #endif | 4394 | #endif |
| 4385 | 4395 | ||
| 4396 | /* "Swap out" point from the selected window | ||
| 4397 | into its buffer. We do this now, before | ||
| 4398 | restoring the window contents, and prevent it from | ||
| 4399 | being done later on when we select a new window. */ | ||
| 4386 | if (! NILP (XWINDOW (selected_window)->buffer)) | 4400 | if (! NILP (XWINDOW (selected_window)->buffer)) |
| 4387 | { | 4401 | { |
| 4388 | w = XWINDOW (selected_window); | 4402 | w = XWINDOW (selected_window); |
| @@ -4518,6 +4532,11 @@ the return value is nil. Otherwise the value is t.") | |||
| 4518 | } | 4532 | } |
| 4519 | 4533 | ||
| 4520 | FRAME_ROOT_WINDOW (f) = data->root_window; | 4534 | FRAME_ROOT_WINDOW (f) = data->root_window; |
| 4535 | /* Prevent "swapping out point" in the old selected window | ||
| 4536 | using the buffer that has been restored into it. | ||
| 4537 | That swapping out has already been done, | ||
| 4538 | near the beginning of this function. */ | ||
| 4539 | selected_window = Qnil; | ||
| 4521 | Fselect_window (data->current_window); | 4540 | Fselect_window (data->current_window); |
| 4522 | XBUFFER (XWINDOW (selected_window)->buffer)->last_selected_window | 4541 | XBUFFER (XWINDOW (selected_window)->buffer)->last_selected_window |
| 4523 | = selected_window; | 4542 | = selected_window; |