4.4BSD/usr/src/contrib/emacs-18.57/lisp/x-mouse.elc


(provide (quote x-mouse))

(defconst x-button-right (char-to-string 0))

(defconst x-button-middle (char-to-string 1))

(defconst x-button-left (char-to-string 2))

(defconst x-button-right-up (char-to-string 4))

(defconst x-button-middle-up (char-to-string 5))

(defconst x-button-left-up (char-to-string 6))

(defconst x-button-s-right (char-to-string 16))

(defconst x-button-s-middle (char-to-string 17))

(defconst x-button-s-left (char-to-string 18))

(defconst x-button-s-right-up (char-to-string 20))

(defconst x-button-s-middle-up (char-to-string 21))

(defconst x-button-s-left-up (char-to-string 22))

(defconst x-button-m-right (char-to-string 32))

(defconst x-button-m-middle (char-to-string 33))

(defconst x-button-m-left (char-to-string 34))

(defconst x-button-m-right-up (char-to-string 36))

(defconst x-button-m-middle-up (char-to-string 37))

(defconst x-button-m-left-up (char-to-string 38))

(defconst x-button-c-right (char-to-string 64))

(defconst x-button-c-middle (char-to-string 65))

(defconst x-button-c-left (char-to-string 66))

(defconst x-button-c-right-up (char-to-string 68))

(defconst x-button-c-middle-up (char-to-string 69))

(defconst x-button-c-left-up (char-to-string 70))

(defconst x-button-m-s-right (char-to-string 48))

(defconst x-button-m-s-middle (char-to-string 49))

(defconst x-button-m-s-left (char-to-string 50))

(defconst x-button-m-s-right-up (char-to-string 52))

(defconst x-button-m-s-middle-up (char-to-string 53))

(defconst x-button-m-s-left-up (char-to-string 54))

(defconst x-button-c-s-right (char-to-string 80))

(defconst x-button-c-s-middle (char-to-string 81))

(defconst x-button-c-s-left (char-to-string 82))

(defconst x-button-c-s-right-up (char-to-string 84))

(defconst x-button-c-s-middle-up (char-to-string 85))

(defconst x-button-c-s-left-up (char-to-string 86))

(defconst x-button-c-m-right (char-to-string 96))

(defconst x-button-c-m-middle (char-to-string 97))

(defconst x-button-c-m-left (char-to-string 98))

(defconst x-button-c-m-right-up (char-to-string 100))

(defconst x-button-c-m-middle-up (char-to-string 101))

(defconst x-button-c-m-left-up (char-to-string 102))

(defconst x-button-c-m-s-right (char-to-string 112))

(defconst x-button-c-m-s-middle (char-to-string 113))

(defconst x-button-c-m-s-left (char-to-string 114))

(defconst x-button-c-m-s-right-up (char-to-string 116))

(defconst x-button-c-m-s-middle-up (char-to-string 117))

(defconst x-button-c-m-s-left-up (char-to-string 118))

