(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-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-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-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-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-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-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-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)) (defun x-flush-mouse-queue nil "\ Process all queued mouse events." (interactive) (byte-code "ΐΑ ΒV Γ " [nil x-mouse-events 0 x-proc-mouse-event] 4)) (define-key global-map " " (quote x-flush-mouse-queue)) (defun x-mouse-select (arg) "\ Select Emacs window the mouse is on." (byte-code "Η Η ? Θ \"? 1 Ι!=, - Β Κ!," [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 nil] 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@ Ε!Ζ i\\! Η+" [relative-coordinate arg rel-x rel-y x-mouse-select move-to-window-line move-to-column nil] 5)) (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 "Β! `ΓΔ!`sΕΖ!)) Η" [arg point-save x-mouse-select ((byte-code "b" [point-save] 1)) x-mouse-set-point sit-for 1 nil] 4)) (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 "ΕΖ \": `ΗΗΘ! `^ `]ΙΚ \"!Λ \"4 Μ \"5 Η+)= ΝΞ!" [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)) (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-c-s-right (quote x-mouse-keep-one-window)) (define-key mouse-map x-button-c-right (quote x-mouse-select-and-split)) (define-key mouse-map x-button-middle (quote x-mouse-set-point)) (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))