diff options
| author | Richard M. Stallman | 1992-09-26 08:15:35 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1992-09-26 08:15:35 +0000 |
| commit | 947da0c4ce7c0a3716b936e08aa5994da97a9b14 (patch) | |
| tree | d2071d7eb33607393409a1a64604a19720a9515a | |
| parent | ab6ee1a0bc38c62f88afca770598cd2ddc42042b (diff) | |
| download | emacs-947da0c4ce7c0a3716b936e08aa5994da97a9b14.tar.gz emacs-947da0c4ce7c0a3716b936e08aa5994da97a9b14.zip | |
(mouse-split-window-vertically): Use @.
(mouse-split-window-horizontally): New command.
Use S-mouse-2 for them.
(mouse-delete-window): Put on mode-line mouse-3.
(mouse-save-then-kill): New command, on mouse-3.
(mouse-delete-other-windows): Use @. Now on mode-line mouse-1.
(mouse-scroll-down, mouse-scroll-up): Use e, get line from event.
(mouse-scroll-move-cursor): Likewise.
(mouse-scroll-left, mouse-scroll-right): Likewise for column.
(mouse-scroll-move-cursor-horizontally): Likewise.
| -rw-r--r-- | lisp/mouse.el | 82 |
1 files changed, 56 insertions, 26 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el index 1297325186e..c6aa6ca1d0a 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el | |||
| @@ -38,26 +38,30 @@ | |||
| 38 | 38 | ||
| 39 | 39 | ||
| 40 | (defun mouse-delete-window (click) | 40 | (defun mouse-delete-window (click) |
| 41 | "Delete the window clicked on. | 41 | "Delete the window you click on. |
| 42 | This must be bound to a mouse click." | 42 | This must be bound to a mouse click." |
| 43 | (interactive "e") | 43 | (interactive "e") |
| 44 | (delete-window (event-window click))) | 44 | (delete-window (event-window click))) |
| 45 | 45 | ||
| 46 | (defun mouse-delete-other-windows (click) | 46 | (defun mouse-delete-other-windows (click) |
| 47 | "Select Emacs window clicked on, then kill all other Emacs windows. | 47 | "Delete all window except the one you click on." |
| 48 | This must be bound to a mouse click." | 48 | (interactive "@e") |
| 49 | (interactive "e") | ||
| 50 | (select-window (event-window click)) | ||
| 51 | (delete-other-windows)) | 49 | (delete-other-windows)) |
| 52 | 50 | ||
| 53 | (defun mouse-split-window-vertically (click) | 51 | (defun mouse-split-window-vertically (click) |
| 54 | "Select Emacs window mouse is on, then split it vertically in half. | 52 | "Select Emacs window mouse is on, then split it vertically in half. |
| 55 | The window is split at the line clicked on. | 53 | The window is split at the line clicked on. |
| 56 | This command must be bound to a mouse click." | 54 | This command must be bound to a mouse click." |
| 57 | (interactive "e") | 55 | (interactive "@e") |
| 58 | (select-window (event-window click)) | ||
| 59 | (split-window-vertically (1+ (cdr (mouse-coords click))))) | 56 | (split-window-vertically (1+ (cdr (mouse-coords click))))) |
| 60 | 57 | ||
| 58 | (defun mouse-split-window-horizontally (click) | ||
| 59 | "Select Emacs window mouse is on, then split it horizontally in half. | ||
| 60 | The window is split at the column clicked on. | ||
| 61 | This command must be bound to a mouse click." | ||
| 62 | (interactive "@e") | ||
| 63 | (split-window-horizontally (1+ (car (mouse-coords click))))) | ||
| 64 | |||
| 61 | (defun mouse-set-point (click) | 65 | (defun mouse-set-point (click) |
| 62 | "Move point to the position clicked on with the mouse. | 66 | "Move point to the position clicked on with the mouse. |
| 63 | This must be bound to a mouse click." | 67 | This must be bound to a mouse click." |
| @@ -101,6 +105,23 @@ This does not delete the region; it acts like \\[kill-ring-save]." | |||
| 101 | (mouse-set-mark click) | 105 | (mouse-set-mark click) |
| 102 | (call-interactively 'kill-ring-save)) | 106 | (call-interactively 'kill-ring-save)) |
| 103 | 107 | ||
| 108 | (defun mouse-save-then-kill (click) | ||
| 109 | "Copy the region between point and the mouse click in the kill ring. | ||
| 110 | This does not delete the region; it acts like \\[kill-ring-save]." | ||
| 111 | (interactive "e") | ||
| 112 | (mouse-set-mark click) | ||
| 113 | (if (string= (buffer-substring (point) (mark)) (car kill-ring)) | ||
| 114 | ;; If this text was already saved in kill ring, | ||
| 115 | ;; now delete it from the buffer. | ||
| 116 | (progn | ||
| 117 | (let ((buffer-undo-list t)) | ||
| 118 | (delete-region (point) (mark))) | ||
| 119 | ;; Make the undo list by hand so it is shared. | ||
| 120 | (setq buffer-undo-list | ||
| 121 | (cons (cons (car kill-ring) (point)) buffer-undo-list))) | ||
| 122 | ;; Otherwise, save this region. | ||
| 123 | (call-interactively 'kill-ring-save))) | ||
| 124 | |||
| 104 | (defun mouse-buffer-menu (event) | 125 | (defun mouse-buffer-menu (event) |
| 105 | "Pop up a menu of buffers for selection with the mouse." | 126 | "Pop up a menu of buffers for selection with the mouse." |
| 106 | (interactive "e") | 127 | (interactive "e") |
| @@ -127,13 +148,13 @@ This does not delete the region; it acts like \\[kill-ring-save]." | |||
| 127 | 148 | ||
| 128 | ;; Commands for the scroll bar. | 149 | ;; Commands for the scroll bar. |
| 129 | 150 | ||
| 130 | (defun mouse-scroll-down (nlines) | 151 | (defun mouse-scroll-down (click) |
| 131 | (interactive "@p") | 152 | (interactive "@e") |
| 132 | (scroll-down nlines)) | 153 | (scroll-down (1+ (cdr (mouse-coords click))))) |
| 133 | 154 | ||
| 134 | (defun mouse-scroll-up (nlines) | 155 | (defun mouse-scroll-up (click) |
| 135 | (interactive "@p") | 156 | (interactive "@e") |
| 136 | (scroll-up nlines)) | 157 | (scroll-up (1+ (cdr (mouse-coords click))))) |
| 137 | 158 | ||
| 138 | (defun mouse-scroll-down-full () | 159 | (defun mouse-scroll-down-full () |
| 139 | (interactive "@") | 160 | (interactive "@") |
| @@ -143,9 +164,9 @@ This does not delete the region; it acts like \\[kill-ring-save]." | |||
| 143 | (interactive "@") | 164 | (interactive "@") |
| 144 | (scroll-up nil)) | 165 | (scroll-up nil)) |
| 145 | 166 | ||
| 146 | (defun mouse-scroll-move-cursor (nlines) | 167 | (defun mouse-scroll-move-cursor (click) |
| 147 | (interactive "@p") | 168 | (interactive "@e") |
| 148 | (move-to-window-line nlines)) | 169 | (move-to-window-line (1+ (cdr (mouse-coords click))))) |
| 149 | 170 | ||
| 150 | (defun mouse-scroll-absolute (event) | 171 | (defun mouse-scroll-absolute (event) |
| 151 | (interactive "@e") | 172 | (interactive "@e") |
| @@ -161,13 +182,13 @@ This does not delete the region; it acts like \\[kill-ring-save]." | |||
| 161 | (goto-char newpos) | 182 | (goto-char newpos) |
| 162 | (recenter '(4))))) | 183 | (recenter '(4))))) |
| 163 | 184 | ||
| 164 | (defun mouse-scroll-left (ncolumns) | 185 | (defun mouse-scroll-left (click) |
| 165 | (interactive "@p") | 186 | (interactive "@e") |
| 166 | (scroll-left ncolumns)) | 187 | (scroll-left (1+ (car (mouse-coords click))))) |
| 167 | 188 | ||
| 168 | (defun mouse-scroll-right (ncolumns) | 189 | (defun mouse-scroll-right (ncolumns) |
| 169 | (interactive "@p") | 190 | (interactive "@e") |
| 170 | (scroll-right ncolumns)) | 191 | (scroll-right (1+ (car (mouse-coords click))))) |
| 171 | 192 | ||
| 172 | (defun mouse-scroll-left-full () | 193 | (defun mouse-scroll-left-full () |
| 173 | (interactive "@") | 194 | (interactive "@") |
| @@ -177,9 +198,9 @@ This does not delete the region; it acts like \\[kill-ring-save]." | |||
| 177 | (interactive "@") | 198 | (interactive "@") |
| 178 | (scroll-right nil)) | 199 | (scroll-right nil)) |
| 179 | 200 | ||
| 180 | (defun mouse-scroll-move-cursor-horizontally (ncolumns) | 201 | (defun mouse-scroll-move-cursor-horizontally (click) |
| 181 | (interactive "@p") | 202 | (interactive "@e") |
| 182 | (move-to-column ncolumns)) | 203 | (move-to-column (1+ (car (mouse-coords click))))) |
| 183 | 204 | ||
| 184 | (defun mouse-scroll-absolute-horizontally (event) | 205 | (defun mouse-scroll-absolute-horizontally (event) |
| 185 | (interactive "@e") | 206 | (interactive "@e") |
| @@ -223,6 +244,13 @@ This does not delete the region; it acts like \\[kill-ring-save]." | |||
| 223 | (global-set-key [thumbright mouse-1] 'mouse-scroll-right-full) | 244 | (global-set-key [thumbright mouse-1] 'mouse-scroll-right-full) |
| 224 | (global-set-key [thumbright mouse-2] 'mouse-scroll-right-full) | 245 | (global-set-key [thumbright mouse-2] 'mouse-scroll-right-full) |
| 225 | (global-set-key [thumbright mouse-3] 'mouse-scroll-right-full) | 246 | (global-set-key [thumbright mouse-3] 'mouse-scroll-right-full) |
| 247 | |||
| 248 | (global-set-key [horizontal-scroll-bar S-mouse-2] | ||
| 249 | 'mouse-split-window-horizontally) | ||
| 250 | (global-set-key [mode-line S-mouse-2] | ||
| 251 | 'mouse-split-window-horizontally) | ||
| 252 | (global-set-key [vertical-scroll-bar S-mouse-2] | ||
| 253 | 'mouse-split-window) | ||
| 226 | 254 | ||
| 227 | ;;;; | 255 | ;;;; |
| 228 | ;;;; Here are experimental things being tested. Mouse events | 256 | ;;;; Here are experimental things being tested. Mouse events |
| @@ -513,8 +541,7 @@ This does not delete the region; it acts like \\[kill-ring-save]." | |||
| 513 | (global-set-key [down-mouse-1] 'mouse-set-point) | 541 | (global-set-key [down-mouse-1] 'mouse-set-point) |
| 514 | (global-set-key [drag-mouse-1] 'mouse-set-mark) | 542 | (global-set-key [drag-mouse-1] 'mouse-set-mark) |
| 515 | (global-set-key [mouse-2] 'mouse-yank-at-click) | 543 | (global-set-key [mouse-2] 'mouse-yank-at-click) |
| 516 | (global-set-key [mouse-3] 'mouse-kill-ring-save) | 544 | (global-set-key [mouse-3] 'mouse-save-then-kill) |
| 517 | (global-set-key [S-mouse-3] 'mouse-kill) | ||
| 518 | 545 | ||
| 519 | (global-set-key [C-mouse-1] 'mouse-buffer-menu) | 546 | (global-set-key [C-mouse-1] 'mouse-buffer-menu) |
| 520 | 547 | ||
| @@ -522,6 +549,9 @@ This does not delete the region; it acts like \\[kill-ring-save]." | |||
| 522 | 549 | ||
| 523 | ;; Replaced with dragging mouse-1 | 550 | ;; Replaced with dragging mouse-1 |
| 524 | ;; (global-set-key [S-mouse-1] 'mouse-set-mark) | 551 | ;; (global-set-key [S-mouse-1] 'mouse-set-mark) |
| 552 | |||
| 553 | (global-set-key [mode-line mouse-1] 'mouse-delete-other-windows) | ||
| 554 | (global-set-key [mode-line mouse-3] 'mouse-delete-window) | ||
| 525 | 555 | ||
| 526 | ;; Define the mouse help menu tree. | 556 | ;; Define the mouse help menu tree. |
| 527 | 557 | ||