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