From: Stefan Monnier Date: Fri, 12 Apr 2013 17:32:52 +0000 (-0400) Subject: * src/window.c (select_window): `record_buffer' even if window is X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~2026^2~483 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=562c6ee9450073547ae45e88116cfc213c2254e0;p=emacs.git * src/window.c (select_window): `record_buffer' even if window is already selected. Fixes: debbugs:14191 --- diff --git a/src/ChangeLog b/src/ChangeLog index 7f4c59b8eb4..08f33eb7d02 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2013-04-12 Stefan Monnier + + * window.c (select_window): `record_buffer' even if window is + already selected (bug#14191). + 2013-04-11 Eli Zaretskii * window.c (Fwindow_end): Test more flags, including the buffer's @@ -10,8 +15,8 @@ 2013-04-10 Eli Zaretskii * frame.c (do_switch_frame): Mark the TTY frame we switch to as - garbaged only if it is not already the top frame on its TTY. This - prevents flickering due to constant redrawing of TTY frames when + garbaged only if it is not already the top frame on its TTY. + This prevents flickering due to constant redrawing of TTY frames when there are GUI frames open in the same session. (Bug#13864) 2013-04-10 Stefan Monnier @@ -95,7 +100,7 @@ The following changes is to optimize the code for reading UTF-8 files. - * coding.c (check_ascii): Renamed from detect_ascii. Return value + * coding.c (check_ascii): Rename from detect_ascii. Return value changed. Check EOL format. Do not call adjust_coding_eol_type here. (check_utf_8): New function. @@ -287,8 +292,8 @@ * xdisp.c (with_echo_area_buffer_unwind_data): Save window start marker... - (unwind_with_echo_area_buffer): ...to restore it here. This - is needed to ensure that... + (unwind_with_echo_area_buffer): ...to restore it here. + This is needed to ensure that... (redisplay_window): ...both window markers are valid here, which is verified by eassert. * editfns.c (save_excursion_save): Do not assume that @@ -438,10 +443,10 @@ * w32term.c (w32fullscreen_hook): Use FRAME_NORMAL_WIDTH, FRAME_NORMAL_HEIGHT, and FRAME_PREV_FSMODE, instead of static - variables, to save and restore frame dimensions. Use - FRAME_NORMAL_LEFT and FRAME_NORMAL_TOP to restore frame position - after returning from a 'fullscreen' configuration. use - SendMessage instead of PostMessage to send the SC_RESTORE message, + variables, to save and restore frame dimensions. + Use FRAME_NORMAL_LEFT and FRAME_NORMAL_TOP to restore frame position + after returning from a 'fullscreen' configuration. + use SendMessage instead of PostMessage to send the SC_RESTORE message, to avoid races between the main thread and the input thread. * w32term.h (struct w32_output): New members normal_width, @@ -526,10 +531,10 @@ * frame.h (struct frame): Drop resx and resy because the same data is available from window system-specific output context. Adjust users. - (default_pixels_per_inch_x, default_pixels_per_inch_y): New - functions to provide defaults when no window system available. + (default_pixels_per_inch_x, default_pixels_per_inch_y): + New functions to provide defaults when no window system available. (FRAME_RES_X, FRAME_RES_Y): New macros. - (NUMVAL): Moved from xdisp.c. + (NUMVAL): Move from xdisp.c. * font.c (font_pixel_size, font_find_for_lface, font_open_for_lface) (Ffont_face_attributes, Fopen_font): * image.c (gs_load): diff --git a/src/window.c b/src/window.c index fe5b5ec1e6e..7cf35a480f7 100644 --- a/src/window.c +++ b/src/window.c @@ -489,7 +489,10 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap) Fset_buffer (w->contents); if (EQ (window, selected_window) && !inhibit_point_swap) - return window; + /* `switch-to-buffer' uses (select-window (selected-window)) as a "clever" + way to call record_buffer from Elisp, so it's important that we call + record_buffer before returning here. */ + goto record_and_return; sf = SELECTED_FRAME (); if (XFRAME (WINDOW_FRAME (w)) != sf) @@ -508,7 +511,10 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap) fset_selected_window (sf, window); select_window_1 (window, inhibit_point_swap); + bset_last_selected_window (XBUFFER (w->contents), window); + windows_or_buffers_changed++; + record_and_return: /* record_buffer can run QUIT, so make sure it is run only after we have re-established the invariant between selected_window and selected_frame, otherwise the temporary broken invariant might "escape" (bug#14161). */ @@ -518,8 +524,6 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap) record_buffer (w->contents); } - bset_last_selected_window (XBUFFER (w->contents), window); - windows_or_buffers_changed++; return window; }