aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2010-04-14 03:11:21 +0300
committerJuri Linkov2010-04-14 03:11:21 +0300
commit9013a7f82ede2a309498ae62ac22dce4791b3f4a (patch)
treea2e43ba2c9834b95365810c61cc47c07a87e93d2
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.
-rw-r--r--etc/NEWS3
-rw-r--r--lisp/ChangeLog9
-rw-r--r--lisp/mwheel.el2
-rw-r--r--lisp/simple.el4
-rw-r--r--src/ChangeLog8
-rw-r--r--src/window.c24
6 files changed, 45 insertions, 5 deletions
diff --git a/etc/NEWS b/etc/NEWS
index e52f43767fb..b559b9c93a6 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -75,6 +75,9 @@ of buffer at first key-press (instead moves to top/bottom of buffer).
75** New scrolling commands `scroll-up-line' and `scroll-down-line' 75** New scrolling commands `scroll-up-line' and `scroll-down-line'
76scroll a line instead of full screen. 76scroll a line instead of full screen.
77 77
78** New variable `scroll-preserve-screen-position-commands' defines
79a list of scroll command affected by `scroll-preserve-screen-position.
80
78 81
79* Editing Changes in Emacs 24.1 82* Editing Changes in Emacs 24.1
80 83
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 9a439444831..8baac73bd9a 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,12 @@
12010-04-14 Juri Linkov <juri@jurta.org>
2
3 * mwheel.el (scroll-preserve-screen-position-commands):
4 Add mwheel-scroll to this list of commands.
5
6 * simple.el (scroll-preserve-screen-position-commands):
7 Add scroll-up-command, scroll-down-command, scroll-up-line,
8 scroll-down-line to this list of commands.
9
12010-04-13 Stefan Monnier <monnier@iro.umontreal.ca> 102010-04-13 Stefan Monnier <monnier@iro.umontreal.ca>
2 11
3 * obsolete/complete.el: Move from lisp/complete.el. 12 * obsolete/complete.el: Move from lisp/complete.el.
diff --git a/lisp/mwheel.el b/lisp/mwheel.el
index c505833502a..f88b2e86503 100644
--- a/lisp/mwheel.el
+++ b/lisp/mwheel.el
@@ -246,6 +246,8 @@ This should only be bound to mouse buttons 4 and 5."
246 (run-with-timer mouse-wheel-inhibit-click-time nil 246 (run-with-timer mouse-wheel-inhibit-click-time nil
247 'mwheel-inhibit-click-timeout)))) 247 'mwheel-inhibit-click-timeout))))
248 248
249(add-to-list 'scroll-preserve-screen-position-commands 'mwheel-scroll)
250
249(defvar mwheel-installed-bindings nil) 251(defvar mwheel-installed-bindings nil)
250 252
251;; preloaded ;;;###autoload 253;; preloaded ;;;###autoload
diff --git a/lisp/simple.el b/lisp/simple.el
index 66ea9ebebd9..60fe6c875d2 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -4771,6 +4771,7 @@ If ARG is the atom `-', scroll downward by nearly full screen."
4771 (goto-char (point-max)))))))) 4771 (goto-char (point-max))))))))
4772 4772
4773(put 'scroll-up-command 'isearch-scroll t) 4773(put 'scroll-up-command 'isearch-scroll t)
4774(add-to-list 'scroll-preserve-screen-position-commands 'scroll-up-command)
4774 4775
4775(defun scroll-down-command (&optional arg) 4776(defun scroll-down-command (&optional arg)
4776 "Scroll text of selected window down ARG lines; or near full screen if no ARG. 4777 "Scroll text of selected window down ARG lines; or near full screen if no ARG.
@@ -4799,6 +4800,7 @@ If ARG is the atom `-', scroll upward by nearly full screen."
4799 (goto-char (point-min)))))))) 4800 (goto-char (point-min))))))))
4800 4801
4801(put 'scroll-down-command 'isearch-scroll t) 4802(put 'scroll-down-command 'isearch-scroll t)
4803(add-to-list 'scroll-preserve-screen-position-commands 'scroll-down-command)
4802 4804
4803;;; Scrolling commands which scroll a line instead of full screen. 4805;;; Scrolling commands which scroll a line instead of full screen.
4804 4806
@@ -4810,6 +4812,7 @@ This is different from `scroll-up-command' that scrolls a full screen."
4810 (scroll-up (or arg 1))) 4812 (scroll-up (or arg 1)))
4811 4813
4812(put 'scroll-up-line 'isearch-scroll t) 4814(put 'scroll-up-line 'isearch-scroll t)
4815(add-to-list 'scroll-preserve-screen-position-commands 'scroll-up-line)
4813 4816
4814(defun scroll-down-line (&optional arg) 4817(defun scroll-down-line (&optional arg)
4815 "Scroll text of selected window down ARG lines; or one line if no ARG. 4818 "Scroll text of selected window down ARG lines; or one line if no ARG.
@@ -4819,6 +4822,7 @@ This is different from `scroll-down-command' that scrolls a full screen."
4819 (scroll-down (or arg 1))) 4822 (scroll-down (or arg 1)))
4820 4823
4821(put 'scroll-down-line 'isearch-scroll t) 4824(put 'scroll-down-line 'isearch-scroll t)
4825(add-to-list 'scroll-preserve-screen-position-commands 'scroll-down-line)
4822 4826
4823 4827
4824(defun scroll-other-window-down (lines) 4828(defun scroll-other-window-down (lines)
diff --git a/src/ChangeLog b/src/ChangeLog
index a8e8aa7ddfb..e4130a64838 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,11 @@
12010-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
12010-04-13 Jan Djärv <jan.h.d@swipnet.se> 92010-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
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;