Mercurial > emacs
annotate lisp/obsolete/sun-fns.el @ 85756:4511a12a27e4
*** empty log message ***
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Mon, 29 Oct 2007 08:34:53 +0000 |
parents | c97419f9e9cf |
children | bdb3fe0ba9fa |
rev | line source |
---|---|
39022 | 1 ;;; sun-fns.el --- subroutines of Mouse handling for Sun windows |
2 | |
74509 | 3 ;; Copyright (C) 1987, 2001, 2002, 2003, 2004, 2005, |
75347 | 4 ;; 2006, 2007 Free Software Foundation, Inc. |
39022 | 5 |
6 ;; Author: Jeff Peck <peck@sun.com> | |
7 ;; Maintainer: none | |
8 ;; Keywords: hardware | |
9 | |
10 ;; This file is part of GNU Emacs. | |
11 | |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
13 ;; it under the terms of the GNU General Public License as published by | |
78228
1e016d63f292
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
75347
diff
changeset
|
14 ;; the Free Software Foundation; either version 3, or (at your option) |
39022 | 15 ;; any later version. |
16 | |
17 ;; GNU Emacs is distributed in the hope that it will be useful, | |
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 ;; GNU General Public License for more details. | |
21 | |
22 ;; You should have received a copy of the GNU General Public License | |
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
64085 | 24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
25 ;; Boston, MA 02110-1301, USA. | |
39022 | 26 |
27 ;;; Commentary: | |
28 | |
29 ;; Submitted Mar. 1987, Jeff Peck | |
30 ;; Sun Microsystems Inc. <peck@sun.com> | |
31 ;; Conceived Nov. 1986, Stan Jefferson, | |
32 ;; Computer Science Lab, SRI International. | |
33 ;; GoodIdeas Feb. 1987, Steve Greenbaum | |
34 ;; & UpClicks Reasoning Systems, Inc. | |
35 ;; | |
36 ;; | |
37 ;; Functions for manipulating via the mouse and mouse-map definitions | |
38 ;; for accessing them. Also definitions of mouse menus. | |
39 ;; This file you should freely modify to reflect you personal tastes. | |
40 ;; | |
41 ;; First half of file defines functions to implement mouse commands, | |
42 ;; Don't delete any of those, just add what ever else you need. | |
43 ;; Second half of file defines mouse bindings, do whatever you want there. | |
44 | |
45 ;; | |
46 ;; Mouse Functions. | |
47 ;; | |
48 ;; These functions follow the sun-mouse-handler convention of being called | |
49 ;; with three arguments: (window x-pos y-pos) | |
50 ;; This makes it easy for a mouse executed command to know where the mouse is. | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39022
diff
changeset
|
51 ;; Use the macro "eval-in-window" to execute a function |
39022 | 52 ;; in a temporarily selected window. |
53 ;; | |
54 ;; If you have a function that must be called with other arguments | |
55 ;; bind the mouse button to an s-exp that contains the necessary parameters. | |
56 ;; See "minibuffer" bindings for examples. | |
57 ;; | |
58 | |
59 ;;; Code: | |
60 | |
61 (require 'term/sun-mouse) | |
62 | |
63 (defconst cursor-pause-milliseconds 300 | |
64 "*Number of milliseconds to display alternate cursor (usually the mark)") | |
65 | |
66 (defun indicate-region (&optional pause) | |
67 "Bounce cursor to mark for cursor-pause-milliseconds and back again" | |
68 (or pause (setq pause cursor-pause-milliseconds)) | |
69 (let ((point (point))) | |
70 (goto-char (mark)) | |
71 (sit-for-millisecs pause) | |
72 ;(update-display) | |
73 ;(sleep-for-millisecs pause) | |
74 (goto-char point))) | |
75 | |
76 | |
77 ;;; | |
78 ;;; Text buffer operations | |
79 ;;; | |
80 (defun mouse-move-point (window x y) | |
81 "Move point to mouse cursor." | |
82 (select-window window) | |
83 (move-to-loc x y) | |
84 (if (memq last-command ; support the mouse-copy/delete/yank | |
85 '(mouse-copy mouse-delete mouse-yank-move)) | |
86 (setq this-command 'mouse-yank-move)) | |
87 ) | |
88 | |
65185
7d1da711be4c
(mouse-select-or-drag-move-point): Don't pass X and Y (they are ignored anyway).
Juanma Barranquero <lekktu@gmail.com>
parents:
64751
diff
changeset
|
89 (defun mouse-set-mark (&optional window x y) |
39022 | 90 "Set mark at mouse cursor." |
91 (eval-in-window window ;; use this to get the unwind protect | |
92 (let ((point (point))) | |
93 (move-to-loc x y) | |
94 (set-mark (point)) | |
95 (goto-char point) | |
96 (indicate-region))) | |
97 ) | |
98 | |
99 (defun mouse-set-mark-and-select (window x y) | |
100 "Set mark at mouse cursor, and select that window." | |
101 (select-window window) | |
102 (mouse-set-mark window x y) | |
103 ) | |
104 | |
105 (defun mouse-set-mark-and-stuff (w x y) | |
106 "Set mark at mouse cursor, and put region in stuff buffer." | |
107 (mouse-set-mark-and-select w x y) | |
108 (sun-select-region (region-beginning) (region-end))) | |
109 | |
110 ;;; | |
111 ;;; Simple mouse dragging stuff: marking with button up | |
112 ;;; | |
113 | |
114 (defvar *mouse-drag-window* nil) | |
115 (defvar *mouse-drag-x* -1) | |
116 (defvar *mouse-drag-y* -1) | |
117 | |
118 (defun mouse-drag-move-point (window x y) | |
119 "Move point to mouse cursor, and allow dragging." | |
120 (mouse-move-point window x y) | |
121 (setq *mouse-drag-window* window | |
122 *mouse-drag-x* x | |
123 *mouse-drag-y* y)) | |
124 | |
125 (defun mouse-drag-set-mark-stuff (window x y) | |
126 "The up click handler that goes with mouse-drag-move-point. | |
127 If mouse is in same WINDOW but at different X or Y than when | |
128 mouse-drag-move-point was last executed, set the mark at mouse | |
129 and put the region in the stuff buffer." | |
130 (if (and (eq *mouse-drag-window* window) | |
131 (not (and (equal *mouse-drag-x* x) | |
132 (equal *mouse-drag-y* y)))) | |
133 (mouse-set-mark-and-stuff window x y) | |
134 (setq this-command last-command)) ; this was just an upclick no-op. | |
135 ) | |
136 | |
137 (defun mouse-select-or-drag-move-point (window x y) | |
138 "Select window if not selected, otherwise do mouse-drag-move-point." | |
139 (if (eq (selected-window) window) | |
140 (mouse-drag-move-point window x y) | |
65185
7d1da711be4c
(mouse-select-or-drag-move-point): Don't pass X and Y (they are ignored anyway).
Juanma Barranquero <lekktu@gmail.com>
parents:
64751
diff
changeset
|
141 (mouse-select-window window))) |
39022 | 142 |
143 ;;; | |
144 ;;; esoterica: | |
145 ;;; | |
146 (defun mouse-exch-pt-and-mark (window x y) | |
147 "Exchange point and mark." | |
148 (select-window window) | |
149 (exchange-point-and-mark) | |
150 ) | |
151 | |
152 (defun mouse-call-kbd-macro (window x y) | |
153 "Invokes last keyboard macro at mouse cursor." | |
154 (mouse-move-point window x y) | |
155 (call-last-kbd-macro) | |
156 ) | |
157 | |
158 (defun mouse-mark-thing (window x y) | |
159 "Set point and mark to text object using syntax table. | |
160 The resulting region is put in the sun-window stuff buffer. | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39022
diff
changeset
|
161 Left or right Paren syntax marks an s-expression. |
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39022
diff
changeset
|
162 Clicking at the end of a line marks the line including a trailing newline. |
39022 | 163 If it doesn't recognize one of these it marks the character at point." |
164 (mouse-move-point window x y) | |
165 (if (eobp) (open-line 1)) | |
166 (let* ((char (char-after (point))) | |
167 (syntax (char-syntax char))) | |
168 (cond | |
169 ((eq syntax ?w) ; word. | |
170 (forward-word 1) | |
171 (set-mark (point)) | |
172 (forward-word -1)) | |
173 ;; try to include a single following whitespace (is this a good idea?) | |
174 ;; No, not a good idea since inconsistent. | |
175 ;;(if (eq (char-syntax (char-after (mark))) ?\ ) | |
176 ;; (set-mark (1+ (mark)))) | |
177 ((eq syntax ?\( ) ; open paren. | |
178 (mark-sexp 1)) | |
179 ((eq syntax ?\) ) ; close paren. | |
180 (forward-char 1) | |
181 (mark-sexp -1) | |
182 (exchange-point-and-mark)) | |
183 ((eolp) ; mark line if at end. | |
184 (set-mark (1+ (point))) | |
185 (beginning-of-line 1)) | |
186 (t ; mark character | |
187 (set-mark (1+ (point))))) | |
188 (indicate-region)) ; display region boundary. | |
189 (sun-select-region (region-beginning) (region-end)) | |
190 ) | |
191 | |
192 (defun mouse-kill-thing (window x y) | |
193 "Kill thing at mouse, and put point there." | |
194 (mouse-mark-thing window x y) | |
195 (kill-region-and-unmark (region-beginning) (region-end)) | |
196 ) | |
197 | |
198 (defun mouse-kill-thing-there (window x y) | |
199 "Kill thing at mouse, leave point where it was. | |
200 See mouse-mark-thing for a description of the objects recognized." | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39022
diff
changeset
|
201 (eval-in-window window |
39022 | 202 (save-excursion |
203 (mouse-mark-thing window x y) | |
204 (kill-region (region-beginning) (region-end)))) | |
205 ) | |
206 | |
207 (defun mouse-save-thing (window x y &optional quiet) | |
208 "Put thing at mouse in kill ring. | |
209 See mouse-mark-thing for a description of the objects recognized." | |
210 (mouse-mark-thing window x y) | |
211 (copy-region-as-kill (region-beginning) (region-end)) | |
212 (if (not quiet) (message "Thing saved")) | |
213 ) | |
214 | |
215 (defun mouse-save-thing-there (window x y &optional quiet) | |
216 "Put thing at mouse in kill ring, leave point as is. | |
217 See mouse-mark-thing for a description of the objects recognized." | |
218 (eval-in-window window | |
219 (save-excursion | |
220 (mouse-save-thing window x y quiet)))) | |
221 | |
222 ;;; | |
223 ;;; Mouse yanking... | |
224 ;;; | |
225 (defun mouse-copy-thing (window x y) | |
226 "Put thing at mouse in kill ring, yank to point. | |
227 See mouse-mark-thing for a description of the objects recognized." | |
228 (setq last-command 'not-kill) ;Avoids appending to previous kills. | |
229 (mouse-save-thing-there window x y t) | |
230 (yank) | |
231 (setq this-command 'yank)) | |
232 | |
233 (defun mouse-move-thing (window x y) | |
234 "Kill thing at mouse, yank it to point. | |
235 See mouse-mark-thing for a description of the objects recognized." | |
236 (setq last-command 'not-kill) ;Avoids appending to previous kills. | |
237 (mouse-kill-thing-there window x y) | |
238 (yank) | |
239 (setq this-command 'yank)) | |
240 | |
241 (defun mouse-yank-at-point (&optional window x y) | |
242 "Yank from kill-ring at point; then cycle thru kill ring." | |
243 (if (eq last-command 'yank) | |
244 (let ((before (< (point) (mark)))) | |
245 (delete-region (point) (mark)) | |
246 (insert (current-kill 1)) | |
247 (if before (exchange-point-and-mark))) | |
248 (yank)) | |
249 (setq this-command 'yank)) | |
250 | |
251 (defun mouse-yank-at-mouse (window x y) | |
252 "Yank from kill-ring at mouse; then cycle thru kill ring." | |
253 (mouse-move-point window x y) | |
254 (mouse-yank-at-point window x y)) | |
255 | |
256 (defun mouse-save/delete/yank (&optional window x y) | |
257 "Context sensitive save/delete/yank. | |
258 Consecutive clicks perform as follows: | |
259 * first click saves region to kill ring, | |
260 * second click kills region, | |
261 * third click yanks from kill ring, | |
262 * subsequent clicks cycle thru kill ring. | |
263 If mouse-move-point is performed after the first or second click, | |
264 the next click will do a yank, etc. Except for a possible mouse-move-point, | |
265 this command is insensitive to mouse location." | |
266 (cond | |
267 ((memq last-command '(mouse-delete yank mouse-yank-move)) ; third+ click | |
268 (mouse-yank-at-point)) | |
269 ((eq last-command 'mouse-copy) ; second click | |
270 (kill-region (region-beginning) (region-end)) | |
271 (setq this-command 'mouse-delete)) | |
272 (t ; first click | |
273 (copy-region-as-kill (region-beginning) (region-end)) | |
274 (message "Region saved") | |
275 (setq this-command 'mouse-copy)) | |
276 )) | |
277 | |
278 | |
279 (defun mouse-split-horizontally (window x y) | |
280 "Splits the window horizontally at mouse cursor." | |
281 (eval-in-window window (split-window-horizontally (1+ x)))) | |
282 | |
283 (defun mouse-split-vertically (window x y) | |
284 "Split the window vertically at the mouse cursor." | |
285 (eval-in-window window (split-window-vertically (1+ y)))) | |
286 | |
65185
7d1da711be4c
(mouse-select-or-drag-move-point): Don't pass X and Y (they are ignored anyway).
Juanma Barranquero <lekktu@gmail.com>
parents:
64751
diff
changeset
|
287 (defun mouse-select-window (&optional window x y) |
39022 | 288 "Selects the window, restoring point." |
289 (select-window window)) | |
290 | |
65185
7d1da711be4c
(mouse-select-or-drag-move-point): Don't pass X and Y (they are ignored anyway).
Juanma Barranquero <lekktu@gmail.com>
parents:
64751
diff
changeset
|
291 (defun mouse-delete-other-windows (&optional window x y) |
39022 | 292 "Deletes all windows except the one mouse is in." |
293 (delete-other-windows window)) | |
294 | |
65185
7d1da711be4c
(mouse-select-or-drag-move-point): Don't pass X and Y (they are ignored anyway).
Juanma Barranquero <lekktu@gmail.com>
parents:
64751
diff
changeset
|
295 (defun mouse-delete-window (window &optional x y) |
39022 | 296 "Deletes the window mouse is in." |
297 (delete-window window)) | |
298 | |
299 (defun mouse-undo (window x y) | |
300 "Invokes undo in the window mouse is in." | |
301 (eval-in-window window (undo))) | |
302 | |
303 ;;; | |
304 ;;; Scroll operations | |
305 ;;; | |
306 | |
307 ;;; The move-to-window-line is used below because otherwise | |
308 ;;; scrolling a non-selected process window with the mouse, after | |
309 ;;; the process has written text past the bottom of the window, | |
310 ;;; gives an "End of buffer" error, and then scrolls. The | |
311 ;;; move-to-window-line seems to force recomputing where things are. | |
312 (defun mouse-scroll-up (window x y) | |
313 "Scrolls the window upward." | |
314 (eval-in-window window (move-to-window-line 1) (scroll-up nil))) | |
315 | |
316 (defun mouse-scroll-down (window x y) | |
317 "Scrolls the window downward." | |
318 (eval-in-window window (scroll-down nil))) | |
319 | |
320 (defun mouse-scroll-proportional (window x y) | |
321 "Scrolls the window proportionally corresponding to window | |
322 relative X divided by window width." | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39022
diff
changeset
|
323 (eval-in-window window |
39022 | 324 (if (>= x (1- (window-width))) |
325 ;; When x is maximum (equal to or 1 less than window width), | |
326 ;; goto end of buffer. We check for this special case | |
327 ;; because the calculated goto-char often goes short of the | |
328 ;; end due to roundoff error, and we often really want to go | |
329 ;; to the end. | |
330 (goto-char (point-max)) | |
331 (progn | |
332 (goto-char (+ (point-min) ; For narrowed regions. | |
333 (* x (/ (- (point-max) (point-min)) | |
334 (1- (window-width)))))) | |
335 (beginning-of-line)) | |
336 ) | |
337 (what-cursor-position) ; Report position. | |
338 )) | |
339 | |
340 (defun mouse-line-to-top (window x y) | |
341 "Scrolls the line at the mouse cursor up to the top." | |
342 (eval-in-window window (scroll-up y))) | |
343 | |
344 (defun mouse-top-to-line (window x y) | |
345 "Scrolls the top line down to the mouse cursor." | |
346 (eval-in-window window (scroll-down y))) | |
347 | |
348 (defun mouse-line-to-bottom (window x y) | |
349 "Scrolls the line at the mouse cursor to the bottom." | |
350 (eval-in-window window (scroll-up (+ y (- 2 (window-height)))))) | |
351 | |
352 (defun mouse-bottom-to-line (window x y) | |
353 "Scrolls the bottom line up to the mouse cursor." | |
354 (eval-in-window window (scroll-down (+ y (- 2 (window-height)))))) | |
355 | |
356 (defun mouse-line-to-middle (window x y) | |
357 "Scrolls the line at the mouse cursor to the middle." | |
358 (eval-in-window window (scroll-up (- y -1 (/ (window-height) 2))))) | |
359 | |
360 (defun mouse-middle-to-line (window x y) | |
361 "Scrolls the line at the middle to the mouse cursor." | |
362 (eval-in-window window (scroll-up (- (/ (window-height) 2) y 1)))) | |
363 | |
364 | |
365 ;;; | |
366 ;;; main emacs menu. | |
367 ;;; | |
368 (defmenu expand-menu | |
369 ("Vertically" mouse-expand-vertically *menu-window*) | |
370 ("Horizontally" mouse-expand-horizontally *menu-window*)) | |
371 | |
372 (defmenu delete-window-menu | |
373 ("This One" delete-window *menu-window*) | |
374 ("All Others" delete-other-windows *menu-window*)) | |
375 | |
376 (defmenu mouse-help-menu | |
377 ("Text Region" | |
378 mouse-help-region *menu-window* *menu-x* *menu-y* 'text) | |
379 ("Scrollbar" | |
380 mouse-help-region *menu-window* *menu-x* *menu-y* 'scrollbar) | |
381 ("Modeline" | |
382 mouse-help-region *menu-window* *menu-x* *menu-y* 'modeline) | |
383 ("Minibuffer" | |
384 mouse-help-region *menu-window* *menu-x* *menu-y* 'minibuffer) | |
385 ) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39022
diff
changeset
|
386 |
39022 | 387 (defmenu emacs-quit-menu |
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 ;;; | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39022
diff
changeset
|
422 (defmenu minibuffer-menu |
39022 | 423 ("Minibuffer" message "Just some miscellaneous minibuffer commands") |
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 | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39022
diff
changeset
|
442 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
39022 | 443 ;;; Buffer-mode Mouse commands |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39022
diff
changeset
|
444 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
39022 | 445 |
446 (defun Buffer-at-mouse (w x y) | |
447 "Calls Buffer-menu-buffer from mouse click." | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39022
diff
changeset
|
448 (save-window-excursion |
39022 | 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 )) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39022
diff
changeset
|
477 |
39022 | 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) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
39022
diff
changeset
|
489 (local-set-mouse '(text left) 'mouse-buffer-select) |
39022 | 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 | |
641 (provide 'sun-fns) | |
642 | |
52401 | 643 ;;; arch-tag: 1c4c1192-f71d-4d5f-b883-ae659c28e132 |
39022 | 644 ;;; sun-fns.el ends here |