X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/4f9d7df139695e97cd1772d41940500480585df7..7132e457ad3d5c6eec1c1eb78e1b7409d1fd5631:/lisp/mouse-drag.el diff --git a/lisp/mouse-drag.el b/lisp/mouse-drag.el index ead45d4395..3a29e05c8b 100644 --- a/lisp/mouse-drag.el +++ b/lisp/mouse-drag.el @@ -1,7 +1,6 @@ ;;; mouse-drag.el --- use mouse-2 to do a new style of scrolling -;; Copyright (C) 1996, 1997, 2001, 2002, 2003, 2004, -;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +;; Copyright (C) 1996-1997, 2001-2013 Free Software Foundation, Inc. ;; Author: John Heidemann ;; Keywords: mouse @@ -47,7 +46,7 @@ ;; If you like mouse-drag, you should also check out mouse-copy ;; for ``one-click text copy and move''. ;; -;; To use mouse-drag, place the following in your .emacs file: +;; To use mouse-drag, place the following in your init file: ;; -either- ;; (global-set-key [down-mouse-2] 'mouse-drag-throw) ;; -or- @@ -163,14 +162,14 @@ Basically, we check for existing horizontal scrolling." mouse-drag-electric-col-scrolling (save-excursion ;; on a long line? (let - ((beg (progn (beginning-of-line) (point))) + ((beg (line-beginning-position)) (end (progn (end-of-line) (point)))) (if (> (- end beg) (window-width)) (setq truncate-lines t) nil)))))) (defvar mouse-throw-with-scroll-bar nil - "*Set direction of mouse-throwing. + "Set direction of mouse-throwing. If nil, the text moves in the direction the mouse moves. If t, the scroll bar moves in the direction the mouse moves.") (defconst mouse-throw-magnifier-min -6) @@ -195,7 +194,7 @@ from the original mouse click to the current mouse location. Try it; you'll like it. It's easier to observe than to explain. If the mouse is clicked and released in the same place of time we -assume that the user didn't want to scdebugroll but wanted to whatever +assume that the user didn't want to scroll but wanted to whatever mouse-2 used to do, so we pass it through. Throw scrolling was inspired (but is not identical to) the \"hand\" @@ -215,13 +214,10 @@ To test this function, evaluate: (start-row (cdr (posn-col-row start-posn))) (start-col (car (posn-col-row start-posn))) (old-selected-window (selected-window)) - event end row mouse-delta scroll-delta + event end row scroll-delta have-scrolled - window-last-row - col mouse-col-delta window-last-col + col (scroll-col-delta 0) - adjusted-mouse-col-delta - adjusted-mouse-delta ;; be conservative about allowing horizontal scrolling (col-scrolling-p (mouse-drag-should-do-col-scrolling))) (select-window start-window) @@ -276,10 +272,10 @@ To test this function, evaluate: (start-row (cdr (posn-col-row start-posn))) (start-col (car (posn-col-row start-posn))) (old-selected-window (selected-window)) - event end row mouse-delta scroll-delta + event end row scroll-delta have-scrolled window-last-row - col mouse-col-delta window-last-col + col window-last-col (scroll-col-delta 0) ;; be conservative about allowing horizontal scrolling (col-scrolling-p (mouse-drag-should-do-col-scrolling))) @@ -326,5 +322,4 @@ To test this function, evaluate: (provide 'mouse-drag) -;; arch-tag: e47354ff-82f5-42c4-b3dc-88dd9c04b770 ;;; mouse-drag.el ends here