diff options
| author | Miles Bader | 2008-01-30 07:57:28 +0000 |
|---|---|---|
| committer | Miles Bader | 2008-01-30 07:57:28 +0000 |
| commit | d235ca2ff8fab139ce797757fcb159d1e28fa7e0 (patch) | |
| tree | 96c5cd1a06a0d9dc26e8470c6eabfc032c0046f3 /src/window.c | |
| parent | 3709a060f679dba14df71ae64a0035fa2b5b3106 (diff) | |
| parent | 02cbe062bee38a6705bafb1699d77e3c44cfafcf (diff) | |
| download | emacs-d235ca2ff8fab139ce797757fcb159d1e28fa7e0.tar.gz emacs-d235ca2ff8fab139ce797757fcb159d1e28fa7e0.zip | |
Merge from emacs--devo--0
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-324
Diffstat (limited to 'src/window.c')
| -rw-r--r-- | src/window.c | 57 |
1 files changed, 43 insertions, 14 deletions
diff --git a/src/window.c b/src/window.c index a6648685d4b..d1e3225e198 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -3307,6 +3307,25 @@ Fset_window_buffer_unwind (obuf) | |||
| 3307 | EXFUN (Fset_window_fringes, 4); | 3307 | EXFUN (Fset_window_fringes, 4); |
| 3308 | EXFUN (Fset_window_scroll_bars, 4); | 3308 | EXFUN (Fset_window_scroll_bars, 4); |
| 3309 | 3309 | ||
| 3310 | void | ||
| 3311 | run_window_configuration_change_hook (struct frame *f) | ||
| 3312 | { | ||
| 3313 | if (! NILP (Vwindow_configuration_change_hook) | ||
| 3314 | && ! NILP (Vrun_hooks)) | ||
| 3315 | { | ||
| 3316 | int count = SPECPDL_INDEX (); | ||
| 3317 | if (SELECTED_FRAME () != f) | ||
| 3318 | { | ||
| 3319 | Lisp_Object frame; | ||
| 3320 | XSETFRAME (frame, f); | ||
| 3321 | record_unwind_protect (Fselect_frame, Fselected_frame ()); | ||
| 3322 | Fselect_frame (frame); | ||
| 3323 | } | ||
| 3324 | call1 (Vrun_hooks, Qwindow_configuration_change_hook); | ||
| 3325 | unbind_to (count, Qnil); | ||
| 3326 | } | ||
| 3327 | } | ||
| 3328 | |||
| 3310 | /* Make WINDOW display BUFFER as its contents. RUN_HOOKS_P non-zero | 3329 | /* Make WINDOW display BUFFER as its contents. RUN_HOOKS_P non-zero |
| 3311 | means it's allowed to run hooks. See make_frame for a case where | 3330 | means it's allowed to run hooks. See make_frame for a case where |
| 3312 | it's not allowed. KEEP_MARGINS_P non-zero means that the current | 3331 | it's not allowed. KEEP_MARGINS_P non-zero means that the current |
| @@ -3321,6 +3340,7 @@ set_window_buffer (window, buffer, run_hooks_p, keep_margins_p) | |||
| 3321 | struct window *w = XWINDOW (window); | 3340 | struct window *w = XWINDOW (window); |
| 3322 | struct buffer *b = XBUFFER (buffer); | 3341 | struct buffer *b = XBUFFER (buffer); |
| 3323 | int count = SPECPDL_INDEX (); | 3342 | int count = SPECPDL_INDEX (); |
| 3343 | int samebuf = EQ (buffer, w->buffer); | ||
| 3324 | 3344 | ||
| 3325 | w->buffer = buffer; | 3345 | w->buffer = buffer; |
| 3326 | 3346 | ||
| @@ -3339,16 +3359,28 @@ set_window_buffer (window, buffer, run_hooks_p, keep_margins_p) | |||
| 3339 | XSETFASTINT (w->window_end_vpos, 0); | 3359 | XSETFASTINT (w->window_end_vpos, 0); |
| 3340 | bzero (&w->last_cursor, sizeof w->last_cursor); | 3360 | bzero (&w->last_cursor, sizeof w->last_cursor); |
| 3341 | w->window_end_valid = Qnil; | 3361 | w->window_end_valid = Qnil; |
| 3342 | w->hscroll = w->min_hscroll = make_number (0); | 3362 | if (!(keep_margins_p && samebuf)) |
| 3343 | w->vscroll = 0; | 3363 | { /* If we're not actually changing the buffer, Don't reset hscroll and |
| 3344 | set_marker_both (w->pointm, buffer, BUF_PT (b), BUF_PT_BYTE (b)); | 3364 | vscroll. This case happens for example when called from |
| 3345 | set_marker_restricted (w->start, | 3365 | change_frame_size_1, where we use a dummy call to |
| 3346 | make_number (b->last_window_start), | 3366 | Fset_window_buffer on the frame's selected window (and no other) |
| 3347 | buffer); | 3367 | just in order to run window-configuration-change-hook. |
| 3348 | w->start_at_line_beg = Qnil; | 3368 | Resetting hscroll and vscroll here is problematic for things like |
| 3349 | w->force_start = Qnil; | 3369 | image-mode and doc-view-mode since it resets the image's position |
| 3350 | XSETFASTINT (w->last_modified, 0); | 3370 | whenever we resize the frame. */ |
| 3351 | XSETFASTINT (w->last_overlay_modified, 0); | 3371 | w->hscroll = w->min_hscroll = make_number (0); |
| 3372 | w->vscroll = 0; | ||
| 3373 | set_marker_both (w->pointm, buffer, BUF_PT (b), BUF_PT_BYTE (b)); | ||
| 3374 | set_marker_restricted (w->start, | ||
| 3375 | make_number (b->last_window_start), | ||
| 3376 | buffer); | ||
| 3377 | w->start_at_line_beg = Qnil; | ||
| 3378 | w->force_start = Qnil; | ||
| 3379 | XSETFASTINT (w->last_modified, 0); | ||
| 3380 | XSETFASTINT (w->last_overlay_modified, 0); | ||
| 3381 | } | ||
| 3382 | /* Maybe we could move this into the `if' but it's not obviously safe and | ||
| 3383 | I doubt it's worth the trouble. */ | ||
| 3352 | windows_or_buffers_changed++; | 3384 | windows_or_buffers_changed++; |
| 3353 | 3385 | ||
| 3354 | /* We must select BUFFER for running the window-scroll-functions. | 3386 | /* We must select BUFFER for running the window-scroll-functions. |
| @@ -3395,10 +3427,7 @@ set_window_buffer (window, buffer, run_hooks_p, keep_margins_p) | |||
| 3395 | if (! NILP (Vwindow_scroll_functions)) | 3427 | if (! NILP (Vwindow_scroll_functions)) |
| 3396 | run_hook_with_args_2 (Qwindow_scroll_functions, window, | 3428 | run_hook_with_args_2 (Qwindow_scroll_functions, window, |
| 3397 | Fmarker_position (w->start)); | 3429 | Fmarker_position (w->start)); |
| 3398 | 3430 | run_window_configuration_change_hook (XFRAME (WINDOW_FRAME (w))); | |
| 3399 | if (! NILP (Vwindow_configuration_change_hook) | ||
| 3400 | && ! NILP (Vrun_hooks)) | ||
| 3401 | call1 (Vrun_hooks, Qwindow_configuration_change_hook); | ||
| 3402 | } | 3431 | } |
| 3403 | 3432 | ||
| 3404 | unbind_to (count, Qnil); | 3433 | unbind_to (count, Qnil); |