diff options
| author | Richard M. Stallman | 1994-02-02 20:43:50 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-02-02 20:43:50 +0000 |
| commit | d9f132a8acbbc2f4d5043b6f17f9f897ada96135 (patch) | |
| tree | c9b987a4b249d6ab2326dad306135110306b6309 | |
| parent | eeb1e03e1e7511e56a022a261e277e7af08f640c (diff) | |
| download | emacs-d9f132a8acbbc2f4d5043b6f17f9f897ada96135.tar.gz emacs-d9f132a8acbbc2f4d5043b6f17f9f897ada96135.zip | |
Doc fix.
| -rw-r--r-- | lisp/avoid.el | 47 |
1 files changed, 35 insertions, 12 deletions
diff --git a/lisp/avoid.el b/lisp/avoid.el index 31f160ff37c..27c851b78b8 100644 --- a/lisp/avoid.el +++ b/lisp/avoid.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; avoid.el -- make mouse pointer stay out of the way of editing. | 1 | ;;; avoid.el -- make mouse pointer stay out of the way of editing. |
| 2 | 2 | ||
| 3 | ;;; Copyright (C) 1993 Free Software Foundation, Inc. | 3 | ;;; Copyright (C) 1993, 1994 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Boris Goldowsky <boris@cs.rochester.edu> | 5 | ;; Author: Boris Goldowsky <boris@cs.rochester.edu> |
| 6 | ;; Keywords: mouse | 6 | ;; Keywords: mouse |
| @@ -36,6 +36,8 @@ | |||
| 36 | ;;; (mouse-avoidance-mode 'cat-and-mouse))) | 36 | ;;; (mouse-avoidance-mode 'cat-and-mouse))) |
| 37 | ;;; | 37 | ;;; |
| 38 | ;;; The 'animate can be 'jump or 'banish or 'protean if you prefer. | 38 | ;;; The 'animate can be 'jump or 'banish or 'protean if you prefer. |
| 39 | ;;; See the documentation for function `mouse-avoidance-mode' for | ||
| 40 | ;;; details of the different modes. | ||
| 39 | ;;; | 41 | ;;; |
| 40 | ;;; For added silliness, make the animatee animate... | 42 | ;;; For added silliness, make the animatee animate... |
| 41 | ;;; put something similar to the following into your .emacs: | 43 | ;;; put something similar to the following into your .emacs: |
| @@ -52,9 +54,10 @@ | |||
| 52 | ;;; | 54 | ;;; |
| 53 | ;;; Bugs & Warnings: | 55 | ;;; Bugs & Warnings: |
| 54 | ;;; | 56 | ;;; |
| 55 | ;;; - THIS CODE IS FOR USE WITH FSF EMACS 19.21 or later. | 57 | ;;; - Due to a bug in (mouse-position), this code can cause emacs |
| 56 | ;;; It can cause earlier versions of emacs to crash, due to a bug in the | 58 | ;;; 19.22 to crash when deleting a frame if the mouse has not moved |
| 57 | ;;; mouse code. | 59 | ;;; since creating the frame. Versions earlier than 19.21 will |
| 60 | ;;; crash more easily; this program should not be used with them. | ||
| 58 | ;;; | 61 | ;;; |
| 59 | ;;; - Using this code does slow emacs down. "banish" mode shouldn't | 62 | ;;; - Using this code does slow emacs down. "banish" mode shouldn't |
| 60 | ;;; ever be too bad though, and on my workstation even "animate" doesn't | 63 | ;;; ever be too bad though, and on my workstation even "animate" doesn't |
| @@ -137,8 +140,8 @@ Only applies in mouse-avoidance-modes `animate' and `jump'.") | |||
| 137 | (while (<= i 1) | 140 | (while (<= i 1) |
| 138 | (set-mouse-position | 141 | (set-mouse-position |
| 139 | (car cur) | 142 | (car cur) |
| 140 | (mod (+ (car (cdr cur)) (round (* i deltax))) (window-width)) | 143 | (mod (+ (car (cdr cur)) (round (* i deltax))) (frame-width)) |
| 141 | (mod (+ (cdr (cdr cur)) (round (* i deltay))) (window-height))) | 144 | (mod (+ (cdr (cdr cur)) (round (* i deltay))) (frame-height))) |
| 142 | (setq i (+ i (/ 1.0 mouse-avoidance-nudge-dist))) | 145 | (setq i (+ i (/ 1.0 mouse-avoidance-nudge-dist))) |
| 143 | (if (eq mouse-avoidance-mode 'proteus) | 146 | (if (eq mouse-avoidance-mode 'proteus) |
| 144 | (progn | 147 | (progn |
| @@ -170,12 +173,17 @@ redefine this function to suit your own tastes." | |||
| 170 | 173 | ||
| 171 | (defun mouse-avoidance-simple-hook () | 174 | (defun mouse-avoidance-simple-hook () |
| 172 | (if (and (mouse-avoidance-keyboard-command (this-command-keys))) | 175 | (if (and (mouse-avoidance-keyboard-command (this-command-keys))) |
| 173 | (mouse-avoidance-banish-mouse))) | 176 | (progn |
| 177 | (raise-frame (selected-frame)) | ||
| 178 | (mouse-avoidance-banish-mouse)))) | ||
| 174 | 179 | ||
| 175 | (defun mouse-avoidance-fancy-hook () | 180 | (defun mouse-avoidance-fancy-hook () |
| 176 | (if (and (mouse-avoidance-keyboard-command (this-command-keys)) | 181 | (if (and (mouse-avoidance-keyboard-command (this-command-keys)) |
| 177 | (mouse-avoidance-too-close-p)) | 182 | (mouse-avoidance-too-close-p)) |
| 178 | (mouse-avoidance-nudge-mouse))) | 183 | (let ((old-pos (mouse-position))) |
| 184 | (mouse-avoidance-nudge-mouse) | ||
| 185 | (if (not (eq (selected-frame) (car old-pos))) | ||
| 186 | (apply 'set-mouse-position old-pos))))) | ||
| 179 | 187 | ||
| 180 | (defun mouse-avoidance-keyboard-command (key) | 188 | (defun mouse-avoidance-keyboard-command (key) |
| 181 | "Return t if the KEYSEQENCE is composed of keyboard events only. | 189 | "Return t if the KEYSEQENCE is composed of keyboard events only. |
| @@ -195,10 +203,25 @@ Returns nil if there are any lists in the key sequence." | |||
| 195 | (defun mouse-avoidance-mode (&optional mode) | 203 | (defun mouse-avoidance-mode (&optional mode) |
| 196 | "Set cursor avoidance mode to MODE. | 204 | "Set cursor avoidance mode to MODE. |
| 197 | MODE should be one of the symbols `banish', `jump', `animate', | 205 | MODE should be one of the symbols `banish', `jump', `animate', |
| 198 | `cat-and-mouse', or `none'. `Animate' is the same as `cat-and-mouse'. | 206 | `cat-and-mouse', `proteus', or `none'. |
| 199 | If MODE is nil, toggle mouse avoidance. Positive numbers and | 207 | |
| 200 | symbols other than the above are treated as equivalent to `banish'; | 208 | If MODE is nil, toggle mouse avoidance between `none' and `banish' |
| 201 | negative numbers and `-' are equivalent to `none'." | 209 | modes. Positive numbers and symbols other than the above are treated |
| 210 | as equivalent to `banish'; negative numbers and `-' are equivalent to `none'. | ||
| 211 | |||
| 212 | Effects of the different modes: | ||
| 213 | * BANISH: Move the mouse to the upper-right corner on any keypress. | ||
| 214 | Also raises the frame. | ||
| 215 | * JUMP: If the cursor gets too close to the mouse, displace the mouse | ||
| 216 | a random distance & direction. If this would put it in another, | ||
| 217 | overlapping frame, it is put back \(until the next keypress). | ||
| 218 | * ANIMATE: As `jump', but shows steps along the way for illusion of motion. | ||
| 219 | * CAT-AND-MOUSE: Same as `animate'. | ||
| 220 | * PROTEUS: As `animate', but changes the shape of the mouse pointer too. | ||
| 221 | |||
| 222 | \(see `mouse-avoidance-threshhold' for definition of \"too close\", | ||
| 223 | and `mouse-avoidance-nudge-dist' and `mouse-avoidance-nudge-var' for | ||
| 224 | definition of \"random distance\".)" | ||
| 202 | (interactive | 225 | (interactive |
| 203 | (list (intern (completing-read | 226 | (list (intern (completing-read |
| 204 | "Select cursor avoidance technique (SPACE for list): " | 227 | "Select cursor avoidance technique (SPACE for list): " |