aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.c
diff options
context:
space:
mode:
authorJuri Linkov2010-04-16 02:51:12 +0300
committerJuri Linkov2010-04-16 02:51:12 +0300
commita4b000fb3dc67a7eedc388acf47c2002b4918665 (patch)
treecde30031369835c89e5729e877e6a86bf81456af /src/window.c
parent4874f5e6d6a2d6d121814cb1638d78e5f1cd3b83 (diff)
downloademacs-a4b000fb3dc67a7eedc388acf47c2002b4918665.tar.gz
emacs-a4b000fb3dc67a7eedc388acf47c2002b4918665.zip
Add the `scroll-command' property.
* window.c: Add Qscroll_command. Remove Vscroll_preserve_screen_position_commands. (window_scroll_pixel_based, window_scroll_line_based): Check the `scroll-command' property on the last command instead of searching the last command in Vscroll_preserve_screen_position_commands. (syms_of_window): Initialize and staticpro `Qscroll_command'. Put Qscroll_command property on Qscroll_up and Qscroll_down. (scroll-preserve-screen-position): Doc fix. (Vscroll_preserve_screen_position_commands): Remove variable. * simple.el (scroll-up-command, scroll-down-command) (scroll-up-line, scroll-down-line): Put `scroll-command' property on the these symbols. Remove them from `scroll-preserve-screen-position-commands'. * mwheel.el (mwheel-scroll): Put `scroll-command' and `isearch-scroll' properties on the `mwheel-scroll' symbol. Remove it from `scroll-preserve-screen-position-commands'. * isearch.el (isearch-allow-scroll): Doc fix.
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c35
1 files changed, 15 insertions, 20 deletions
diff --git a/src/window.c b/src/window.c
index b9683fbbca8..882f76d9758 100644
--- a/src/window.c
+++ b/src/window.c
@@ -54,7 +54,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
54 54
55Lisp_Object Qwindowp, Qwindow_live_p, Qwindow_configuration_p; 55Lisp_Object Qwindowp, Qwindow_live_p, Qwindow_configuration_p;
56Lisp_Object Qdisplay_buffer; 56Lisp_Object Qdisplay_buffer;
57Lisp_Object Qscroll_up, Qscroll_down; 57Lisp_Object Qscroll_up, Qscroll_down, Qscroll_command;
58Lisp_Object Qwindow_size_fixed; 58Lisp_Object Qwindow_size_fixed;
59 59
60extern Lisp_Object Qleft_margin, Qright_margin; 60extern Lisp_Object Qleft_margin, Qright_margin;
@@ -168,10 +168,6 @@ 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
175/* Non-nil means that text is inserted before window's markers. */ 171/* Non-nil means that text is inserted before window's markers. */
176 172
177Lisp_Object Vwindow_point_insertion_type; 173Lisp_Object Vwindow_point_insertion_type;
@@ -4946,12 +4942,13 @@ window_scroll_pixel_based (window, n, whole, noerror)
4946 if (!NILP (Vscroll_preserve_screen_position)) 4942 if (!NILP (Vscroll_preserve_screen_position))
4947 { 4943 {
4948 /* We preserve the goal pixel coordinate across consecutive 4944 /* We preserve the goal pixel coordinate across consecutive
4949 calls to scroll-up or scroll-down. This avoids the 4945 calls to scroll-up, scroll-down and other commands that
4946 have the `scroll-command' property. This avoids the
4950 possibility of point becoming "stuck" on a tall line when 4947 possibility of point becoming "stuck" on a tall line when
4951 scrolling by one line. */ 4948 scrolling by one line. */
4952 if (window_scroll_pixel_based_preserve_y < 0 4949 if (window_scroll_pixel_based_preserve_y < 0
4953 || NILP (Fmemq (current_kboard->Vlast_command, 4950 || !SYMBOLP (current_kboard->Vlast_command)
4954 Vscroll_preserve_screen_position_commands))) 4951 || NILP (Fget (current_kboard->Vlast_command, Qscroll_command)))
4955 { 4952 {
4956 start_display (&it, w, start); 4953 start_display (&it, w, start);
4957 move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS); 4954 move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS);
@@ -5211,8 +5208,8 @@ window_scroll_line_based (window, n, whole, noerror)
5211 if (!NILP (Vscroll_preserve_screen_position)) 5208 if (!NILP (Vscroll_preserve_screen_position))
5212 { 5209 {
5213 if (window_scroll_preserve_vpos <= 0 5210 if (window_scroll_preserve_vpos <= 0
5214 || NILP (Fmemq (current_kboard->Vlast_command, 5211 || !SYMBOLP (current_kboard->Vlast_command)
5215 Vscroll_preserve_screen_position_commands))) 5212 || NILP (Fget (current_kboard->Vlast_command, Qscroll_command)))
5216 { 5213 {
5217 struct position posit 5214 struct position posit
5218 = *compute_motion (startpos, 0, 0, 0, 5215 = *compute_motion (startpos, 0, 0, 0,
@@ -7180,6 +7177,12 @@ syms_of_window ()
7180 Qscroll_down = intern_c_string ("scroll-down"); 7177 Qscroll_down = intern_c_string ("scroll-down");
7181 staticpro (&Qscroll_down); 7178 staticpro (&Qscroll_down);
7182 7179
7180 Qscroll_command = intern_c_string ("scroll-command");
7181 staticpro (&Qscroll_command);
7182
7183 Fput (Qscroll_up, Qscroll_command, Qt);
7184 Fput (Qscroll_down, Qscroll_command, Qt);
7185
7183 Qwindow_size_fixed = intern_c_string ("window-size-fixed"); 7186 Qwindow_size_fixed = intern_c_string ("window-size-fixed");
7184 staticpro (&Qwindow_size_fixed); 7187 staticpro (&Qwindow_size_fixed);
7185 Fset (Qwindow_size_fixed, Qnil); 7188 Fset (Qwindow_size_fixed, Qnil);
@@ -7270,18 +7273,10 @@ A value of t means point keeps its screen position if the scroll
7270command moved it vertically out of the window, e.g. when scrolling 7273command moved it vertically out of the window, e.g. when scrolling
7271by full screens. 7274by full screens.
7272Any other value means point always keeps its screen position. 7275Any other value means point always keeps its screen position.
7273Scroll commands are defined by the variable 7276Scroll commands should have the `scroll-command' property
7274`scroll-preserve-screen-position-commands'. */); 7277on their symbols to be controlled by this variable. */);
7275 Vscroll_preserve_screen_position = Qnil; 7278 Vscroll_preserve_screen_position = Qnil;
7276 7279
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
7285 DEFVAR_LISP ("window-point-insertion-type", &Vwindow_point_insertion_type, 7280 DEFVAR_LISP ("window-point-insertion-type", &Vwindow_point_insertion_type,
7286 doc: /* Type of marker to use for `window-point'. */); 7281 doc: /* Type of marker to use for `window-point'. */);
7287 Vwindow_point_insertion_type = Qnil; 7282 Vwindow_point_insertion_type = Qnil;