1
0
mirror of synced 2026-01-12 00:42:56 +00:00
Interlisp.medley/lispusers/chatemacs.elc
2020-11-15 19:22:14 -08:00

97 lines
4.3 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(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")
(defvar save-screen-width (screen-width))
(defvar save-screen-height (screen-height))
(defun il-mouse-report nil "\
Read Interlisp ChatEmacs mouse report, branch to appropriate sub-handler." (interactive) (byte-code "ÁˆrÂUƒà ÄU…Å )‡" [sub-char nil 115 il-set-screen-size 109 il-mouse-command] 3))
(defun il-set-screen-size nil (byte-code "ÄÅ!ÄÅ!
U†ˆÆ!ˆ U†#ˆÇ !*‡" [cur-screen-width cur-screen-height save-screen-width save-screen-height il-get-tty-num 59 set-screen-width set-screen-height] 5))
(defun il-mouse-command 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-- split-vertical line to top execute-extended-command
--R split-horizontal line to bottom eval-expression
-C- delete-window 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…„á …Ž
†• =ƒ×Þ !ˆ
 Uƒ©â !‚Ï
 Uƒ¶ã !‚Ï

U…Ïä ådeZæ S\"\"bˆç ˆè ˆÞ! ƒåé
$ ƒ

Uƒ÷êë!

 êì!

 U…
í Þ !ˆ?† é
$. ‡" [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 split-window-vertically delete-window split-window-horizontally scroll-up scroll-down * / window-height beginning-of-line what-cursor-position il-button-command call-interactively eval-expression execute-extended-command suspend-emacs] 33))
(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) "\
Move cursor to window location X, Y.
Handles wrapped and horizontally scrolled lines correctly." (byte-code "Ä!ˆiÅÆÇ !ƒiÈ ÉZ ^\\\"ÊÇ ËÈ S ^#!
Z*‡" [y cc nc x move-to-window-line move-to-column zerop window-hscroll window-width 2 + -1] 13))
(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)))))