home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J / os42j.iso / usr / lib / emacs / lisp / x-mouse.elc < prev    next >
Encoding:
Text File  |  1992-08-29  |  9.0 KB  |  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 "
  113. " (quote x-flush-mouse-queue))
  114.  
  115. (define-key global-map "" (quote x-flush-mouse-queue))
  116.  
  117. (defun x-mouse-select (arg) "\
  118. Select Emacs window the mouse is on." (byte-code "˙ ´˙ ´    ?Ĩ
  119. \"É?Ä,² !ÉÈ =Ä(˘ÉÈÁ
  120. È˚ !È ,Ç" [start-w done nil w rel-coordinate arg t selected-window coordinates-in-window-p next-window select-window] 7))
  121.  
  122. (defun x-mouse-keep-one-window (arg) "\
  123. Select Emacs window mouse is on, then kill all other Emacs windows." (byte-code "ˋ!Ä´ Ç" [arg x-mouse-select delete-other-windows] 3))
  124.  
  125. (defun x-mouse-select-and-split (arg) "\
  126. Select Emacs window mouse is on, then split it vertically in half." (byte-code "´!Ä    ˆˋ!Ç" [arg nil x-mouse-select split-window-vertically] 3))
  127.  
  128. (defun x-mouse-set-point (arg) "\
  129. 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
  130. [Á[³
  131. $!),Ç" [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))
  132.  
  133. (defun x-mouse-set-mark (arg) "\
  134. Select Emacs window mouse is on, and set mark at mouse position.
  135. 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))
  136.  
  137. (defun x-cut-text (arg &optional kill) "\
  138. Copy text between point and mouse position into window system cut buffer.
  139. Save in Emacs kill ring also." (byte-code "¯˘ \"Â6Ê`˙˙¨!È    `^    `]ÉȲ˚
  140. \"!ȸ
  141. \"È Ä1³
  142. \"+)Á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))
  143.  
  144. (defun x-paste-text (arg) "\
  145. 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))
  146.  
  147. (defun x-cut-and-wipe-text (arg) "\
  148. Kill text between point and mouse; also copy to window system cut buffer." (byte-code "´ˋ\"Ç" [arg t x-cut-text] 3))
  149.  
  150. (defun x-mouse-ignore (arg) (byte-code "¹Ç" ["Don't do anything."] 1))
  151.  
  152. (defun x-buffer-menu (arg) "\
  153. Pop up a menu of buffers for selection with the mouse." (byte-code "¯˘˙ ¨    Ä5    @²˚¸ !\"?Ä+³˝¸ !˛ !Å$ˇ# B
  154. BÉ)È    AÉÈÁÈ—
  155. !*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))
  156.  
  157. (defun x-help (arg) "\
  158. 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))
  159.  
  160. (define-key mouse-map x-button-right-up (quote x-mouse-ignore))
  161.  
  162. (define-key mouse-map x-button-middle-up (quote x-mouse-ignore))
  163.  
  164. (define-key mouse-map x-button-left-up (quote x-mouse-ignore))
  165.  
  166. (define-key mouse-map x-button-s-right-up (quote x-mouse-ignore))
  167.  
  168. (define-key mouse-map x-button-s-middle-up (quote x-mouse-ignore))
  169.  
  170. (define-key mouse-map x-button-s-left-up (quote x-mouse-ignore))
  171.  
  172. (define-key mouse-map x-button-m-right-up (quote x-mouse-ignore))
  173.  
  174. (define-key mouse-map x-button-m-middle-up (quote x-mouse-ignore))
  175.  
  176. (define-key mouse-map x-button-m-left-up (quote x-mouse-ignore))
  177.  
  178. (define-key mouse-map x-button-c-right-up (quote x-mouse-ignore))
  179.  
  180. (define-key mouse-map x-button-c-middle-up (quote x-mouse-ignore))
  181.  
  182. (define-key mouse-map x-button-c-left-up (quote x-mouse-ignore))
  183.  
  184. (define-key mouse-map x-button-m-s-right-up (quote x-mouse-ignore))
  185.  
  186. (define-key mouse-map x-button-m-s-middle-up (quote x-mouse-ignore))
  187.  
  188. (define-key mouse-map x-button-m-s-left-up (quote x-mouse-ignore))
  189.  
  190. (define-key mouse-map x-button-c-s-right-up (quote x-mouse-ignore))
  191.  
  192. (define-key mouse-map x-button-c-s-middle-up (quote x-mouse-ignore))
  193.  
  194. (define-key mouse-map x-button-c-s-left-up (quote x-mouse-ignore))
  195.  
  196. (define-key mouse-map x-button-c-m-right-up (quote x-mouse-ignore))
  197.  
  198. (define-key mouse-map x-button-c-m-middle-up (quote x-mouse-ignore))
  199.  
  200. (define-key mouse-map x-button-c-m-left-up (quote x-mouse-ignore))
  201.  
  202. (define-key mouse-map x-button-c-m-s-right-up (quote x-mouse-ignore))
  203.  
  204. (define-key mouse-map x-button-c-m-s-middle-up (quote x-mouse-ignore))
  205.  
  206. (define-key mouse-map x-button-c-m-s-left-up (quote x-mouse-ignore))
  207.  
  208. (define-key mouse-map x-button-c-s-left (quote x-buffer-menu))
  209.  
  210. (define-key mouse-map x-button-c-s-middle (quote x-help))
  211.  
  212. (define-key mouse-map x-button-c-s-right (quote x-mouse-keep-one-window))
  213.  
  214. (define-key mouse-map x-button-s-middle (quote x-cut-text))
  215.  
  216. (define-key mouse-map x-button-s-right (quote x-paste-text))
  217.  
  218. (define-key mouse-map x-button-c-middle (quote x-cut-and-wipe-text))
  219.  
  220. (define-key mouse-map x-button-c-right (quote x-mouse-select-and-split))
  221.  
  222. (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)))
  223.