aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.c
diff options
context:
space:
mode:
authorJuri Linkov2010-04-14 03:11:21 +0300
committerJuri Linkov2010-04-14 03:11:21 +0300
commit9013a7f82ede2a309498ae62ac22dce4791b3f4a (patch)
treea2e43ba2c9834b95365810c61cc47c07a87e93d2 /src/window.c
parent92848133b2c17d028b2172b6f3ef43e6c1a1370c (diff)
downloademacs-9013a7f82ede2a309498ae62ac22dce4791b3f4a.tar.gz
emacs-9013a7f82ede2a309498ae62ac22dce4791b3f4a.zip
Add variable `scroll-preserve-screen-position-commands'.
http://lists.gnu.org/archive/html/emacs-devel/2010-04/msg00403.html * window.c (Vscroll_preserve_screen_position_commands): New variable with the default value as the list of Qscroll_down and Qscroll_up. (window_scroll_pixel_based, window_scroll_line_based): Search the last command in the list Vscroll_preserve_screen_position_commands instead of comparing with Qscroll_up and Qscroll_down. * mwheel.el (scroll-preserve-screen-position-commands): Add mwheel-scroll to this list of commands. * simple.el (scroll-preserve-screen-position-commands): Add scroll-up-command, scroll-down-command, scroll-up-line, scroll-down-line to this list of commands.
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/window.c b/src/window.c
index f17a645f82c..2757b98ddd9 100644
--- a/src/window.c
+++ b/src/window.c
@@ -168,6 +168,10 @@ static Lisp_Object Vwindow_configuration_change_hook;
168 168
169Lisp_Object Vscroll_preserve_screen_position; 169Lisp_Object Vscroll_preserve_screen_position;
170 170
171/* List of commands affected by `Vscroll_preserve_screen_position'. */
172
173Lisp_Object Vscroll_preserve_screen_position_commands;
174
171/* Non-nil means that text is inserted before window's markers. */ 175/* Non-nil means that text is inserted before window's markers. */
172 176
173Lisp_Object Vwindow_point_insertion_type; 177Lisp_Object Vwindow_point_insertion_type;
@@ -4946,8 +4950,8 @@ window_scroll_pixel_based (window, n, whole, noerror)
4946 possibility of point becoming "stuck" on a tall line when 4950 possibility of point becoming "stuck" on a tall line when
4947 scrolling by one line. */ 4951 scrolling by one line. */
4948 if (window_scroll_pixel_based_preserve_y < 0 4952 if (window_scroll_pixel_based_preserve_y < 0
4949 || (!EQ (current_kboard->Vlast_command, Qscroll_up) 4953 || NILP (Fmemq (current_kboard->Vlast_command,
4950 && !EQ (current_kboard->Vlast_command, Qscroll_down))) 4954 Vscroll_preserve_screen_position_commands)))
4951 { 4955 {
4952 start_display (&it, w, start); 4956 start_display (&it, w, start);
4953 move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS); 4957 move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS);
@@ -5207,8 +5211,8 @@ window_scroll_line_based (window, n, whole, noerror)
5207 if (!NILP (Vscroll_preserve_screen_position)) 5211 if (!NILP (Vscroll_preserve_screen_position))
5208 { 5212 {
5209 if (window_scroll_preserve_vpos <= 0 5213 if (window_scroll_preserve_vpos <= 0
5210 || (!EQ (current_kboard->Vlast_command, Qscroll_up) 5214 || NILP (Fmemq (current_kboard->Vlast_command,
5211 && !EQ (current_kboard->Vlast_command, Qscroll_down))) 5215 Vscroll_preserve_screen_position_commands)))
5212 { 5216 {
5213 struct position posit 5217 struct position posit
5214 = *compute_motion (startpos, 0, 0, 0, 5218 = *compute_motion (startpos, 0, 0, 0,
@@ -7265,9 +7269,19 @@ at the scroll margin or window boundary respectively.
7265A value of t means point keeps its screen position if the scroll 7269A value of t means point keeps its screen position if the scroll
7266command moved it vertically out of the window, e.g. when scrolling 7270command moved it vertically out of the window, e.g. when scrolling
7267by full screens. 7271by full screens.
7268Any other value means point always keeps its screen position. */); 7272Any other value means point always keeps its screen position.
7273Scroll commands are defined by the variable
7274`scroll-preserve-screen-position-commands'. */);
7269 Vscroll_preserve_screen_position = Qnil; 7275 Vscroll_preserve_screen_position = Qnil;
7270 7276
7277 DEFVAR_LISP ("scroll-preserve-screen-position-commands",
7278 &Vscroll_preserve_screen_position_commands,
7279 doc: /* A list of commands whose scrolling should keep screen position unchanged.
7280This list defines the names of scroll commands affected by the variable
7281`scroll-preserve-screen-position'. */);
7282 Vscroll_preserve_screen_position_commands =
7283 Fcons (Qscroll_down, Fcons (Qscroll_up, Qnil));
7284
7271 DEFVAR_LISP ("window-point-insertion-type", &Vwindow_point_insertion_type, 7285 DEFVAR_LISP ("window-point-insertion-type", &Vwindow_point_insertion_type,
7272 doc: /* Type of marker to use for `window-point'. */); 7286 doc: /* Type of marker to use for `window-point'. */);
7273 Vwindow_point_insertion_type = Qnil; 7287 Vwindow_point_insertion_type = Qnil;