]> git.eshelyaron.com Git - emacs.git/commitdiff
Add the `scroll-command' property.
authorJuri Linkov <juri@jurta.org>
Thu, 15 Apr 2010 23:51:12 +0000 (02:51 +0300)
committerJuri Linkov <juri@jurta.org>
Thu, 15 Apr 2010 23:51:12 +0000 (02:51 +0300)
* 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.

etc/NEWS
lisp/ChangeLog
lisp/isearch.el
lisp/mwheel.el
lisp/simple.el
src/ChangeLog
src/window.c

index 6bb48fe59b0d0c8269ca2c1379400a9724302db3..e08dabbea1e0583be7b4dd9b7b2d2b0922f1064e 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -76,8 +76,8 @@ when a new variable `scroll-error-top-bottom' is non-nil.
 ** New scrolling commands `scroll-up-line' and `scroll-down-line'
 scroll a line instead of full screen.
 
-** New variable `scroll-preserve-screen-position-commands' defines
-a list of scroll command affected by `scroll-preserve-screen-position.
+** New property `scroll-command' should be set on a command's symbol to
+define it as a scroll command affected by `scroll-preserve-screen-position.
 
 \f
 * Editing Changes in Emacs 24.1
index 5ac0723343b353fa4db3fad16fcb678a60ad0ace..6aeb1b1f1c24f7e56135bfbfd06a4afc08f1e1e0 100644 (file)
@@ -1,3 +1,16 @@
+2010-04-15  Juri Linkov  <juri@jurta.org>
+
+       * 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.
+
 2010-04-15  Michael Albinus  <michael.albinus@gmx.de>
 
        * net/tramp.el (tramp-error-with-buffer): Don't show the
index d0ad330c5c0b97424bf593d9daa0c87da3fdfb04..3684c8e320a1e25ded4f87a047686055055e5654 100644 (file)
@@ -1757,7 +1757,7 @@ Scroll-bar or mode-line events are processed appropriately."
   "Whether scrolling is allowed during incremental search.
 If non-nil, scrolling commands can be used in Isearch mode.
 However, the current match will never scroll offscreen.
-If nil, scolling commands will first cancel Isearch mode."
+If nil, scrolling commands will first cancel Isearch mode."
   :type 'boolean
   :group 'isearch)
 
index f88b2e86503fd6e5c0dda67a7468f55768dfc0b2..224920e515fa2111f78a5e6c5b339f4ea8c1e76f 100644 (file)
@@ -246,7 +246,8 @@ This should only be bound to mouse buttons 4 and 5."
          (run-with-timer mouse-wheel-inhibit-click-time nil
                          'mwheel-inhibit-click-timeout))))
 
-(add-to-list 'scroll-preserve-screen-position-commands 'mwheel-scroll)
+(put 'mwheel-scroll 'scroll-command t)
+(put 'mwheel-scroll 'isearch-scroll t)
 
 (defvar mwheel-installed-bindings nil)
 
index d071c76e2b18c3c869836625c9448d1a4b03facc..bb8f1b656519fe3d2e4bbf92c7a07bfed6a603e5 100644 (file)
@@ -4792,8 +4792,8 @@ If ARG is the atom `-', scroll downward by nearly full screen."
         ;; move to the bottom of the buffer.
         (goto-char (point-max))))))))
 
+(put 'scroll-up-command 'scroll-command t)
 (put 'scroll-up-command 'isearch-scroll t)
-(add-to-list 'scroll-preserve-screen-position-commands 'scroll-up-command)
 
 (defun scroll-down-command (&optional arg)
   "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."
         ;; move to the top of the buffer.
         (goto-char (point-min))))))))
 
+(put 'scroll-down-command 'scroll-command t)
 (put 'scroll-down-command 'isearch-scroll t)
-(add-to-list 'scroll-preserve-screen-position-commands 'scroll-down-command)
 
 ;;; Scrolling commands which scroll a line instead of full screen.
 
@@ -4837,8 +4837,8 @@ This is different from `scroll-up-command' that scrolls a full screen."
   (interactive "p")
   (scroll-up (or arg 1)))
 
+(put 'scroll-up-line 'scroll-command t)
 (put 'scroll-up-line 'isearch-scroll t)
-(add-to-list 'scroll-preserve-screen-position-commands 'scroll-up-line)
 
 (defun scroll-down-line (&optional arg)
   "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."
   (interactive "p")
   (scroll-down (or arg 1)))
 
+(put 'scroll-down-line 'scroll-command t)
 (put 'scroll-down-line 'isearch-scroll t)
