(defconst shift 1) (defconst control 2) (defconst shift-control 3) (defconst meta 4) (defconst left 4) (defconst middle 1) (defconst right 2) (defvar il-mouse-kill-emacs (symbol-function (quote kill-emacs))) (defvar il-mouse-fast-select-window t "\ *Non-nil for mouse hits to select new window, then execute; else just select.") (defvar scrollbar-enabled t "\ Non-nil to use last column as scrollbar") (defvar auto-switch-enabled nil "\ Non-nil to send init string to terminal") (defun il-mouse-report nil "\ Read and parse Interlisp ChatEmacs mouse report, and do what it asks. L-- move point * |---- These apply for mouse click in a window. --R set mark * | If il-mouse-fast-select-window is nil, -C- depends on shift * | just selects that window. middle-button actions: shift: yank region to point control: kill region shift-control: copy region to killbuffer on modeline on \"scroll bar\" in minibuffer L-- scroll-up line to top execute-extended-command --R scroll-down line to bottom eval-expression -C- proportional goto-char proportional suspend-emacs Meta-mouse-button actions are same as scrollbar." (interactive) (byte-code "ÒˆÓ SÔÕ!^Ö SÔÕ!^ÔÕ!ÔÕ!× \"Ø !Ù  Ö S=?…8 = Ú 8S= Û 8SY Ü 8Z‰ˆ Ý 8Z‰ˆ ƒœÞ !ˆ  Uƒoß ‚”  Uƒ{à ‚”  U…”áâdeZã S\"\"bˆä ˆå ˆÞ!‚5…£ †ª =ƒìÞ !ˆ  Uƒ¾ß !‚ä  UƒËà !‚ä  U…äá âdeZæ S\"\"bˆä ˆå ˆÞ!‚5ƒúç $‚5ƒ%  Uƒ èé!‚\"  Uƒèê!‚\"  U…\"ë ‚5Þ !ˆ?†5ç $. ‡" [x y buttons bucky-bits window edges old-window in-minibuf-p same-window-p in-modeline-p in-scrollbar-p left right middle scrollbar-enabled meta t il-mouse-fast-select-window nil screen-width il-get-tty-num 59 screen-height il-pos-to-window window-edges selected-window 3 2 0 1 select-window scroll-up scroll-down * / window-width beginning-of-line what-cursor-position window-height il-button-command call-interactively eval-expression execute-extended-command suspend-emacs] 38)) (defun il-button-command (x y buttons bucky-bits) (byte-code " Uƒa Ê=ƒË \"‚^ =ƒ)Ì ˆË \"ˆÍÎ `\"‚^ =ƒEÏÎ `\"ˆË \"ˆÐ‰ˆÐ ‚^ =…^ÍÎ `\"ˆË \"ˆÐ‰ˆÐ ‚„ U…„Ì ˆË \"ˆ =ƒ~ÍÎ `\"‚„ÑÒ!ˆÓ ‡" [buttons left bucky-bits x y control shift this-command shift-control right 0 il-move-point-to-x-y push-mark kill-region mark copy-region-as-kill yank sit-for 1 exchange-point-and-mark] 20)) (defun il-get-tty-num (term-char) "\ Read from terminal until TERM-CHAR is read, and return intervening number. Upon non-numeric not matching TERM-CHAR, signal an error." (byte-code "ÃrÄZ ÃY… ÅX…$ÆÇ\" \\‰ˆrÄZ‰ˆ‚ˆ Ä\\=†0ÈÉ!ˆ*‡" [num char term-char 0 48 9 * 10 error "Invalid data format in mouse command"] 4)) (defun il-move-point-to-x-y (x y) "\ Position cursor in window coordinates. X and Y are 0-based character positions in the window." (byte-code "Â!ˆÃ !‡" [y x move-to-window-line move-to-column] 3)) (defun il-pos-to-window (x y) "\ Find window corresponding to screen coordinates. X and Y are 0-based character positions on the screen." (byte-code "Å Â Æ =?…* Ç8W†* È8Y†* É8W†* Ê8Y…<Ë !‰ˆÅ !‰ˆ‚ˆ †CÆ *‡" [edges window nil y x window-edges selected-window 1 3 0 2 next-window] 7)) (defun suspend-hook-fn nil (interactive) (byte-code "ÀˆÁÂ!ˆÀ‡" [nil send-string-to-terminal "0"] 2)) (defun suspend-resume-hook-fn nil (interactive) (byte-code "ÀˆÁÂ!ˆÀ‡" [nil send-string-to-terminal "1"] 2)) (global-set-key "" (quote il-mouse-report)) (if auto-switch-enabled (progn (send-string-to-terminal "1") (defun kill-emacs nil (interactive) (send-string-to-terminal "0") (funcall il-mouse-kill-emacs)) (setq suspend-hook (symbol-function (quote suspend-hook-fn))) (setq suspend-resume-hook (symbol-function (quote suspend-resume-hook-fn)))))