aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.c
diff options
context:
space:
mode:
authorJoakim Verona2012-12-17 20:26:49 +0100
committerJoakim Verona2012-12-17 20:26:49 +0100
commit50f3874cc956355007e2fefc9d7663ea6dea1794 (patch)
treec6e1067f3c7296481dae8048d321f19cc7536279 /src/window.c
parentbf7be49be8c23196dce8110d8d7b40351ee7f85d (diff)
parent1e101a4be420878653f42a9f5e105adfb6690229 (diff)
downloademacs-50f3874cc956355007e2fefc9d7663ea6dea1794.tar.gz
emacs-50f3874cc956355007e2fefc9d7663ea6dea1794.zip
auto upstream
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/window.c b/src/window.c
index 3e3cd3a571c..56db79a57d5 100644
--- a/src/window.c
+++ b/src/window.c
@@ -488,7 +488,6 @@ static Lisp_Object
488select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap) 488select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap)
489{ 489{
490 register struct window *w; 490 register struct window *w;
491 register struct window *ow;
492 struct frame *sf; 491 struct frame *sf;
493 492
494 CHECK_LIVE_WINDOW (window); 493 CHECK_LIVE_WINDOW (window);
@@ -524,12 +523,25 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap)
524 else 523 else
525 fset_selected_window (sf, window); 524 fset_selected_window (sf, window);
526 525
526 select_window_1 (window, inhibit_point_swap);
527
528 bset_last_selected_window (XBUFFER (w->buffer), window);
529 windows_or_buffers_changed++;
530 return window;
531}
532
533/* Select window with a minimum of fuss, i.e. don't record the change anywhere
534 (not even for rediaplay's benefit), and assume that the window's frame is
535 already selected. */
536void
537select_window_1 (Lisp_Object window, bool inhibit_point_swap)
538{
527 /* Store the old selected window's buffer's point in pointm of the old 539 /* Store the old selected window's buffer's point in pointm of the old
528 selected window. It belongs to that window, and when the window is 540 selected window. It belongs to that window, and when the window is
529 not selected, must be in the window. */ 541 not selected, must be in the window. */
530 if (!inhibit_point_swap) 542 if (!inhibit_point_swap)
531 { 543 {
532 ow = XWINDOW (selected_window); 544 struct window *ow = XWINDOW (selected_window);
533 if (! NILP (ow->buffer)) 545 if (! NILP (ow->buffer))
534 set_marker_both (ow->pointm, ow->buffer, 546 set_marker_both (ow->pointm, ow->buffer,
535 BUF_PT (XBUFFER (ow->buffer)), 547 BUF_PT (XBUFFER (ow->buffer)),
@@ -537,7 +549,6 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap)
537 } 549 }
538 550
539 selected_window = window; 551 selected_window = window;
540 bset_last_selected_window (XBUFFER (w->buffer), window);
541 552
542 /* Go to the point recorded in the window. 553 /* Go to the point recorded in the window.
543 This is important when the buffer is in more 554 This is important when the buffer is in more
@@ -545,7 +556,7 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap)
545 redisplay_window has altered point after scrolling, 556 redisplay_window has altered point after scrolling,
546 because it makes the change only in the window. */ 557 because it makes the change only in the window. */
547 { 558 {
548 register ptrdiff_t new_point = marker_position (w->pointm); 559 register ptrdiff_t new_point = marker_position (XWINDOW (window)->pointm);
549 if (new_point < BEGV) 560 if (new_point < BEGV)
550 SET_PT (BEGV); 561 SET_PT (BEGV);
551 else if (new_point > ZV) 562 else if (new_point > ZV)
@@ -553,9 +564,6 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap)
553 else 564 else
554 SET_PT (new_point); 565 SET_PT (new_point);
555 } 566 }
556
557 windows_or_buffers_changed++;
558 return window;
559} 567}
560 568
561DEFUN ("select-window", Fselect_window, Sselect_window, 1, 2, 0, 569DEFUN ("select-window", Fselect_window, Sselect_window, 1, 2, 0,