-(add-to-list 'scroll-preserve-screen-position-commands 'scroll-down-line)
 
 \f
 (defun scroll-other-window-down (lines)
index 0ab926b8bb3fd8ef8b1eb898a48a372ed0a88f8e..9d89f51001a60916eec5830e825052c5f10b96ea 100644 (file)
@@ -1,3 +1,15 @@
+2010-04-15  Juri Linkov  <juri@jurta.org>
+
+       * 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.
+
 2010-04-15  Dan Nicolaescu  <dann@ics.uci.edu>
 
        * xdisp.c (message): Do not use NO_ARG_ARRAY.
index b9683fbbca8635c8f2d9aa85e1d797f7ecb4ec05..882f76d9758365d0568928229c04853a1951aa69 100644 (file)
@@ -54,7 +54,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 Lisp_Object Qwindowp, Qwindow_live_p, Qwindow_configuration_p;
 Lisp_Object Qdisplay_buffer;
-Lisp_Object Qscroll_up, Qscroll_down;
+Lisp_Object Qscroll_up, Qscroll_down, Qscroll_command;
 Lisp_Object Qwindow_size_fixed;
 
 extern Lisp_Object Qleft_margin, Qright_margin;
@@ -168,10 +168,6 @@ static Lisp_Object Vwindow_configuration_change_hook;
 
 Lisp_Object Vscroll_preserve_screen_position;
 
-/* List of commands affected by `Vscroll_preserve_screen_position'.  */
-
-Lisp_Object Vscroll_preserve_screen_position_commands;
-
 /* Non-nil means that text is inserted before window's markers.  */
 
 Lisp_Object Vwindow_point_insertion_type;
@@ -4946,12 +4942,13 @@ window_scroll_pixel_based (window, n, whole, noerror)
   if (!NILP (Vscroll_preserve_screen_position))
     {
       /* We preserve the goal pixel coordinate across consecutive
-        calls to scroll-up or scroll-down.  This avoids the
+        calls to scroll-up, scroll-down and other commands that
+        have the `scroll-command' property.  This avoids the
         possibility of point becoming "stuck" on a tall line when
         scrolling by one line.  */
       if (window_scroll_pixel_based_preserve_y < 0
-         || NILP (Fmemq (current_kboard->Vlast_command,
-                         Vscroll_preserve_screen_position_commands)))
+         || !SYMBOLP (current_kboard->Vlast_command)
+         || NILP (Fget (current_kboard->Vlast_command, Qscroll_command)))
        {
          start_display (&it, w, start);
          move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS);
@@ -5211,8 +5208,8 @@ window_scroll_line_based (window, n, whole, noerror)
   if (!NILP (Vscroll_preserve_screen_position))
     {
       if (window_scroll_preserve_vpos <= 0
-         || NILP (Fmemq (current_kboard->Vlast_command,
-                         Vscroll_preserve_screen_position_commands)))
+         || !SYMBOLP (current_kboard->Vlast_command)
+         || NILP (Fget (current_kboard->Vlast_command, Qscroll_command)))
        {
          struct position posit
            = *compute_motion (startpos, 0, 0, 0,
@@ -7180,6 +7177,12 @@ syms_of_window ()
   Qscroll_down = intern_c_string ("scroll-down");
   staticpro (&Qscroll_down);
 
+  Qscroll_command = intern_c_string ("scroll-command");
+  staticpro (&Qscroll_command);
+
+  Fput (Qscroll_up, Qscroll_command, Qt);
+  Fput (Qscroll_down, Qscroll_command, Qt);
+
   Qwindow_size_fixed = intern_c_string ("window-size-fixed");
   staticpro (&Qwindow_size_fixed);
   Fset (Qwindow_size_fixed, Qnil);
@@ -7270,18 +7273,10 @@ A value of t means point keeps its screen position if the scroll
 command moved it vertically out of the window, e.g. when scrolling
 by full screens.
 Any other value means point always keeps its screen position.
-Scroll commands are defined by the variable
-`scroll-preserve-screen-position-commands'.  */);
+Scroll commands should have the `scroll-command' property
+on their symbols to be controlled by this variable.  */);
   Vscroll_preserve_screen_position = Qnil;
 
-  DEFVAR_LISP ("scroll-preserve-screen-position-commands",
-              &Vscroll_preserve_screen_position_commands,
-              doc: /* A list of commands whose scrolling should keep screen position unchanged.
-This list defines the names of scroll commands affected by the variable
-`scroll-preserve-screen-position'.  */);
-  Vscroll_preserve_screen_position_commands =
-    Fcons (Qscroll_down, Fcons (Qscroll_up, Qnil));
-
   DEFVAR_LISP ("window-point-insertion-type", &Vwindow_point_insertion_type,
               doc: /* Type of marker to use for `window-point'.  */);
   Vwindow_point_insertion_type = Qnil;