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