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