diff options
Diffstat (limited to 'lisp/avoid.el')
-rw-r--r-- | lisp/avoid.el | 38 |
1 files changed, 15 insertions, 23 deletions
diff --git a/lisp/avoid.el b/lisp/avoid.el index b53584ba9c5..d3afecf8cc2 100644 --- a/lisp/avoid.el +++ b/lisp/avoid.el @@ -1,4 +1,4 @@ -;;; avoid.el --- make mouse pointer stay out of the way of editing +;;; avoid.el --- make mouse pointer stay out of the way of editing -*- lexical-binding: t -*- ;; Copyright (C) 1993-1994, 2000-2021 Free Software Foundation, Inc. @@ -25,8 +25,10 @@ ;; For those who are annoyed by the mouse pointer obscuring text, ;; this mode moves the mouse pointer - either just a little out of ;; the way, or all the way to the corner of the frame. -;; To use, load or evaluate this file and type M-x mouse-avoidance-mode . -;; To set up permanently, put the following in your .emacs: +;; +;; To use, type `M-x mouse-avoidance-mode'. +;; +;; To set up permanently, put this in your .emacs: ;; ;; (if (display-mouse-p) (mouse-avoidance-mode 'animate)) ;; @@ -47,11 +49,6 @@ ;; ;; For completely random pointer shape, replace the setq above with: ;; (setq x-pointer-shape (mouse-avoidance-random-shape)) -;; -;; Bugs / Warnings / To-Do: -;; -;; - Using this code does slow Emacs down. "banish" mode shouldn't -;; be too bad, and on my workstation even "animate" is reasonable. ;; Credits: ;; This code was helped by all those who contributed suggestions, @@ -76,14 +73,13 @@ "Activate Mouse Avoidance mode. See function `mouse-avoidance-mode' for possible values. Setting this variable directly does not take effect; -use either \\[customize] or the function `mouse-avoidance-mode'." +use either \\[customize] or \\[mouse-avoidance-mode]." :set (lambda (_symbol value) ;; 'none below prevents toggling when value is nil. (mouse-avoidance-mode (or value 'none))) :initialize 'custom-initialize-default :type '(choice (const :tag "none" nil) (const banish) (const jump) (const animate) (const exile) (const proteus)) - :group 'avoid :require 'avoid :version "20.3") @@ -92,25 +88,21 @@ use either \\[customize] or the function `mouse-avoidance-mode'." "Average distance that mouse will be moved when approached by cursor. Only applies in Mouse Avoidance mode `jump' and its derivatives. For best results make this larger than `mouse-avoidance-threshold'." - :type 'integer - :group 'avoid) + :type 'integer) (defcustom mouse-avoidance-nudge-var 10 "Variability of `mouse-avoidance-nudge-dist' (which see)." - :type 'integer - :group 'avoid) + :type 'integer) (defcustom mouse-avoidance-animation-delay .01 "Delay between animation steps, in seconds." - :type 'number - :group 'avoid) + :type 'number) (defcustom mouse-avoidance-threshold 5 "Mouse-pointer's flight distance. If the cursor gets closer than this, the mouse pointer will move away. Only applies in Mouse Avoidance modes `animate' and `jump'." - :type 'integer - :group 'avoid) + :type 'integer) (defcustom mouse-avoidance-banish-position '((frame-or-window . frame) (side . right) @@ -261,9 +253,9 @@ If you want the mouse banished to a different corner set (t 0)))) (defun mouse-avoidance-nudge-mouse () - ;; Push the mouse a little way away, possibly animating the move. - ;; For these modes, state keeps track of the total offset that we've - ;; accumulated, and tries to keep it close to zero. + "Push the mouse a little way away, possibly animating the move. +For these modes, state keeps track of the total offset that we've +accumulated, and tries to keep it close to zero." (let* ((cur (mouse-position)) (cur-pos (cdr cur)) (pos (window-edges)) @@ -375,7 +367,7 @@ redefine this function to suit your own tastes." (setq mouse-avoidance-state nil)))))) (defun mouse-avoidance-fancy () - ;; Used for the "fancy" modes, ie jump et al. + ;; Used for the "fancy" modes, i.e. jump et al. (if (and (not mouse-avoidance-animating-pointer) (not (mouse-avoidance-ignore-p)) (mouse-avoidance-too-close-p (mouse-position))) @@ -383,7 +375,7 @@ redefine this function to suit your own tastes." (mouse-avoidance-nudge-mouse) (if (not (eq (selected-frame) (car old-pos))) ;; This should never happen. - (apply 'set-mouse-position old-pos))))) + (apply #'set-mouse-position old-pos))))) ;;;###autoload (defun mouse-avoidance-mode (&optional mode) |