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