Mercurial > emacs
annotate lisp/sun-fns.el @ 785:17ccc9d015f5
*** empty log message ***
author | Jim Blandy <jimb@redhat.com> |
---|---|
date | Wed, 15 Jul 1992 20:51:10 +0000 |
parents | e4253da532fb |
children | 4f28bd14272c |
rev | line source |
---|---|
658
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
584
diff
changeset
|
1 ;;; sun-fns.el --- subroutines of Mouse handling for Sun windows |
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
584
diff
changeset
|
2 |
35 | 3 ;; Copyright (C) 1987 Free Software Foundation, Inc. |
4 | |
5 ;; This file is part of GNU Emacs. | |
6 | |
7 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
8 ;; it under the terms of the GNU General Public License as published by | |
9 ;; the Free Software Foundation; either version 1, or (at your option) | |
10 ;; any later version. | |
11 | |
12 ;; GNU Emacs is distributed in the hope that it will be useful, | |
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 ;; GNU General Public License for more details. | |
16 | |
17 ;; You should have received a copy of the GNU General Public License | |
18 ;; along with GNU Emacs; see the file COPYING. If not, write to | |
19 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
20 | |
21 ;;; Submitted Mar. 1987, Jeff Peck | |
22 ;;; Sun Microsystems Inc. <peck@sun.com> | |
23 ;;; Conceived Nov. 1986, Stan Jefferson, | |
24 ;;; Computer Science Lab, SRI International. | |
25 ;;; GoodIdeas Feb. 1987, Steve Greenbaum | |
26 ;;; & UpClicks Reasoning Systems, Inc. | |
27 ;;; | |
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 | |
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 | |
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 | |
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)) | |
707 | 234 (insert (current-kill 1)) |
35 | 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) |
658
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
584
diff
changeset
|
631 |
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
584
diff
changeset
|
632 ;;; sun-fns.el ends here |