diff options
| author | Juri Linkov | 2010-04-14 03:11:21 +0300 |
|---|---|---|
| committer | Juri Linkov | 2010-04-14 03:11:21 +0300 |
| commit | 9013a7f82ede2a309498ae62ac22dce4791b3f4a (patch) | |
| tree | a2e43ba2c9834b95365810c61cc47c07a87e93d2 /src | |
| parent | 92848133b2c17d028b2172b6f3ef43e6c1a1370c (diff) | |
| download | emacs-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')
| -rw-r--r-- | src/ChangeLog | 8 | ||||
| -rw-r--r-- | src/window.c | 24 |
2 files changed, 27 insertions, 5 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index a8e8aa7ddfb..e4130a64838 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2010-04-14 Juri Linkov <juri@jurta.org> | ||
| 2 | |||
| 3 | * window.c (Vscroll_preserve_screen_position_commands): New variable | ||
| 4 | with the default value as the list of Qscroll_down and Qscroll_up. | ||
| 5 | (window_scroll_pixel_based, window_scroll_line_based): Search the | ||
| 6 | last command in the list Vscroll_preserve_screen_position_commands | ||
| 7 | instead of comparing with Qscroll_up and Qscroll_down. | ||
| 8 | |||
| 1 | 2010-04-13 Jan Djärv <jan.h.d@swipnet.se> | 9 | 2010-04-13 Jan Djärv <jan.h.d@swipnet.se> |
| 2 | 10 | ||
| 3 | * gtkutil.c (xg_set_geometry): Set geometry for PPosition also. | 11 | * gtkutil.c (xg_set_geometry): Set geometry for PPosition also. |
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 | ||
| 169 | Lisp_Object Vscroll_preserve_screen_position; | 169 | Lisp_Object Vscroll_preserve_screen_position; |
| 170 | 170 | ||
| 171 | /* List of commands affected by `Vscroll_preserve_screen_position'. */ | ||
| 172 | |||
| 173 | Lisp_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 | ||
| 173 | Lisp_Object Vwindow_point_insertion_type; | 177 | Lisp_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. | |||
| 7265 | A value of t means point keeps its screen position if the scroll | 7269 | A value of t means point keeps its screen position if the scroll |
| 7266 | command moved it vertically out of the window, e.g. when scrolling | 7270 | command moved it vertically out of the window, e.g. when scrolling |
| 7267 | by full screens. | 7271 | by full screens. |
| 7268 | Any other value means point always keeps its screen position. */); | 7272 | Any other value means point always keeps its screen position. |
| 7273 | Scroll 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. | ||
| 7280 | This 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; |