home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / emacs-18.59-bin.lha / lib / emacs / 18.59 / lisp / x-mouse.elc < prev    next >
Text File  |  1992-08-29  |  9KB  |  220 lines

  1.  
  2. (provide (quote x-mouse))
  3.  
  4. (defconst x-button-right (char-to-string 0))
  5.  
  6. (defconst x-button-middle (char-to-string 1))
  7.  
  8. (defconst x-button-left (char-to-string 2))
  9.  
  10. (defconst x-button-right-up (char-to-string 4))
  11.  
  12. (defconst x-button-middle-up (char-to-string 5))
  13.  
  14. (defconst x-button-left-up (char-to-string 6))
  15.  
  16. (defconst x-button-s-right (char-to-string 16))
  17.  
  18. (defconst x-button-s-middle (char-to-string 17))
  19.  
  20. (defconst x-button-s-left (char-to-string 18))
  21.  
  22. (defconst x-button-s-right-up (char-to-string 20))
  23.  
  24. (defconst x-button-s-middle-up (char-to-string 21))
  25.  
  26. (defconst x-button-s-left-up (char-to-string 22))
  27.  
  28. (defconst x-button-m-right (char-to-string 32))
  29.  
  30. (defconst x-button-m-middle (char-to-string 33))
  31.  
  32. (defconst x-button-m-left (char-to-string 34))
  33.  
  34. (defconst x-button-m-right-up (char-to-string 36))
  35.  
  36. (defconst x-button-m-middle-up (char-to-string 37))
  37.  
  38. (defconst x-button-m-left-up (char-to-string 38))
  39.  
  40. (defconst x-button-c-right (char-to-string 64))
  41.  
  42. (defconst x-button-c-middle (char-to-string 65))
  43.  
  44. (defconst x-button-c-left (char-to-string 66))
  45.  
  46. (defconst x-button-c-right-up (char-to-string 68))
  47.  
  48. (defconst x-button-c-middle-up (char-to-string 69))
  49.  
  50. (defconst x-button-c-left-up (char-to-string 70))
  51.  
  52. (defconst x-button-m-s-right (char-to-string 48))
  53.  
  54. (defconst x-button-m-s-middle (char-to-string 49))
  55.  
  56. (defconst x-button-m-s-left (char-to-string 50))
  57.  
  58. (defconst x-button-m-s-right-up (char-to-string 52))
  59.  
  60. (defconst x-button-m-s-middle-up (char-to-string 53))
  61.  
  62. (defconst x-button-m-s-left-up (char-to-string 54))
  63.  
  64. (defconst x-button-c-s-right (char-to-string 80))
  65.  
  66. (defconst x-button-c-s-middle (char-to-string 81))
  67.  
  68. (defconst x-button-c-s-left (char-to-string 82))
  69.  
  70. (defconst x-button-c-s-right-up (char-to-string 84))
  71.  
  72. (defconst x-button-c-s-middle-up (char-to-string 85))
  73.  
  74. (defconst x-button-c-s-left-up (char-to-string 86))
  75.  
  76. (defconst x-button-c-m-right (char-to-string 96))
  77.  
  78. (defconst x-button-c-m-middle (char-to-string 97))
  79.  
  80. (defconst x-button-c-m-left (char-to-string 98))
  81.  
  82. (defconst x-button-c-m-right-up (char-to-string 100))
  83.  
  84. (defconst x-button-c-m-middle-up (char-to-string 101))
  85.  
  86. (defconst x-button-c-m-left-up (char-to-string 102))
  87.  
  88. (defconst x-button-c-m-s-right (char-to-string 112))
  89.  
  90. (defconst x-button-c-m-s-middle (char-to-string 113))
  91.  
  92. (defconst x-button-c-m-s-left (char-to-string 114))
  93.  
  94. (defconst x-button-c-m-s-right-up (char-to-string 116))
  95.  
  96. (defconst x-button-c-m-s-middle-up (char-to-string 117))
  97.  
  98. (defconst x-button-c-m-s-left-up (char-to-string 118))
  99.  
  100. (defvar x-process-mouse-hook nil "\
  101. Hook to run after each mouse event is processed.  Should take two
  102. arguments; the first being a list (XPOS YPOS) corresponding to character
  103. offset from top left of screen and the second being a specifier for the
  104. buttons/keys.
  105.  
  106. This will normally be set on a per-buffer basis.")
  107.  
  108. (defun x-flush-mouse-queue nil "\
  109. Process all queued mouse events." (interactive) (byte-code "ÈĠÅV… Æ ˆÇÀ!…ÀJ…È    
  110. #ˆ‚‡" [x-process-mouse-hook x-mouse-pos x-mouse-item nil x-mouse-events 0 x-proc-mouse-event boundp funcall] 8))
  111.  
  112. (define-key global-map "" (quote x-flush-mouse-queue))
  113.  
  114. (define-key global-map "" (quote x-flush-mouse-queue))
  115.  
  116. (defun x-mouse-select (arg) "\
  117. Select Emacs window the mouse is on." (byte-code "Ç ÂǠ    ?…È \"‰?…,É !‰ˆ =…(Ɖˆ‚
  118. ˆÊ !ˆ ,‡" [start-w done nil w rel-coordinate arg t selected-window coordinates-in-window-p next-window select-window] 7))
  119.  
  120. (defun x-mouse-keep-one-window (arg) "\
  121. Select Emacs window mouse is on, then kill all other Emacs windows." (byte-code "Á!… ‡" [arg x-mouse-select delete-other-windows] 3))
  122.  
  123. (defun x-mouse-select-and-split (arg) "\
  124. Select Emacs window mouse is on, then split it vertically in half." (byte-code "Â!…    ÃÁ!‡" [arg nil x-mouse-select split-window-vertically] 3))
  125.  
  126. (defun x-mouse-set-point (arg) "\
  127. Select Emacs window mouse is on, and move point to mouse position." (byte-code "É    !Ç@A@…_Ê Ë =ƒ‚ÌÍ !ˆmƒ,ǂ^†5ΠÌVƒ<i‚DiÏiРS\"Z‰ˆÑÒ ÓΠ]S`ÓUƒZ[‚[Ì
  128. $!),‡" [relative-coordinate arg margin-column rel-x rel-y prompt-width minibuffer-prompt-width nil truncate-lines x-mouse-select selected-window minibuffer-window 0 move-to-window-line window-hscroll % window-width move-to-column + 1] 14))
  129.  
  130. (defun x-mouse-set-mark (arg) "\
  131. Select Emacs window mouse is on, and set mark at mouse position.
  132. Display cursor at that position for a second." (byte-code "Ä!…`ŎÆ!ˆÇÂÃ\"ˆÈÉ!))‡" [arg point-save nil t x-mouse-select ((byte-code "b‡" [point-save] 1)) x-mouse-set-point push-mark sit-for 1] 5))
  133.  
  134. (defun x-cut-text (arg &optional kill) "\
  135. Copy text between point and mouse position into window system cut buffer.
  136. Save in Emacs kill ring also." (byte-code "ÅÆ \"ƒ6Š`ÇÇÈ!ˆ    `^    `]‰ˆÉÊ
  137. \"!ˆË
  138. \"ˆ …1Ì
  139. \"+)‚9ÍÎ!‡" [arg opoint beg end kill coordinates-in-window-p selected-window nil x-mouse-set-point x-store-cut-buffer buffer-substring copy-region-as-kill delete-region message "Mouse not in selected window"] 9))
  140.  
  141. (defun x-paste-text (arg) "\
  142. Move point to mouse position and insert window system cut buffer contents." (byte-code "Á!ˆÂ c‡" [arg x-mouse-set-point x-get-cut-buffer] 3))
  143.  
  144. (defun x-cut-and-wipe-text (arg) "\
  145. Kill text between point and mouse; also copy to window system cut buffer." (byte-code "ÂÁ\"‡" [arg t x-cut-text] 3))
  146.  
  147. (defun x-mouse-ignore (arg) (byte-code "À‡" ["Don't do anything."] 1))
  148.  
  149. (defun x-buffer-menu (arg) "\
  150. Pop up a menu of buffers for selection with the mouse." (byte-code "ÅÆÇ È    …5    @ÉÊË !\"?…+ÌÍË !Î !†$Ï# B
  151. B‰)ˆ    A‰ˆ‚ˆÐ
  152. !*BDÑÒ \"†Fp!)‡" [menu tail head elt arg "Buffer Menu" "Select Buffer" buffer-list nil string-match "^ " buffer-name format "%14s   %s" buffer-file-name "" reverse switch-to-buffer x-popup-menu] 12))
  153.  
  154. (defun x-help (arg) "\
  155. Enter a menu-based help system." (byte-code "    Ã\"… Ä!)‡" [selection arg x-popup-menu ("Help" ("Is there a command that..." ("Command apropos" . command-apropos) ("Apropos" . apropos)) ("Key Commands <==> Functions" ("List all keystroke commands" . describe-bindings) ("Describe key briefly" . describe-key-briefly) ("Describe key verbose" . describe-key) ("Describe Lisp function" . describe-function) ("Where is this command" . where-is)) ("Manual and tutorial" ("Info system" . info) ("Invoke Emacs tutorial" . help-with-tutorial)) ("Odds and ends" ("Last 100 Keystrokes" . view-lossage) ("Describe syntax table" . describe-syntax)) ("Modes" ("Describe current major mode" . describe-mode) ("List all keystroke commands" . describe-bindings)) ("Administrivia" ("View Emacs news" . view-emacs-news) ("View the GNU Emacs license" . describe-copying) ("Describe distribution" . describe-distribution) ("Describe (non)warranty" . describe-no-warranty))) call-interactively] 3))
  156.  
  157. (define-key mouse-map x-button-right-up (quote x-mouse-ignore))
  158.  
  159. (define-key mouse-map x-button-middle-up (quote x-mouse-ignore))
  160.  
  161. (define-key mouse-map x-button-left-up (quote x-mouse-ignore))
  162.  
  163. (define-key mouse-map x-button-s-right-up (quote x-mouse-ignore))
  164.  
  165. (define-key mouse-map x-button-s-middle-up (quote x-mouse-ignore))
  166.  
  167. (define-key mouse-map x-button-s-left-up (quote x-mouse-ignore))
  168.  
  169. (define-key mouse-map x-button-m-right-up (quote x-mouse-ignore))
  170.  
  171. (define-key mouse-map x-button-m-middle-up (quote x-mouse-ignore))
  172.  
  173. (define-key mouse-map x-button-m-left-up (quote x-mouse-ignore))
  174.  
  175. (define-key mouse-map x-button-c-right-up (quote x-mouse-ignore))
  176.  
  177. (define-key mouse-map x-button-c-middle-up (quote x-mouse-ignore))
  178.  
  179. (define-key mouse-map x-button-c-left-up (quote x-mouse-ignore))
  180.  
  181. (define-key mouse-map x-button-m-s-right-up (quote x-mouse-ignore))
  182.  
  183. (define-key mouse-map x-button-m-s-middle-up (quote x-mouse-ignore))
  184.  
  185. (define-key mouse-map x-button-m-s-left-up (quote x-mouse-ignore))
  186.  
  187. (define-key mouse-map x-button-c-s-right-up (quote x-mouse-ignore))
  188.  
  189. (define-key mouse-map x-button-c-s-middle-up (quote x-mouse-ignore))
  190.  
  191. (define-key mouse-map x-button-c-s-left-up (quote x-mouse-ignore))
  192.  
  193. (define-key mouse-map x-button-c-m-right-up (quote x-mouse-ignore))
  194.  
  195. (define-key mouse-map x-button-c-m-middle-up (quote x-mouse-ignore))
  196.  
  197. (define-key mouse-map x-button-c-m-left-up (quote x-mouse-ignore))
  198.  
  199. (define-key mouse-map x-button-c-m-s-right-up (quote x-mouse-ignore))
  200.  
  201. (define-key mouse-map x-button-c-m-s-middle-up (quote x-mouse-ignore))
  202.  
  203. (define-key mouse-map x-button-c-m-s-left-up (quote x-mouse-ignore))
  204.  
  205. (define-key mouse-map x-button-c-s-left (quote x-buffer-menu))
  206.  
  207. (define-key mouse-map x-button-c-s-middle (quote x-help))
  208.  
  209. (define-key mouse-map x-button-c-s-right (quote x-mouse-keep-one-window))
  210.  
  211. (define-key mouse-map x-button-s-middle (quote x-cut-text))
  212.  
  213. (define-key mouse-map x-button-s-right (quote x-paste-text))
  214.  
  215. (define-key mouse-map x-button-c-middle (quote x-cut-and-wipe-text))
  216.  
  217. (define-key mouse-map x-button-c-right (quote x-mouse-select-and-split))
  218.  
  219. (if (= window-system-version 10) (progn (define-key mouse-map x-button-right (quote x-mouse-select)) (define-key mouse-map x-button-left (quote x-mouse-set-mark)) (define-key mouse-map x-button-middle (quote x-mouse-set-point))) (define-key mouse-map x-button-right (quote x-cut-text)) (define-key mouse-map x-button-left (quote x-mouse-set-point)) (define-key mouse-map x-button-middle (quote x-paste-text)))
  220.