35
|
1 ;; Subroutines of Mouse handling for Sun windows
|
|
2 ;; Copyright (C) 1987 Free Software Foundation, Inc.
|
|
3
|
|
4 ;; This file is part of GNU Emacs.
|
|
5
|
|
6 ;; GNU Emacs is free software; you can redistribute it and/or modify
|
|
7 ;; it under the terms of the GNU General Public License as published by
|
|
8 ;; the Free Software Foundation; either version 1, or (at your option)
|
|
9 ;; any later version.
|
|
10
|
|
11 ;; GNU Emacs is distributed in the hope that it will be useful,
|
|
12 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14 ;; GNU General Public License for more details.
|
|
15
|
|
16 ;; You should have received a copy of the GNU General Public License
|
|
17 ;; along with GNU Emacs; see the file COPYING. If not, write to
|
|
18 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
19
|
|
20 ;;; Submitted Mar. 1987, Jeff Peck
|
|
21 ;;; Sun Microsystems Inc. <peck@sun.com>
|
|
22 ;;; Conceived Nov. 1986, Stan Jefferson,
|
|
23 ;;; Computer Science Lab, SRI International.
|
|
24 ;;; GoodIdeas Feb. 1987, Steve Greenbaum
|
|
25 ;;; & UpClicks Reasoning Systems, Inc.
|
|
26 ;;;
|
|
27 (require 'sun-mouse)
|
|
28 ;;;
|
|
29 ;;; Functions for manipulating via the mouse and mouse-map definitions
|
|
30 ;;; for accessing them. Also definitons of mouse menus.
|
|
31 ;;; This file you should freely modify to reflect you personal tastes.
|
|
32 ;;;
|
|
33 ;;; First half of file defines functions to implement mouse commands,
|
|
34 ;;; Don't delete any of those, just add what ever else you need.
|
|
35 ;;; Second half of file defines mouse bindings, do whatever you want there.
|
|
36
|
|
37 ;;;
|
|
38 ;;; Mouse Functions.
|
|
39 ;;;
|
|
40 ;;; These functions follow the sun-mouse-handler convention of being called
|
|
41 ;;; with three arguements: (window x-pos y-pos)
|
|
42 ;;; This makes it easy for a mouse executed command to know where the mouse is.
|
|
43 ;;; Use the macro "eval-in-window" to execute a function
|
|
44 ;;; in a temporarily selected window.
|
|
45 ;;;
|
|
46 ;;; If you have a function that must be called with other arguments
|
|
47 ;;; bind the mouse button to an s-exp that contains the necessary parameters.
|
|
48 ;;; See "minibuffer" bindings for examples.
|
|
49 ;;;
|
|
50 (defconst cursor-pause-milliseconds 300
|
|
51 "*Number of milliseconds to display alternate cursor (usually the mark)")
|
|
52
|
|
53 (defun indicate-region (&optional pause)
|
|
54 "Bounce cursor to mark for cursor-pause-milliseconds and back again"
|
|
55 (or pause (setq pause cursor-pause-milliseconds))
|
|
56 (let ((point (point)))
|
|
57 (goto-char (mark))
|
|
58 (sit-for-millisecs pause)
|
|
59 ;(update-display)
|
|
60 ;(sleep-for-millisecs pause)
|
|
61 (goto-char point)))
|
|
62
|
|
63
|
|
64 ;;;
|
|
65 ;;; Text buffer operations
|
|
66 ;;;
|
|
67 (defun mouse-move-point (window x y)
|
|
68 "Move point to mouse cursor."
|
|
69 (select-window window)
|
|
70 (move-to-loc x y)
|
|
71 (if (memq last-command ; support the mouse-copy/delete/yank
|
|
72 '(mouse-copy mouse-delete mouse-yank-move))
|
|
73 (setq this-command 'mouse-yank-move))
|
|
74 )
|
|
75
|
|
76 (defun mouse-set-mark (window x y)
|
|
77 "Set mark at mouse cursor."
|
|
78 (eval-in-window window ;; use this to get the unwind protect
|
|
79 (let ((point (point)))
|
|
80 (move-to-loc x y)
|
|
81 (set-mark (point))
|
|
82 (goto-char point)
|
|
83 (indicate-region)))
|
|
84 )
|
|
85
|
|
86 (defun mouse-set-mark-and-select (window x y)
|
|
87 "Set mark at mouse cursor, and select that window."
|
|
88 (select-window window)
|
|
89 (mouse-set-mark window x y)
|
|
90 )
|
|
91
|
|
92 (defun mouse-set-mark-and-stuff (w x y)
|
|
93 "Set mark at mouse cursor, and put region in stuff buffer."
|
|
94 (mouse-set-mark-and-select w x y)
|
|
95 (sun-select-region (region-beginning) (region-end)))
|
|
96
|
|
97 ;;;
|
|
98 ;;; Simple mouse dragging stuff: marking with button up
|
|
99 ;;;
|
|
100
|
|
101 (defvar *mouse-drag-window* nil)
|
|
102 (defvar *mouse-drag-x* -1)
|
|
103 (defvar *mouse-drag-y* -1)
|
|
104
|
|
105 (defun mouse-drag-move-point (window x y)
|
|
106 "Move point to mouse cursor, and allow dragging."
|
|
107 (mouse-move-point window x y)
|
|
108 (setq *mouse-drag-window* window
|
|
109 *mouse-drag-x* x
|
|
110 *mouse-drag-y* y))
|
|
111
|
|
112 (defun mouse-drag-set-mark-stuff (window x y)
|
|
113 "The up click handler that goes with mouse-drag-move-point.
|
|
114 If mouse is in same WINDOW but at different X or Y than when
|
|
115 mouse-drag-move-point was last executed, set the mark at mouse
|
|
116 and put the region in the stuff buffer."
|
|
117 (if (and (eq *mouse-drag-window* window)
|
|
118 (not (and (equal *mouse-drag-x* x)
|
|
119 (equal *mouse-drag-y* y))))
|
|
120 (mouse-set-mark-and-stuff window x y)
|
|
121 (setq this-command last-command)) ; this was just an upclick no-op.
|
|
122 )
|
|
123
|
|
124 (defun mouse-select-or-drag-move-point (window x y)
|
|
125 "Select window if not selected, otherwise do mouse-drag-move-point."
|
|
126 (if (eq (selected-window) window)
|
|
127 (mouse-drag-move-point window x y)
|
|
128 (mouse-select-window window x y)))
|
|
129
|
|
130 ;;;
|
|
131 ;;; esoteria:
|
|
132 ;;;
|
|
133 (defun mouse-exch-pt-and-mark (window x y)
|
|
134 "Exchange point and mark."
|
|
135 (select-window window)
|
|
136 (exchange-point-and-mark)
|
|
137 )
|
|
138
|
|
139 (defun mouse-call-kbd-macro (window x y)
|
|
140 "Invokes last keyboard macro at mouse cursor."
|
|
141 (mouse-move-point window x y)
|
|
142 (call-last-kbd-macro)
|
|
143 )
|
|
144
|
|
145 (defun mouse-mark-thing (window x y)
|
|
146 "Set point and mark to text object using syntax table.
|
|
147 The resulting region is put in the sun-window stuff buffer.
|
|
148 Left or right Paren syntax marks an s-expression.
|
|
149 Clicking at the end of a line marks the line including a trailing newline.
|
|
150 If it doesn't recognize one of these it marks the character at point."
|
|
151 (mouse-move-point window x y)
|
|
152 (if (eobp) (open-line 1))
|
|
153 (let* ((char (char-after (point)))
|
|
154 (syntax (char-syntax char)))
|
|
155 (cond
|
|
156 ((eq syntax ?w) ; word.
|
|
157 (forward-word 1)
|
|
158 (set-mark (point))
|
|
159 (forward-word -1))
|
|
160 ;; try to include a single following whitespace (is this a good idea?)
|
|
161 ;; No, not a good idea since inconsistent.
|
|
162 ;;(if (eq (char-syntax (char-after (mark))) ?\ )
|
|
163 ;; (set-mark (1+ (mark))))
|
|
164 ((eq syntax ?\( ) ; open paren.
|
|
165 (mark-sexp 1))
|
|
166 ((eq syntax ?\) ) ; close paren.
|
|
167 (forward-char 1)
|
|
168 (mark-sexp -1)
|
|
169 (exchange-point-and-mark))
|
|
170 ((eolp) ; mark line if at end.
|
|
171 (set-mark (1+ (point)))
|
|
172 (beginning-of-line 1))
|
|
173 (t ; mark character
|
|
174 (set-mark (1+ (point)))))
|
|
175 (indicate-region)) ; display region boundary.
|
|
176 (sun-select-region (region-beginning) (region-end))
|
|
177 )
|
|
178
|
|
179 (defun mouse-kill-thing (window x y)
|
|
180 "Kill thing at mouse, and put point there."
|
|
181 (mouse-mark-thing window x y)
|
|
182 (kill-region-and-unmark (region-beginning) (region-end))
|
|
183 )
|
|
184
|
|
185 (defun mouse-kill-thing-there (window x y)
|
|
186 "Kill thing at mouse, leave point where it was.
|
|
187 See mouse-mark-thing for a description of the objects recognized."
|
|
188 (eval-in-window window
|
|
189 (save-excursion
|
|
190 (mouse-mark-thing window x y)
|
|
191 (kill-region (region-beginning) (region-end))))
|
|
192 )
|
|
193
|
|
194 (defun mouse-save-thing (window x y &optional quiet)
|
|
195 "Put thing at mouse in kill ring.
|
|
196 See mouse-mark-thing for a description of the objects recognized."
|
|
197 (mouse-mark-thing window x y)
|
|
198 (copy-region-as-kill (region-beginning) (region-end))
|
|
199 (if (not quiet) (message "Thing saved"))
|
|
200 )
|
|
201
|
|
202 (defun mouse-save-thing-there (window x y &optional quiet)
|
|
203 "Put thing at mouse in kill ring, leave point as is.
|
|
204 See mouse-mark-thing for a description of the objects recognized."
|
|
205 (eval-in-window window
|
|
206 (save-excursion
|
|
207 (mouse-save-thing window x y quiet))))
|
|
208
|
|
209 ;;;
|
|
210 ;;; Mouse yanking...
|
|
211 ;;;
|
|
212 (defun mouse-copy-thing (window x y)
|
|
213 "Put thing at mouse in kill ring, yank to point.
|
|
214 See mouse-mark-thing for a description of the objects recognized."
|
|
215 (setq last-command 'not-kill) ;Avoids appending to previous kills.
|
|
216 (mouse-save-thing-there window x y t)
|
|
217 (yank)
|
|
218 (setq this-command 'yank))
|
|
219
|
|
220 (defun mouse-move-thing (window x y)
|
|
221 "Kill thing at mouse, yank it to point.
|
|
222 See mouse-mark-thing for a description of the objects recognized."
|
|
223 (setq last-command 'not-kill) ;Avoids appending to previous kills.
|
|
224 (mouse-kill-thing-there window x y)
|
|
225 (yank)
|
|
226 (setq this-command 'yank))
|
|
227
|
|
228 (defun mouse-yank-at-point (&optional window x y)
|
|
229 "Yank from kill-ring at point; then cycle thru kill ring."
|
|
230 (if (eq last-command 'yank)
|
|
231 (let ((before (< (point) (mark))))
|
|
232 (delete-region (point) (mark))
|
|
233 (rotate-yank-pointer 1)
|
|
234 (insert (car kill-ring-yank-pointer))
|
|
235 (if before (exchange-point-and-mark)))
|
|
236 (yank))
|
|
237 (setq this-command 'yank))
|
|
238
|
|
239 (defun mouse-yank-at-mouse (window x y)
|
|
240 "Yank from kill-ring at mouse; then cycle thru kill ring."
|
|
241 (mouse-move-point window x y)
|
|
242 (mouse-yank-at-point window x y))
|
|
243
|
|
244 (defun mouse-save/delete/yank (&optional window x y)
|
|
245 "Context sensitive save/delete/yank.
|
|
246 Consecutive clicks perform as follows:
|
|
247 * first click saves region to kill ring,
|
|
248 * second click kills region,
|
|
249 * third click yanks from kill ring,
|
|
250 * subsequent clicks cycle thru kill ring.
|
|
251 If mouse-move-point is performed after the first or second click,
|
|
252 the next click will do a yank, etc. Except for a possible mouse-move-point,
|
|
253 this command is insensitive to mouse location."
|
|
254 (cond
|
|
255 ((memq last-command '(mouse-delete yank mouse-yank-move)) ; third+ click
|
|
256 (mouse-yank-at-point))
|
|
257 ((eq last-command 'mouse-copy) ; second click
|
|
258 (kill-region (region-beginning) (region-end))
|
|
259 (setq this-command 'mouse-delete))
|
|
260 (t ; first click
|
|
261 (copy-region-as-kill (region-beginning) (region-end))
|
|
262 (message "Region saved")
|
|
263 (setq this-command 'mouse-copy))
|
|
264 ))
|
|
265
|
|
266
|
|
267 (defun mouse-split-horizontally (window x y)
|
|
268 "Splits the window horizontally at mouse cursor."
|
|
269 (eval-in-window window (split-window-horizontally (1+ x))))
|
|
270
|
|
271 (defun mouse-split-vertically (window x y)
|
|
272 "Split the window vertically at the mouse cursor."
|
|
273 (eval-in-window window (split-window-vertically (1+ y))))
|
|
274
|
|
275 (defun mouse-select-window (window x y)
|
|
276 "Selects the window, restoring point."
|
|
277 (select-window window))
|
|
278
|
|
279 (defun mouse-delete-other-windows (window x y)
|
|
280 "Deletes all windows except the one mouse is in."
|
|
281 (delete-other-windows window))
|
|
282
|
|
283 (defun mouse-delete-window (window x y)
|
|
284 "Deletes the window mouse is in."
|
|
285 (delete-window window))
|
|
286
|
|
287 (defun mouse-undo (window x y)
|
|
288 "Invokes undo in the window mouse is in."
|
|
289 (eval-in-window window (undo)))
|
|
290
|
|
291 ;;;
|
|
292 ;;; Scroll operations
|
|
293 ;;;
|
|
294
|
|
295 ;;; The move-to-window-line is used below because otherwise
|
|
296 ;;; scrolling a non-selected process window with the mouse, after
|
|
297 ;;; the process has written text past the bottom of the window,
|
|
298 ;;; gives an "End of buffer" error, and then scrolls. The
|
|
299 ;;; move-to-window-line seems to force recomputing where things are.
|
|
300 (defun mouse-scroll-up (window x y)
|
|
301 "Scrolls the window upward."
|
|
302 (eval-in-window window (move-to-window-line 1) (scroll-up nil)))
|
|
303
|
|
304 (defun mouse-scroll-down (window x y)
|
|
305 "Scrolls the window downward."
|
|
306 (eval-in-window window (scroll-down nil)))
|
|
307
|
|
308 (defun mouse-scroll-proportional (window x y)
|
|
309 "Scrolls the window proportionally corresponding to window
|
|
310 relative X divided by window width."
|
|
311 (eval-in-window window
|
|
312 (if (>= x (1- (window-width)))
|
|
313 ;; When x is maximun (equal to or 1 less than window width),
|
|
314 ;; goto end of buffer. We check for this special case
|
|
315 ;; becuase the calculated goto-char often goes short of the
|
|
316 ;; end due to roundoff error, and we often really want to go
|
|
317 ;; to the end.
|
|
318 (goto-char (point-max))
|
|
319 (progn
|
|
320 (goto-char (+ (point-min) ; For narrowed regions.
|
|
321 (* x (/ (- (point-max) (point-min))
|
|
322 (1- (window-width))))))
|
|
323 (beginning-of-line))
|
|
324 )
|
|
325 (what-cursor-position) ; Report position.
|
|
326 ))
|
|
327
|
|
328 (defun mouse-line-to-top (window x y)
|
|
329 "Scrolls the line at the mouse cursor up to the top."
|
|
330 (eval-in-window window (scroll-up y)))
|
|
331
|
|
332 (defun mouse-top-to-line (window x y)
|
|
333 "Scrolls the top line down to the mouse cursor."
|
|
334 (eval-in-window window (scroll-down y)))
|
|
335
|
|
336 (defun mouse-line-to-bottom (window x y)
|
|
337 "Scrolls the line at the mouse cursor to the bottom."
|
|
338 (eval-in-window window (scroll-up (+ y (- 2 (window-height))))))
|
|
339
|
|
340 (defun mouse-bottom-to-line (window x y)
|
|
341 "Scrolls the bottom line up to the mouse cursor."
|
|
342 (eval-in-window window (scroll-down (+ y (- 2 (window-height))))))
|
|
343
|
|
344 (defun mouse-line-to-middle (window x y)
|
|
345 "Scrolls the line at the mouse cursor to the middle."
|
|
346 (eval-in-window window (scroll-up (- y -1 (/ (window-height) 2)))))
|
|
347
|
|
348 (defun mouse-middle-to-line (window x y)
|
|
349 "Scrolls the line at the middle to the mouse cursor."
|
|
350 (eval-in-window window (scroll-up (- (/ (window-height) 2) y 1))))
|
|
351
|
|
352
|
|
353 ;;;
|
|
354 ;;; main emacs menu.
|
|
355 ;;;
|
|
356 (defmenu expand-menu
|
|
357 ("Vertically" mouse-expand-vertically *menu-window*)
|
|
358 ("Horizontally" mouse-expand-horizontally *menu-window*))
|
|
359
|
|
360 (defmenu delete-window-menu
|
|
361 ("This One" delete-window *menu-window*)
|
|
362 ("All Others" delete-other-windows *menu-window*))
|
|
363
|
|
364 (defmenu mouse-help-menu
|
|
365 ("Text Region"
|
|
366 mouse-help-region *menu-window* *menu-x* *menu-y* 'text)
|
|
367 ("Scrollbar"
|
|
368 mouse-help-region *menu-window* *menu-x* *menu-y* 'scrollbar)
|
|
369 ("Modeline"
|
|
370 mouse-help-region *menu-window* *menu-x* *menu-y* 'modeline)
|
|
371 ("Minibuffer"
|
|
372 mouse-help-region *menu-window* *menu-x* *menu-y* 'minibuffer)
|
|
373 )
|
|
374
|
|
375 (defmenu emacs-quit-menu
|
|
376 ("Suspend" suspend-emacstool)
|
|
377 ("Quit" save-buffers-kill-emacs))
|
|
378
|
|
379 (defmenu emacs-menu
|
|
380 ("Emacs Menu")
|
|
381 ("Stuff Selection" sun-yank-selection)
|
|
382 ("Expand" . expand-menu)
|
|
383 ("Delete Window" . delete-window-menu)
|
|
384 ("Previous Buffer" mouse-select-previous-buffer *menu-window*)
|
|
385 ("Save Buffers" save-some-buffers)
|
|
386 ("List Directory" list-directory nil)
|
|
387 ("Dired" dired nil)
|
|
388 ("Mouse Help" . mouse-help-menu)
|
|
389 ("Quit" . emacs-quit-menu))
|
|
390
|
|
391 (defun emacs-menu-eval (window x y)
|
|
392 "Pop-up menu of editor commands."
|
|
393 (sun-menu-evaluate window (1+ x) (1- y) 'emacs-menu))
|
|
394
|
|
395 (defun mouse-expand-horizontally (window)
|
|
396 (eval-in-window window
|
|
397 (enlarge-window 4 t)
|
|
398 (update-display) ; Try to redisplay, since can get confused.
|
|
399 ))
|
|
400
|
|
401 (defun mouse-expand-vertically (window)
|
|
402 (eval-in-window window (enlarge-window 4)))
|
|
403
|
|
404 (defun mouse-select-previous-buffer (window)
|
|
405 "Switch buffer in mouse window to most recently selected buffer."
|
|
406 (eval-in-window window (switch-to-buffer (other-buffer))))
|
|
407
|
|
408 ;;;
|
|
409 ;;; minibuffer menu
|
|
410 ;;;
|
|
411 (defmenu minibuffer-menu
|
|
412 ("Minibuffer" message "Just some miscellanous minibuffer commands")
|
|
413 ("Stuff" sun-yank-selection)
|
|
414 ("Do-It" exit-minibuffer)
|
|
415 ("Abort" abort-recursive-edit)
|
|
416 ("Suspend" suspend-emacs))
|
|
417
|
|
418 (defun minibuffer-menu-eval (window x y)
|
|
419 "Pop-up menu of commands."
|
|
420 (sun-menu-evaluate window x (1- y) 'minibuffer-menu))
|
|
421
|
|
422 (defun mini-move-point (window x y)
|
|
423 ;; -6 is good for most common cases
|
|
424 (mouse-move-point window (- x 6) 0))
|
|
425
|
|
426 (defun mini-set-mark-and-stuff (window x y)
|
|
427 ;; -6 is good for most common cases
|
|
428 (mouse-set-mark-and-stuff window (- x 6) 0))
|
|
429
|
|
430
|
|
431 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
432 ;;; Buffer-mode Mouse commands
|
|
433 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
434
|
|
435 (defun Buffer-at-mouse (w x y)
|
|
436 "Calls Buffer-menu-buffer from mouse click."
|
|
437 (save-window-excursion
|
|
438 (mouse-move-point w x y)
|
|
439 (beginning-of-line)
|
|
440 (Buffer-menu-buffer t)))
|
|
441
|
|
442 (defun mouse-buffer-bury (w x y)
|
|
443 "Bury the indicated buffer."
|
|
444 (bury-buffer (Buffer-at-mouse w x y))
|
|
445 )
|
|
446
|
|
447 (defun mouse-buffer-select (w x y)
|
|
448 "Put the indicated buffer in selected window."
|
|
449 (switch-to-buffer (Buffer-at-mouse w x y))
|
|
450 (list-buffers)
|
|
451 )
|
|
452
|
|
453 (defun mouse-buffer-delete (w x y)
|
|
454 "mark indicated buffer for delete"
|
|
455 (save-window-excursion
|
|
456 (mouse-move-point w x y)
|
|
457 (Buffer-menu-delete)
|
|
458 ))
|
|
459
|
|
460 (defun mouse-buffer-execute (w x y)
|
|
461 "execute buffer-menu selections"
|
|
462 (save-window-excursion
|
|
463 (mouse-move-point w x y)
|
|
464 (Buffer-menu-execute)
|
|
465 ))
|
|
466
|
|
467 (defun enable-mouse-in-buffer-list ()
|
|
468 "Call this to enable mouse selections in *Buffer List*
|
|
469 LEFT puts the indicated buffer in the selected window.
|
|
470 MIDDLE buries the indicated buffer.
|
|
471 RIGHT marks the indicated buffer for deletion.
|
|
472 MIDDLE-RIGHT deletes the marked buffers.
|
|
473 To unmark a buffer marked for deletion, select it with LEFT."
|
|
474 (save-window-excursion
|
|
475 (list-buffers) ; Initialize *Buffer List*
|
|
476 (set-buffer "*Buffer List*")
|
|
477 (local-set-mouse '(text middle) 'mouse-buffer-bury)
|
|
478 (local-set-mouse '(text left) 'mouse-buffer-select)
|
|
479 (local-set-mouse '(text right) 'mouse-buffer-delete)
|
|
480 (local-set-mouse '(text middle right) 'mouse-buffer-execute)
|
|
481 )
|
|
482 )
|
|
483
|
|
484
|
|
485 ;;;*******************************************************************
|
|
486 ;;;
|
|
487 ;;; Global Mouse Bindings.
|
|
488 ;;;
|
|
489 ;;; There is some sense to this mouse binding madness:
|
|
490 ;;; LEFT and RIGHT scrolls are inverses.
|
|
491 ;;; SHIFT makes an opposite meaning in the scroll bar.
|
|
492 ;;; SHIFT is an alternative to DOUBLE (but double chords do not exist).
|
|
493 ;;; META makes the scrollbar functions work in the text region.
|
|
494 ;;; MIDDLE operates the mark
|
|
495 ;;; LEFT operates at point
|
|
496
|
|
497 ;;; META commands are generally non-destructive,
|
|
498 ;;; SHIFT is a little more dangerous.
|
|
499 ;;; CONTROL is for the really complicated ones.
|
|
500
|
|
501 ;;; CONTROL-META-SHIFT-RIGHT gives help on that region.
|
|
502
|
|
503 ;;;
|
|
504 ;;; Text Region mousemap
|
|
505 ;;;
|
|
506 ;; The basics: Point, Mark, Menu, Sun-Select:
|
|
507 (global-set-mouse '(text left) 'mouse-drag-move-point)
|
|
508 (global-set-mouse '(text up left) 'mouse-drag-set-mark-stuff)
|
|
509 (global-set-mouse '(text shift left) 'mouse-exch-pt-and-mark)
|
|
510 (global-set-mouse '(text double left) 'mouse-exch-pt-and-mark)
|
|
511
|
|
512 (global-set-mouse '(text middle) 'mouse-set-mark-and-stuff)
|
|
513
|
|
514 (global-set-mouse '(text right) 'emacs-menu-eval)
|
|
515 (global-set-mouse '(text shift right) '(sun-yank-selection))
|
|
516 (global-set-mouse '(text double right) '(sun-yank-selection))
|
|
517
|
|
518 ;; The Slymoblics multi-command for Save, Kill, Copy, Move:
|
|
519 (global-set-mouse '(text shift middle) 'mouse-save/delete/yank)
|
|
520 (global-set-mouse '(text double middle) 'mouse-save/delete/yank)
|
|
521
|
|
522 ;; Save, Kill, Copy, Move Things:
|
|
523 ;; control-left composes with control middle/right to produce copy/move
|
|
524 (global-set-mouse '(text control middle ) 'mouse-save-thing-there)
|
|
525 (global-set-mouse '(text control right ) 'mouse-kill-thing-there)
|
|
526 (global-set-mouse '(text control left) 'mouse-yank-at-point)
|
|
527 (global-set-mouse '(text control middle left) 'mouse-copy-thing)
|
|
528 (global-set-mouse '(text control right left) 'mouse-move-thing)
|
|
529 (global-set-mouse '(text control right middle) 'mouse-mark-thing)
|
|
530
|
|
531 ;; The Universal mouse help command (press all buttons):
|
|
532 (global-set-mouse '(text shift control meta right) 'mouse-help-region)
|
|
533 (global-set-mouse '(text double control meta right) 'mouse-help-region)
|
|
534
|
|
535 ;;; Meta in Text Region is like meta version in scrollbar:
|
|
536 (global-set-mouse '(text meta left) 'mouse-line-to-top)
|
|
537 (global-set-mouse '(text meta shift left) 'mouse-line-to-bottom)
|
|
538 (global-set-mouse '(text meta double left) 'mouse-line-to-bottom)
|
|
539 (global-set-mouse '(text meta middle) 'mouse-line-to-middle)
|
|
540 (global-set-mouse '(text meta shift middle) 'mouse-middle-to-line)
|
|
541 (global-set-mouse '(text meta double middle) 'mouse-middle-to-line)
|
|
542 (global-set-mouse '(text meta control middle) 'mouse-split-vertically)
|
|
543 (global-set-mouse '(text meta right) 'mouse-top-to-line)
|
|
544 (global-set-mouse '(text meta shift right) 'mouse-bottom-to-line)
|
|
545 (global-set-mouse '(text meta double right) 'mouse-bottom-to-line)
|
|
546
|
|
547 ;; Miscellaneous:
|
|
548 (global-set-mouse '(text meta control left) 'mouse-call-kbd-macro)
|
|
549 (global-set-mouse '(text meta control right) 'mouse-undo)
|
|
550
|
|
551 ;;;
|
|
552 ;;; Scrollbar mousemap.
|
|
553 ;;; Are available in the Scrollbar Region, or with Meta Text (or Meta Scrollbar)
|
|
554 ;;;
|
|
555 (global-set-mouse '(scrollbar left) 'mouse-line-to-top)
|
|
556 (global-set-mouse '(scrollbar shift left) 'mouse-line-to-bottom)
|
|
557 (global-set-mouse '(scrollbar double left) 'mouse-line-to-bottom)
|
|
558
|
|
559 (global-set-mouse '(scrollbar middle) 'mouse-line-to-middle)
|
|
560 (global-set-mouse '(scrollbar shift middle) 'mouse-middle-to-line)
|
|
561 (global-set-mouse '(scrollbar double middle) 'mouse-middle-to-line)
|
|
562 (global-set-mouse '(scrollbar control middle) 'mouse-split-vertically)
|
|
563
|
|
564 (global-set-mouse '(scrollbar right) 'mouse-top-to-line)
|
|
565 (global-set-mouse '(scrollbar shift right) 'mouse-bottom-to-line)
|
|
566 (global-set-mouse '(scrollbar double right) 'mouse-bottom-to-line)
|
|
567
|
|
568 (global-set-mouse '(scrollbar meta left) 'mouse-line-to-top)
|
|
569 (global-set-mouse '(scrollbar meta shift left) 'mouse-line-to-bottom)
|
|
570 (global-set-mouse '(scrollbar meta double left) 'mouse-line-to-bottom)
|
|
571 (global-set-mouse '(scrollbar meta middle) 'mouse-line-to-middle)
|
|
572 (global-set-mouse '(scrollbar meta shift middle) 'mouse-middle-to-line)
|
|
573 (global-set-mouse '(scrollbar meta double middle) 'mouse-middle-to-line)
|
|
574 (global-set-mouse '(scrollbar meta control middle) 'mouse-split-vertically)
|
|
575 (global-set-mouse '(scrollbar meta right) 'mouse-top-to-line)
|
|
576 (global-set-mouse '(scrollbar meta shift right) 'mouse-bottom-to-line)
|
|
577 (global-set-mouse '(scrollbar meta double right) 'mouse-bottom-to-line)
|
|
578
|
|
579 ;; And the help menu:
|
|
580 (global-set-mouse '(scrollbar shift control meta right) 'mouse-help-region)
|
|
581 (global-set-mouse '(scrollbar double control meta right) 'mouse-help-region)
|
|
582
|
|
583 ;;;
|
|
584 ;;; Modeline mousemap.
|
|
585 ;;;
|
|
586 ;;; Note: meta of any single button selects window.
|
|
587
|
|
588 (global-set-mouse '(modeline left) 'mouse-scroll-up)
|
|
589 (global-set-mouse '(modeline meta left) 'mouse-select-window)
|
|
590
|
|
591 (global-set-mouse '(modeline middle) 'mouse-scroll-proportional)
|
|
592 (global-set-mouse '(modeline meta middle) 'mouse-select-window)
|
|
593 (global-set-mouse '(modeline control middle) 'mouse-split-horizontally)
|
|
594
|
|
595 (global-set-mouse '(modeline right) 'mouse-scroll-down)
|
|
596 (global-set-mouse '(modeline meta right) 'mouse-select-window)
|
|
597
|
|
598 ;;; control-left selects this window, control-right deletes it.
|
|
599 (global-set-mouse '(modeline control left) 'mouse-delete-other-windows)
|
|
600 (global-set-mouse '(modeline control right) 'mouse-delete-window)
|
|
601
|
|
602 ;; in case of confusion, just select it:
|
|
603 (global-set-mouse '(modeline control left right)'mouse-select-window)
|
|
604
|
|
605 ;; even without confusion (and without the keyboard) select it:
|
|
606 (global-set-mouse '(modeline left right) 'mouse-select-window)
|
|
607
|
|
608 ;; And the help menu:
|
|
609 (global-set-mouse '(modeline shift control meta right) 'mouse-help-region)
|
|
610 (global-set-mouse '(modeline double control meta right) 'mouse-help-region)
|
|
611
|
|
612 ;;;
|
|
613 ;;; Minibuffer Mousemap
|
|
614 ;;; Demonstrating some variety:
|
|
615 ;;;
|
|
616 (global-set-mouse '(minibuffer left) 'mini-move-point)
|
|
617
|
|
618 (global-set-mouse '(minibuffer middle) 'mini-set-mark-and-stuff)
|
|
619
|
|
620 (global-set-mouse '(minibuffer shift middle) '(select-previous-complex-command))
|
|
621 (global-set-mouse '(minibuffer double middle) '(select-previous-complex-command))
|
|
622 (global-set-mouse '(minibuffer control middle) '(next-complex-command 1))
|
|
623 (global-set-mouse '(minibuffer meta middle) '(previous-complex-command 1))
|
|
624
|
|
625 (global-set-mouse '(minibuffer right) 'minibuffer-menu-eval)
|
|
626
|
|
627 (global-set-mouse '(minibuffer shift control meta right) 'mouse-help-region)
|
|
628 (global-set-mouse '(minibuffer double control meta right) 'mouse-help-region)
|
|
629
|
584
|
630 (provide 'sun-fns)
|