diff options
| author | Richard M. Stallman | 2002-05-30 17:04:59 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2002-05-30 17:04:59 +0000 |
| commit | 243a5ce664a064bfe86652d2fe31f04bcf52c781 (patch) | |
| tree | 22dba2fa4954d6e1d2ce769153eae42a2d8b476c /src/window.c | |
| parent | c02dd51a9811300140c63c5e3821239d14fce036 (diff) | |
| download | emacs-243a5ce664a064bfe86652d2fe31f04bcf52c781.tar.gz emacs-243a5ce664a064bfe86652d2fe31f04bcf52c781.zip | |
(Fset_window_configuration): Correct the handling
of point in current buffer, to work with multiple windows.
Diffstat (limited to 'src/window.c')
| -rw-r--r-- | src/window.c | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/src/window.c b/src/window.c index 60476414fb2..f73c95bf973 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -4938,7 +4938,6 @@ the return value is nil. Otherwise the value is t. */) | |||
| 4938 | Lisp_Object new_current_buffer; | 4938 | Lisp_Object new_current_buffer; |
| 4939 | Lisp_Object frame; | 4939 | Lisp_Object frame; |
| 4940 | FRAME_PTR f; | 4940 | FRAME_PTR f; |
| 4941 | int old_point = -1; | ||
| 4942 | 4941 | ||
| 4943 | while (!WINDOW_CONFIGURATIONP (configuration)) | 4942 | while (!WINDOW_CONFIGURATIONP (configuration)) |
| 4944 | wrong_type_argument (Qwindow_configuration_p, configuration); | 4943 | wrong_type_argument (Qwindow_configuration_p, configuration); |
| @@ -4949,11 +4948,6 @@ the return value is nil. Otherwise the value is t. */) | |||
| 4949 | new_current_buffer = data->current_buffer; | 4948 | new_current_buffer = data->current_buffer; |
| 4950 | if (NILP (XBUFFER (new_current_buffer)->name)) | 4949 | if (NILP (XBUFFER (new_current_buffer)->name)) |
| 4951 | new_current_buffer = Qnil; | 4950 | new_current_buffer = Qnil; |
| 4952 | else | ||
| 4953 | { | ||
| 4954 | if (XBUFFER (new_current_buffer) == current_buffer) | ||
| 4955 | old_point = PT; | ||
| 4956 | } | ||
| 4957 | 4951 | ||
| 4958 | frame = XWINDOW (SAVED_WINDOW_N (saved_windows, 0)->window)->frame; | 4952 | frame = XWINDOW (SAVED_WINDOW_N (saved_windows, 0)->window)->frame; |
| 4959 | f = XFRAME (frame); | 4953 | f = XFRAME (frame); |
| @@ -5105,8 +5099,8 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5105 | p->mark, w->buffer); | 5099 | p->mark, w->buffer); |
| 5106 | 5100 | ||
| 5107 | /* As documented in Fcurrent_window_configuration, don't | 5101 | /* As documented in Fcurrent_window_configuration, don't |
| 5108 | save the location of point in the buffer which was current | 5102 | restore the location of point in the buffer which was |
| 5109 | when the window configuration was recorded. */ | 5103 | current when the window configuration was recorded. */ |
| 5110 | if (!EQ (p->buffer, new_current_buffer) | 5104 | if (!EQ (p->buffer, new_current_buffer) |
| 5111 | && XBUFFER (p->buffer) == current_buffer) | 5105 | && XBUFFER (p->buffer) == current_buffer) |
| 5112 | Fgoto_char (w->pointm); | 5106 | Fgoto_char (w->pointm); |
| @@ -5144,6 +5138,11 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5144 | That swapping out has already been done, | 5138 | That swapping out has already been done, |
| 5145 | near the beginning of this function. */ | 5139 | near the beginning of this function. */ |
| 5146 | selected_window = Qnil; | 5140 | selected_window = Qnil; |
| 5141 | if (EQ (XWINDOW (data->current_window)->buffer, new_current_buffer)) | ||
| 5142 | set_marker_restricted (XWINDOW (data->current_window)->pointm, | ||
| 5143 | make_number (BUF_PT (XBUFFER (XWINDOW (data->current_window)->buffer))), | ||
| 5144 | XWINDOW (data->current_window)->buffer); | ||
| 5145 | |||
| 5147 | Fselect_window (data->current_window); | 5146 | Fselect_window (data->current_window); |
| 5148 | XBUFFER (XWINDOW (selected_window)->buffer)->last_selected_window | 5147 | XBUFFER (XWINDOW (selected_window)->buffer)->last_selected_window |
| 5149 | = selected_window; | 5148 | = selected_window; |
| @@ -5189,11 +5188,6 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5189 | else if (EQ (leaf_windows[i]->buffer, new_current_buffer)) | 5188 | else if (EQ (leaf_windows[i]->buffer, new_current_buffer)) |
| 5190 | ++n; | 5189 | ++n; |
| 5191 | } | 5190 | } |
| 5192 | |||
| 5193 | /* If more than one window shows the new and old current buffer, | ||
| 5194 | don't try to preserve point in that buffer. */ | ||
| 5195 | if (old_point > 0 && n > 1) | ||
| 5196 | old_point = -1; | ||
| 5197 | 5191 | ||
| 5198 | adjust_glyphs (f); | 5192 | adjust_glyphs (f); |
| 5199 | 5193 | ||
| @@ -5213,15 +5207,7 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5213 | } | 5207 | } |
| 5214 | 5208 | ||
| 5215 | if (!NILP (new_current_buffer)) | 5209 | if (!NILP (new_current_buffer)) |
| 5216 | { | 5210 | Fset_buffer (new_current_buffer); |
| 5217 | Fset_buffer (new_current_buffer); | ||
| 5218 | |||
| 5219 | /* If the buffer that is current now is the same | ||
| 5220 | that was current before setting the window configuration, | ||
| 5221 | don't alter its PT. */ | ||
| 5222 | if (old_point >= 0) | ||
| 5223 | SET_PT (old_point); | ||
| 5224 | } | ||
| 5225 | 5211 | ||
| 5226 | /* Restore the minimum heights recorded in the configuration. */ | 5212 | /* Restore the minimum heights recorded in the configuration. */ |
| 5227 | window_min_height = XINT (data->min_height); | 5213 | window_min_height = XINT (data->min_height); |