X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/b35ac83e4679311c23e5827bd931096be3131f49..ff5dec5cd103f6a9b030d295b014f0ff81025def:/src/window.c diff --git a/src/window.c b/src/window.c index 2c178a65d2..882f76d975 100644 --- a/src/window.c +++ b/src/window.c @@ -1,7 +1,7 @@ /* Window creation, deletion and examination for GNU Emacs. Does not include redisplay. Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1996, 1997, 1998, 2000, - 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 + 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -54,7 +54,7 @@ along with GNU Emacs. If not, see . */ Lisp_Object Qwindowp, Qwindow_live_p, Qwindow_configuration_p; Lisp_Object Qdisplay_buffer; -Lisp_Object Qscroll_up, Qscroll_down; +Lisp_Object Qscroll_up, Qscroll_down, Qscroll_command; Lisp_Object Qwindow_size_fixed; extern Lisp_Object Qleft_margin, Qright_margin; @@ -4648,12 +4648,15 @@ grow_mini_window (w, delta) struct window *root; xassert (MINI_WINDOW_P (w)); - xassert (delta >= 0); + /* Commenting out the following assertion goes against the stated interface + of the function, but it currently does not seem to do anything useful. + See discussion of this issue in the thread for bug#4534. + xassert (delta >= 0); */ /* Compute how much we can enlarge the mini-window without deleting other windows. */ root = XWINDOW (FRAME_ROOT_WINDOW (f)); - if (delta) + if (delta > 0) { int min_height = window_min_size (root, 0, 0, 0, 0); if (XFASTINT (root->total_lines) - delta < min_height) @@ -4939,12 +4942,13 @@ window_scroll_pixel_based (window, n, whole, noerror) if (!NILP (Vscroll_preserve_screen_position)) { /* We preserve the goal pixel coordinate across consecutive - calls to scroll-up or scroll-down. This avoids the + calls to scroll-up, scroll-down and other commands that + have the `scroll-command' property. This avoids the possibility of point becoming "stuck" on a tall line when scrolling by one line. */ if (window_scroll_pixel_based_preserve_y < 0 - || (!EQ (current_kboard->Vlast_command, Qscroll_up) - && !EQ (current_kboard->Vlast_command, Qscroll_down))) + || !SYMBOLP (current_kboard->Vlast_command) + || NILP (Fget (current_kboard->Vlast_command, Qscroll_command))) { start_display (&it, w, start); move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS); @@ -5204,8 +5208,8 @@ window_scroll_line_based (window, n, whole, noerror) if (!NILP (Vscroll_preserve_screen_position)) { if (window_scroll_preserve_vpos <= 0 - || (!EQ (current_kboard->Vlast_command, Qscroll_up) - && !EQ (current_kboard->Vlast_command, Qscroll_down))) + || !SYMBOLP (current_kboard->Vlast_command) + || NILP (Fget (current_kboard->Vlast_command, Qscroll_command))) { struct position posit = *compute_motion (startpos, 0, 0, 0, @@ -7167,33 +7171,39 @@ init_window () void syms_of_window () { - Qscroll_up = intern ("scroll-up"); + Qscroll_up = intern_c_string ("scroll-up"); staticpro (&Qscroll_up); - Qscroll_down = intern ("scroll-down"); + Qscroll_down = intern_c_string ("scroll-down"); staticpro (&Qscroll_down); - Qwindow_size_fixed = intern ("window-size-fixed"); + Qscroll_command = intern_c_string ("scroll-command"); + staticpro (&Qscroll_command); + + Fput (Qscroll_up, Qscroll_command, Qt); + Fput (Qscroll_down, Qscroll_command, Qt); + + Qwindow_size_fixed = intern_c_string ("window-size-fixed"); staticpro (&Qwindow_size_fixed); Fset (Qwindow_size_fixed, Qnil); staticpro (&Qwindow_configuration_change_hook); Qwindow_configuration_change_hook - = intern ("window-configuration-change-hook"); + = intern_c_string ("window-configuration-change-hook"); - Qwindowp = intern ("windowp"); + Qwindowp = intern_c_string ("windowp"); staticpro (&Qwindowp); - Qwindow_configuration_p = intern ("window-configuration-p"); + Qwindow_configuration_p = intern_c_string ("window-configuration-p"); staticpro (&Qwindow_configuration_p); - Qwindow_live_p = intern ("window-live-p"); + Qwindow_live_p = intern_c_string ("window-live-p"); staticpro (&Qwindow_live_p); - Qdisplay_buffer = intern ("display-buffer"); + Qdisplay_buffer = intern_c_string ("display-buffer"); staticpro (&Qdisplay_buffer); - Qtemp_buffer_show_hook = intern ("temp-buffer-show-hook"); + Qtemp_buffer_show_hook = intern_c_string ("temp-buffer-show-hook"); staticpro (&Qtemp_buffer_show_hook); staticpro (&Vwindow_list); @@ -7262,7 +7272,9 @@ at the scroll margin or window boundary respectively. A value of t means point keeps its screen position if the scroll command moved it vertically out of the window, e.g. when scrolling by full screens. -Any other value means point always keeps its screen position. */); +Any other value means point always keeps its screen position. +Scroll commands should have the `scroll-command' property +on their symbols to be controlled by this variable. */); Vscroll_preserve_screen_position = Qnil; DEFVAR_LISP ("window-point-insertion-type", &Vwindow_point_insertion_type, @@ -7374,12 +7386,9 @@ keys_of_window () initial_define_key (control_x_map, '<', "scroll-left"); initial_define_key (control_x_map, '>', "scroll-right"); - initial_define_key (global_map, Ctl ('V'), "scroll-up"); + initial_define_key (global_map, Ctl ('V'), "scroll-up-command"); initial_define_key (meta_map, Ctl ('V'), "scroll-other-window"); - initial_define_key (meta_map, 'v', "scroll-down"); - - initial_define_key (global_map, Ctl('L'), "recenter"); - initial_define_key (meta_map, 'r', "move-to-window-line"); + initial_define_key (meta_map, 'v', "scroll-down-command"); } /* arch-tag: 90a9c576-0590-48f1-a5f1-6c96a0452d9f