aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2010-04-16 02:51:12 +0300
committerJuri Linkov2010-04-16 02:51:12 +0300
commita4b000fb3dc67a7eedc388acf47c2002b4918665 (patch)
treecde30031369835c89e5729e877e6a86bf81456af
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.
-rw-r--r--etc/NEWS4
-rw-r--r--lisp/ChangeLog13
-rw-r--r--lisp/isearch.el2
-rw-r--r--lisp/mwheel.el3
-rw-r--r--lisp/simple.el8
-rw-r--r--src/ChangeLog12
-rw-r--r--src/window.c35
7 files changed, 49 insertions, 28 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 6bb48fe59b0..e08dabbea1e 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -76,8 +76,8 @@ when a new variable `scroll-error-top-bottom' is non-nil.
76** New scrolling commands `scroll-up-line' and `scroll-down-line' 76** New scrolling commands `scroll-up-line' and `scroll-down-line'
77scroll a line instead of full screen. 77scroll a line instead of full screen.
78 78
79** New variable `scroll-preserve-screen-position-commands' defines 79** New property `scroll-command' should be set on a command's symbol to
80a list of scroll command affected by `scroll-preserve-screen-position. 80define it as a scroll command affected by `scroll-preserve-screen-position.
81 81
82 82
83* Editing Changes in Emacs 24.1 83* Editing Changes in Emacs 24.1
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 5ac0723343b..6aeb1b1f1c2 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,16 @@
12010-04-15 Juri Linkov <juri@jurta.org>
2
3 * simple.el (scroll-up-command, scroll-down-command)
4 (scroll-up-line, scroll-down-line): Put `scroll-command'
5 property on the these symbols. Remove them from
6 `scroll-preserve-screen-position-commands'.
7
8 * mwheel.el (mwheel-scroll): Put `scroll-command' and
9 `isearch-scroll' properties on the `mwheel-scroll' symbol.
10 Remove it from `scroll-preserve-screen-position-commands'.
11
12 * isearch.el (isearch-allow-scroll): Doc fix.
13
12010-04-15 Michael Albinus <michael.albinus@gmx.de> 142010-04-15 Michael Albinus <michael.albinus@gmx.de>
2 15
3 * net/tramp.el (tramp-error-with-buffer): Don't show the 16 * net/tramp.el (tramp-error-with-buffer): Don't show the
diff --git a/lisp/isearch.el b/lisp/isearch.el
index d0ad330c5c0..3684c8e320a 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -1757,7 +1757,7 @@ Scroll-bar or mode-line events are processed appropriately."
1757 "Whether scrolling is allowed during incremental search. 1757 "Whether scrolling is allowed during incremental search.
1758If non-nil, scrolling commands can be used in Isearch mode. 1758If non-nil, scrolling commands can be used in Isearch mode.
1759However, the current match will never scroll offscreen. 1759However, the current match will never scroll offscreen.
1760If nil, scolling commands will first cancel Isearch mode." 1760If nil, scrolling commands will first cancel Isearch mode."
1761 :type 'boolean 1761 :type 'boolean
1762 :group 'isearch) 1762 :group 'isearch)
1763 1763
diff --git a/lisp/mwheel.el b/lisp/mwheel.el
index f88b2e86503..224920e515f 100644
--- a/lisp/mwheel.el
+++ b/lisp/mwheel.el
@@ -246,7 +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) 249(put 'mwheel-scroll 'scroll-command t)
250(put 'mwheel-scroll 'isearch-scroll t)
250 251
251(defvar mwheel-installed-bindings nil) 252(defvar mwheel-installed-bindings nil)
252 253
diff --git a/lisp/simple.el b/lisp/simple.el
index d071c76e2b1..bb8f1b65651 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -4792,8 +4792,8 @@ If ARG is the atom `-', scroll downward by nearly full screen."
4792 ;; move to the bottom of the buffer. 4792 ;; move to the bottom of the buffer.
4793 (goto-char (point-max)))))))) 4793 (goto-char (point-max))))))))
4794 4794
4795(put 'scroll-up-command 'scroll-command t)
4795(put 'scroll-up-command 'isearch-scroll t) 4796(put 'scroll-up-command 'isearch-scroll t)
4796(add-to-list 'scroll-preserve-screen-position-commands 'scroll-up-command)
4797 4797
4798(defun scroll-down-command (&optional arg) 4798(defun scroll-down-command (&optional arg)
4799 "Scroll text of selected window down ARG lines; or near full screen if no ARG. 4799 "Scroll text of selected window down ARG lines; or near full screen if no ARG.
@@ -4825,8 +4825,8 @@ If ARG is the atom `-', scroll upward by nearly full screen."
4825 ;; move to the top of the buffer. 4825 ;; move to the top of the buffer.
4826 (goto-char (point-min)))))))) 4826 (goto-char (point-min))))))))
4827 4827
4828(put 'scroll-down-command 'scroll-command t)
4828(put 'scroll-down-command 'isearch-scroll t) 4829(put 'scroll-down-command 'isearch-scroll t)
4829(add-to-list 'scroll-preserve-screen-position-commands 'scroll-down-command)
4830 4830
4831;;; Scrolling commands which scroll a line instead of full screen. 4831;;; Scrolling commands which scroll a line instead of full screen.
4832 4832
@@ -4837,8 +4837,8 @@ This is different from `scroll-up-command' that scrolls a full screen."
4837 (interactive "p") 4837 (interactive "p")
4838 (scroll-up (or arg 1))) 4838 (scroll-up (or arg 1)))
4839 4839
4840(put 'scroll-up-line 'scroll-command t)
4840(put 'scroll-up-line 'isearch-scroll t) 4841(put 'scroll-up-line 'isearch-scroll t)
4841(add-to-list 'scroll-preserve-screen-position-commands 'scroll-up-line)
4842 4842
4843(defun scroll-down-line (&optional arg) 4843(defun scroll-down-line (&optional arg)
4844 "Scroll text of selected window down ARG lines; or one line if no ARG. 4844 "Scroll text of selected window down ARG lines; or one line if no ARG.
@@ -4847,8 +4847,8 @@ This is different from `scroll-down-command' that scrolls a full screen."
4847 (interactive "p") 4847 (interactive "p")
4848 (scroll-down (or arg 1))) 4848 (scroll-down (or arg 1)))
4849 4849
4850(put 'scroll-down-line 'scroll-command t)
4850(put 'scroll-down-line 'isearch-scroll t) 4851(put 'scroll-down-line 'isearch-scroll t)
4851(add-to-list 'scroll-preserve-screen-position-commands 'scroll-down-line)
4852 4852
4853 4853
4854(defun scroll-other-window-down (lines) 4854(defun scroll-other-window-down (lines)
diff --git a/src/ChangeLog b/src/ChangeLog
index 0ab926b8bb3..9d89f51001a 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,15 @@
12010-04-15 Juri Linkov <juri@jurta.org>
2
3 * window.c: Add Qscroll_command.
4 Remove Vscroll_preserve_screen_position_commands.
5 (window_scroll_pixel_based, window_scroll_line_based): Check the
6 `scroll-command' property on the last command instead of searching
7 the last command in Vscroll_preserve_screen_position_commands.
8 (syms_of_window): Initialize and staticpro `Qscroll_command'.
9 Put Qscroll_command property on Qscroll_up and Qscroll_down.
10 (scroll-preserve-screen-position): Doc fix.
11 (Vscroll_preserve_screen_position_commands): Remove variable.
12
12010-04-15 Dan Nicolaescu <dann@ics.uci.edu> 132010-04-15 Dan Nicolaescu <dann@ics.uci.edu>
2 14
3 * xdisp.c (message): Do not use NO_ARG_ARRAY. 15 * xdisp.c (message): Do not use NO_ARG_ARRAY.
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;