(defvar x-process-mouse-hook nil "\
Hook to run after each mouse event is processed.  Should take two
arguments; the first being a list (XPOS YPOS) corresponding to character
offset from top left of screen and the second being a specifier for the
buttons/keys.

This will normally be set on a per-buffer basis.")

(defun x-flush-mouse-queue nil "\
Process all queued mouse events." (interactive) (byte-code "È V  !J	
#" [x-process-mouse-hook x-mouse-pos x-mouse-item nil x-mouse-events 0 x-proc-mouse-event boundp funcall] 8))

(define-key global-map "
" (quote x-flush-mouse-queue))

(define-key global-map "" (quote x-flush-mouse-queue))

(defun x-mouse-select (arg) "\
Select Emacs window the mouse is on." (byte-code "  	?
\"?,!=(Ɖ
!," [start-w done nil w rel-coordinate arg t selected-window coordinates-in-window-p next-window select-window] 7))

(defun x-mouse-keep-one-window (arg) "\
Select Emacs window mouse is on, then kill all other Emacs windows." (byte-code "! " [arg x-mouse-select delete-other-windows] 3))

(defun x-mouse-select-and-split (arg) "\
Select Emacs window mouse is on, then split it vertically in half." (byte-code "!	!" [arg nil x-mouse-select split-window-vertically] 3))

(defun x-mouse-set-point (arg) "\
Select Emacs window mouse is on, and move point to mouse position." (byte-code "	!@A@!
 ]Si#!+" [relative-coordinate arg rel-x rel-y x-mouse-select move-to-window-line move-to-column + 1 window-hscroll] 8))

(defun x-mouse-set-mark (arg) "\
Select Emacs window mouse is on, and set mark at mouse position.
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))

(defun x-cut-text (arg &optional kill) "\
Copy text between point and mouse position into window system cut buffer.
Save in Emacs kill ring also." (byte-code " \"6`!	`^	`]
\"!
\"1
\"+)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))

(defun x-paste-text (arg) "\
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))

(defun x-cut-and-wipe-text (arg) "\
Kill text between point and mouse; also copy to window system cut buffer." (byte-code "\"" [arg t x-cut-text] 3))

(defun x-mouse-ignore (arg) "\
Don't do anything." (byte-code "" [nil] 1))

(defun x-buffer-menu (arg) "\
Pop up a menu of buffers for selection with the mouse." (byte-code " 	5	@!\"?+!!$#B
B)	A
!*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))

(defun x-help (arg) "\
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))

(define-key mouse-map x-button-right-up (quote x-mouse-ignore))

(define-key mouse-map x-button-middle-up (quote x-mouse-ignore))

(define-key mouse-map x-button-left-up (quote x-mouse-ignore))

(define-key mouse-map x-button-s-right-up (quote x-mouse-ignore))

(define-key mouse-map x-button-s-middle-up (quote x-mouse-ignore))

(define-key mouse-map x-button-s-left-up (quote x-mouse-ignore))

(define-key mouse-map x-button-m-right-up (quote x-mouse-ignore))

(define-key mouse-map x-button-m-middle-up (quote x-mouse-ignore))

(define-key mouse-map x-button-m-left-up (quote x-mouse-ignore))

(define-key mouse-map x-button-c-right-up (quote x-mouse-ignore))

(define-key mouse-map x-button-c-middle-up (quote x-mouse-ignore))

(define-key mouse-map x-button-c-left-up (quote x-mouse-ignore))

(define-key mouse-map x-button-m-s-right-up (quote x-mouse-ignore))

(define-key mouse-map x-button-m-s-middle-up (quote x-mouse-ignore))

(define-key mouse-map x-button-m-s-left-up (quote x-mouse-ignore))

(define-key mouse-map x-button-c-s-right-up (quote x-mouse-ignore))

(define-key mouse-map x-button-c-s-middle-up (quote x-mouse-ignore))

(define-key mouse-map x-button-c-s-left-up (quote x-mouse-ignore))

(define-key mouse-map x-button-c-m-right-up (quote x-mouse-ignore))

(define-key mouse-map x-button-c-m-middle-up (quote x-mouse-ignore))

(define-key mouse-map x-button-c-m-left-up (quote x-mouse-ignore))

(define-key mouse-map x-button-c-m-s-right-up (quote x-mouse-ignore))

(define-key mouse-map x-button-c-m-s-middle-up (quote x-mouse-ignore))

(define-key mouse-map x-button-c-m-s-left-up (quote x-mouse-ignore))

(define-key mouse-map x-button-c-s-left (quote x-buffer-menu))

(define-key mouse-map x-button-c-s-middle (quote x-help))

(define-key mouse-map x-button-c-s-right (quote x-mouse-keep-one-window))

(define-key mouse-map x-button-s-middle (quote x-cut-text))

(define-key mouse-map x-button-s-right (quote x-paste-text))

(define-key mouse-map x-button-c-middle (quote x-cut-and-wipe-text))

(define-key mouse-map x-button-c-right (quote x-mouse-select-and-split))

(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)))