home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / emacs-18.59-bin.lha / lib / emacs / 18.59 / lisp / terminal.elc < prev    next >
Text File  |  1991-01-09  |  24KB  |  306 lines

  1.  
  2. (provide (quote terminal))
  3.  
  4. (require (quote ehelp))
  5.  
  6. (defvar terminal-escape-char 30 "\
  7. *All characters except for this are passed verbatim through the
  8. terminal-emulator.  This character acts as a prefix for commands
  9. to the emulator program itself.  Type this character twice to send
  10. it through the emulator.  Type ? after typing it for a list of
  11. possible commands.
  12. This variable is local to each terminal-emulator buffer.")
  13.  
  14. (defvar terminal-scrolling t "\
  15. *If non-nil, the terminal-emulator will `scroll' when output occurs
  16. past the bottom of the screen.  If nil, output will `wrap' to the top
  17. of the screen.
  18. This variable is local to each terminal-emulator buffer.")
  19.  
  20. (defvar terminal-more-processing t "\
  21. *If non-nil, do more-processing.
  22. This variable is local to each terminal-emulator buffer.")
  23.  
  24. (defvar terminal-redisplay-interval 5000 "\
  25. *Maximum number of characters which will be processed by the
  26. terminal-emulator before a screen redisplay is forced.
  27. Set this to a large value for greater throughput,
  28. set it smaller for more frequent updates but overall slower
  29. performance.")
  30.  
  31. (defvar terminal-more-break-insertion "*** More break -- Press space to continue ***")
  32.  
  33. (defvar terminal-escape-map nil)
  34.  
  35. (defvar terminal-map nil)
  36.  
  37. (defvar terminal-more-break-map nil)
  38.  
  39. (if terminal-map nil (let ((map (make-keymap))) (fillarray map (quote te-pass-through)) (setq terminal-map map)))
  40.  
  41. (if terminal-escape-map nil (let ((map (make-keymap))) (fillarray map (quote undefined)) (let ((s "0")) (while (<= (aref s 0) 57) (define-key map s (quote digit-argument)) (aset s 0 (1+ (aref s 0))))) (define-key map "b" (quote switch-to-buffer)) (define-key map "o" (quote other-window)) (define-key map "e" (quote te-set-escape-char)) (define-key map " " (quote redraw-display)) (define-key map "" (quote te-flush-pending-output)) (define-key map "m" (quote te-toggle-more-processing)) (define-key map "x" (quote te-escape-extended-command)) (define-key map "?" (quote te-escape-help)) (define-key map (char-to-string help-char) (quote te-escape-help)) (setq terminal-escape-map map)))
  42.  
  43. (defvar te-escape-command-alist nil)
  44.  
  45. (if te-escape-command-alist nil (setq te-escape-command-alist (quote (("Set Escape Character" . te-set-escape-char) ("Refresh" . redraw-display) ("Record Output" . te-set-output-log) ("Photo" . te-set-output-log) ("Tofu" . te-tofu) ("Stuff Input" . te-stuff-string) ("Flush Pending Output" . te-flush-pending-output) ("Enable More Processing" . te-enable-more-processing) ("Disable More Processing" . te-disable-more-processing) ("Scroll at end of page" . te-do-scrolling) ("Wrap at end of page" . te-do-wrapping) ("Switch To Buffer" . switch-to-buffer) ("Other Window" . other-window) ("Kill Buffer" . kill-buffer) ("Help" . te-escape-help) ("Set Redisplay Interval" . te-set-redisplay-interval)))))
  46.  
  47. (if terminal-more-break-map nil (let ((map (make-keymap))) (fillarray map (quote te-more-break-unread)) (define-key map (char-to-string help-char) (quote te-more-break-help)) (define-key map " " (quote te-more-break-resume)) (define-key map " " (quote redraw-display)) (define-key map "" (quote te-more-break-flush-pending-output)) (define-key map "" (quote te-more-break-advance-one-line)) (setq terminal-more-break-map map)))
  48.  
  49. (defun te-escape nil (interactive) (byte-code "LjÇÈ É ÊŽË !ˆÌ !ˆÍ ƒ\"ÎÏÐ !\"‚#Ñ!‰)ˆÒÓ!ˆÔÕÖ\"\"ƒC‰ˆ×Ø )‚OÙ \"‰…OÚ!+‡" [s local global terminal-escape-map prefix-arg terminal-escape-char last-command-char nil current-local-map current-global-map ((byte-code "Â!ˆÃ    !‡" [global local use-global-map use-local-map] 3)) use-global-map use-local-map read-key-sequence format "Emacs Terminal escape> %d " prefix-numeric-value "Emacs Terminal escape> " message "" string= make-string 1 -259 te-pass-through lookup-key call-interactively] 14))
  50.  
  51. (defun te-escape-help nil "\
  52. Provide help on commands available after terminal-escape-char is typed." (interactive) (byte-code "ˆÃÄ!ˆÅ    !ÆÇ!)‡" [char terminal-escape-char nil message "Terminal emulator escape help..." single-key-description with-electric-help (lambda nil (byte-code "ÇÈÉ%!ˆÇÊË!!ˆÇÈÌÍΠ   Â#Î#!ˆÏÐ!ƒ+ÐÑ !Ò\"‚1ÓÑ !Ô\" …oÕ @A!†?Ö×Ø\"…OÙÚÙ!O‰ˆÇÛ!ˆÇ @@!ˆÇÜ!ˆÇ!ˆÝÞ!)ˆ A‰ˆ‚2)ˆÆ‡" [char terminal-escape-map t l te-escape-command-alist doc nil princ format "Terminal-emulator escape, invoked by \"%s\"
  53. Type \"%s\" twice to send a single \"%s\" through.
  54.  
  55. Other chars following \"%s\" are interpreted as follows:
  56. " substitute-command-keys "\\{terminal-escape-map}
  57. " "
  58. Subcommands of \"%s\" (%s)
  59. " where-is-internal te-escape-extended-command fboundp sortcar copy-sequence string< sort (lambda (a b) (byte-code "Â@    @\"‡" [a b string<] 3)) documentation "Not documented" string-match "
  60. " 0 match-beginning "  \"" "\":
  61.      " write-char 10] 23))] 4))
  62.  
  63. (defun te-escape-extended-command nil (interactive) (byte-code "ĈÂÅÆ ÄÂ$)…Çȍ)‡" [c completion-ignore-case t te-escape-command-alist nil completing-read "terminal command: " foo (byte-code "Ã!‰ˆ
  64.     …*Äà   @@!\"ƒ\"ÅÆÇ    @A!\"‚&    A‰ˆ‚)‡" [c l te-escape-command-alist downcase string= throw foo call-interactively] 8)] 5))
  65.  
  66. (defun te-escape-extended-command-unread nil (interactive) (byte-code "ˆ    ‰ˆÃ ‡" [unread-command-char last-input-char nil te-escape-extended-command] 2))
  67.  
  68. (defun te-set-escape-char (c) "\
  69. Change the terminal-emulator escape character." (interactive "cSet escape character to: ") (byte-code "È    Ä
  70. UƒłÆÇ
  71. !Ç!#ˆ
  72. ‰)‡" [o terminal-escape-char c nil message "\"%s\" is escape char" "\"%s\" is now escape; \"%s\" passes though" single-key-description] 6))
  73.  
  74. (defun te-stuff-string (string) "\
  75. Read a string to send to through the terminal emulator
  76. as though that string had been typed on the keyboard.
  77.  
  78. Very poor man's file transfer protocol." (interactive "sStuff string: ") (byte-code "ˆà   \"‡" [te-process string nil process-send-string] 3))
  79.  
  80. (defun te-set-output-log (name) "\
  81. Record output from the terminal emulator in a buffer." (interactive (byte-code "ƒÁ‚ÂÃÄÅÆp!\"Á#C‡" [te-log-buffer nil read-buffer "Record output in buffer: " format "%s output-log" buffer-name] 6)) (byte-code "Áˆ
  82. ?† Ã
  83. Ä\"ƒÁ‰ˆÅÆ!‚?Ç
  84. !ƒ\"Á‚2ŠÈ
  85. !qˆÉ ˆÊp!ˆË )ˆÇ
  86. !‰ˆÅÌÍ!\"‡" [te-log-buffer nil name equal "" message "Output logging off." get-buffer get-buffer-create fundamental-mode buffer-flush-undo erase-buffer "Recording terminal emulator output into buffer \"%s\"" buffer-name] 12))
  87.  
  88. (defun te-tofu nil "\
  89. Discontinue output log." (interactive) (byte-code "ÀˆÁÀ!‡" [nil te-set-output-log] 2))
  90.  
  91. (defun te-toggle (sym arg) (byte-code "Ä    !?ƒ     ‚#    ÅUƒJ?‚#    ÆWƒ\"‚#ÃL‡" [sym arg nil t numberp 1 0] 4))
  92.  
  93. (defun te-toggle-more-processing (arg) (interactive "p") (byte-code "ÈÄÅÁ\"ƒƂÇ!ˆ    …ȉ‡" [arg terminal-more-processing te-more-count nil message te-toggle "More processing on" "More processing off" -1] 4))
  94.  
  95. (defun te-toggle-scrolling (arg) (interactive "p") (byte-code "ÁˆÂÃÄ\"ƒłÆ!‡" [arg nil message te-toggle terminal-scrolling "Scroll at end of page" "Wrap at end of page"] 4))
  96.  
  97. (defun te-enable-more-processing nil "\
  98. Enable ** MORE ** processing" (interactive) (byte-code "ÁˆÂÀ!‡" [t nil te-toggle-more-processing] 2))
  99.  
  100. (defun te-disable-more-processing nil "\
  101. Disable ** MORE ** processing" (interactive) (byte-code "ÀˆÁÀ!‡" [nil te-toggle-more-processing] 2))
  102.  
  103. (defun te-do-scrolling nil "\
  104. Scroll at end of page (yuck)" (interactive) (byte-code "ÁˆÂÀ!‡" [t nil te-toggle-scrolling] 2))
  105.  
  106. (defun te-do-wrapping nil "\
  107. Wrap to top of window at end of page" (interactive) (byte-code "ÀˆÁÀ!‡" [nil te-toggle-scrolling] 2))
  108.  
  109. (defun te-set-redisplay-interval (arg) "\
  110. Set the maximum interval (in output characters) between screen updates.
  111. Set this number to large value for greater throughput,
  112. set it smaller for more frequent updates (but overall slower performance." (interactive "NMax number of output chars between redisplay updates: ") (byte-code "ÈÄ]‰ˆʼn‡" [arg terminal-redisplay-interval te-redisplay-count nil 1 0] 2))
  113.  
  114. (put (quote te-more-break-unread) (quote suppress-keymap) t)
  115.  
  116. (defun te-more-break-unread nil (interactive) (byte-code "Ĉ    UƒÅÆ!‚#ÇÈÉ!Ê #ˆË‰ˆÌ ˆÄÍ )‡" [last-input-char terminal-escape-char te-more-count terminal-more-processing nil call-interactively te-escape message "Continuing from more break (\"%s\" typed, %d chars output pending...)" single-key-description te-pending-output-length 259259 te-more-break-unwind te-pass-through] 7))
  117.  
  118. (defun te-more-break-resume nil "\
  119. Proceed past the **MORE** break,
  120. allowing the next page of output to appear" (interactive) (byte-code "ÀˆÁÂ!ˆÃ ‡" [nil message "Continuing from more break" te-more-break-unwind] 3))
  121.  
  122. (defun te-more-break-help nil "\
  123. Provide help on commands available in a terminal-emulator **MORE** break" (interactive) (byte-code "ÀˆÁÂ!ˆÃÄ!ˆÅÆ!‡" [nil message "Terminal-emulator more break help..." sit-for 0 with-electric-help (lambda nil (byte-code "ÃÄ!ˆÃÅÆÇÈÁ#ÉÈ!#!ˆÃÊË!!ˆÃÌ!ˆÂ‡" [terminal-more-break-map t nil princ "Terminal-emulator more break.
  124.  
  125. " format "Type \"%s\" (te-more-break-resume)
  126. %s
  127. " where-is-internal te-more-break-resume documentation substitute-command-keys "\\{terminal-more-break-map}
  128. " "Any other key is passed through to the program
  129. running under the terminal emulator and disables more processing until
  130. all pending output has been dealt with."] 9))] 4))
  131.  
  132. (defun te-more-break-advance-one-line nil "\
  133. Allow one more line of text to be output before doing another more break." (interactive) (byte-code "ÁˆÂ‰ˆÃ ‡" [te-more-count nil 1 te-more-break-unwind] 2))
  134.  
  135. (defun te-more-break-flush-pending-output nil "\
  136. Discard any output which has been received by the terminal emulator but
  137. not yet proceesed and then proceed from the more break." (interactive) (byte-code "ÀˆÁ ˆÂ ‡" [nil te-more-break-unwind te-flush-pending-output] 3))
  138.  
  139. (defun te-flush-pending-output nil "\
  140. Discard any as-yet-unprocessed output which has been received by
  141. the terminal emulator." (interactive) (byte-code "ˆA?ƒÃÄ!‚*Å ÃÆ    \"ˆÇÈÉ    \"D‰ˆÊ ˆËÂ!ˆÌÇ!)‡" [te-pending-output length nil message "(There is no output pending)" te-pending-output-length "Flushing %d chars of pending output" 0 format "
  142. *** %d chars of pending output flushed ***
  143. " te-update-pending-output-display te-process-output sit-for] 8))
  144.  
  145. (defun te-pass-through nil "\
  146. Send the last character typed through the terminal-emulator
  147. without any interpretation" (interactive) (byte-code "Ĉ    =ƒÇÈ!‚'
  148. … A?…ÉÄ!ˆÊËÌ\"\"ˆÍÆ!‡" [last-input-char terminal-escape-char terminal-more-processing te-pending-output nil te-process t call-interactively te-escape te-set-more-count send-string make-string 1 te-process-output] 7))
  149.  
  150. (defun te-set-window-start nil (byte-code "Åp!… Æ!?†@    Ç`eZ
  151. T\"Yƒ$Èe\"‚@    Çd`Z
  152. T\"Yƒ?ÈÉdÊ    
  153. T\"Ë#\"‚@Ä*‡" [w h te-width t nil get-buffer-window window-height / set-window-start - * -1] 12))
  154.  
  155. (defun te-pending-output-length nil (byte-code "    @    A
  156. …
  157. @G\\
  158. A‰ˆ‚ˆ*‡" [length te-pending-output tem] 3))
  159.  
  160. (defun te-more-break nil (byte-code "ËÀ!ˆÌÁ!ˆ`‰ˆÌÂ!ˆÍ ‰ˆÎ !ˆÌÄ!ˆÏ!‰ˆÌÆ!ˆÐÑE‰ˆÒÓ\"ˆÔ ˆÕÖ !p=…H×Ø!ˆm†d    ?†dŠÙÚ!ˆÛ``
  161. \\\"ˆ    c)ˆÜÝ!ˆÞß!ˆàáÀ\"‡" [t te-more-old-point te-more-old-local-map terminal-more-break-map te-more-old-filter te-process te-more-old-mode-line-format mode-line-format mode-line-buffer-identification terminal-more-break-insertion te-width te-set-more-count make-local-variable current-local-map use-local-map process-filter "--   **MORE**  " "%-" set-process-filter (lambda (process string) (byte-code "ŠÃ!qˆÄ    
  162. C\"‰)ˆÅ ‡" [process te-pending-output string process-buffer nconc te-update-pending-output-display] 4)) te-update-pending-output-display window-buffer selected-window message "More break " forward-char 1 delete-region run-hooks terminal-more-break-hook sit-for 0 throw te-process-output] 20))
  163.  
  164. (defun te-more-break-unwind nil (byte-code "Ì!ˆÍ    
  165. \"ˆ bˆ‰ˆÎÏ !ˆÇm†6…6ÐÑ!ˆÒ``G\\\"ˆÓÔ    \"ˆ bˆÇ‰ˆÕ
  166. Ö ))ˆ×Ë!‡" [te-more-old-local-map te-process te-more-old-filter te-more-old-point mode-line-format te-more-old-mode-line-format buffer-read-only nil terminal-more-break-insertion te-width te-more-count t use-local-map set-process-filter set-buffer-modified-p buffer-modified-p forward-char 1 delete-region insert-char 32 259259 te-newline te-process-output] 10))
  167.  
  168. (defun te-set-more-count (newline) (byte-code "Æ`eZ    T\"
  169. …T‰ˆ Uƒ ‰‚R SUƒ* ‰‚RÆ Ç\"W†8 ZÈVƒC Z‰‚R ÈVƒNǂOÉZ‰)‡" [line te-width newline te-height te-more-count t / 2 10 1] 5))
  170.  
  171. (defun te-newline nil "\
  172. Move down a line, optionally do more processing, perhaps wrap/scroll,
  173. move to start of new line, clear to end of line." (byte-code "Å ˆ?†    S‰ÆWƒÇÂ!‚    Æ=…È ˆmƒ>Éee \\\"ˆebˆ …;ÊË!ˆdbˆÌc‚HÍË!ˆÉ`` \\\"ˆÎÏ \"ˆÐ ˆÑ ‡" [terminal-more-processing te-more-count t te-width terminal-scrolling end-of-line 0 te-set-more-count te-more-break delete-region delete-char 1 10 forward-char insert-char 32 beginning-of-line te-set-window-start] 11))
  174.  
  175. (defun te-down-vertically-or-scroll nil "\
  176. Move down a line vertically, or scroll at bottom." (byte-code "i ˆmƒ'Ãee    \\\"ˆebˆÄÅ!ˆdbˆÆcˆÇÈ    \"ˆÉ ‚*ÊÅ!ˆË!)ˆÌ ‡" [column te-width end-of-line delete-region delete-char 1 10 insert-char 32 beginning-of-line forward-line move-to-column te-set-window-start] 9))
  177.  
  178. (defun te-move-to-position nil (byte-code "Æ ÇZÆ ÇZ    
  179. V† VƒĂ$Èe    É
  180. T\"#b*ˆÊ‰‡" [y x te-width te-height nil te-more-count te-get-char 32 + * -1] 8))
  181.  
  182. (defun te-clear-rest-of-line nil (byte-code "Š`Á ˆ`ZÂ``\\\"ˆÃÄ[\"))‡" [n end-of-line delete-region insert-char 32] 5))
  183.  
  184. (defun te-clear-rest-of-screen nil (byte-code "ŠÁ ˆÂ ˆm?…\"ÃÄ!ˆÂ ˆÅ`Z`\"ˆÆÇ\"ˆ‚)‡" [te-width te-clear-rest-of-line end-of-line forward-char 1 delete-region insert-char 32] 9))
  185.  
  186. (defun te-clear-screen nil (byte-code "Ä ˆÅ    W…T‰ˆÆÇ
  187. \"ˆÈcˆ‚)ˆÉdSd\"ˆebˆÊ‰‡" [i te-height te-width te-more-count erase-buffer 0 insert-char 32 10 delete-region -1] 5))
  188.  
  189. (defun te-insert-lines nil (byte-code "n?ƒ    À‚QŠÇ
  190. È`eZ T\"É#Ê ËZ    ^ÌÍdÎ T\"Zd\"ˆ`d=…2Ïcˆ W…OT‰ˆÐË \"ˆ    =†KÏcˆ‚3+)ˆÉ‰‡" [nil line te-height te-width n i te-more-count - / -1 te-get-char 32 0 delete-region * 10 insert-char] 9))
  191.  
  192. (defun te-delete-lines nil (byte-code "n?ƒ    À‚MÇ
  193. È`eZ T\"É#Ê ËZ    ^ÌÍ``Î T\"\\d^\"ˆŠdbˆ W…KT‰ˆÏË \"ˆ    =†GÐcˆ‚/)+ˆÉ‰‡" [nil line te-height te-width n i te-more-count - / -1 te-get-char 32 0 delete-region * insert-char 10] 9))
  194.  
  195. (defun te-beginning-of-line nil (byte-code "À ‡" [beginning-of-line] 2))
  196.  
  197. (defun te-backward-char nil (byte-code "n?…ÀÁ!‡" [backward-char 1] 2))
  198.  
  199. (defun te-forward-char nil (byte-code "l?…ÀÁ!‡" [forward-char 1] 2))
  200.  
  201. (defun te-delete nil (byte-code "nƒÀ‚Á`S`\"ˆÂcˆÃÄ!‡" [nil delete-region 32 forward-char -1] 3))
  202.  
  203. (defun te-beep nil (byte-code "À ‡" [beep] 2))
  204.  
  205. (defun te-insert-spaces nil (byte-code "`àÄZÅ ˆ`Z^    ÆXƒ‚$Ç    [!ˆbˆÈÄ    \"ˆb*‡" [p n nil te-get-char 32 end-of-line 0 delete-char insert-char] 6))
  206.  
  207. (defun te-delete-char nil (byte-code "`àÄZÅ ˆ`Z^    ÆXƒ‚#ÇÄ    \"ˆbˆÈ    !ˆb*‡" [p n nil te-get-char 32 end-of-line 0 insert-char delete-char] 5))
  208.  
  209. (defun te-losing-unix nil (byte-code "À‡" [nil] 1))
  210.  
  211. (defun te-output-tab nil (byte-code "`àˆ`ZÄÅ    Æ\"ZÇ ˆ`Z^
  212. \\b+‡" [p x l beginning-of-line 8 logand 7 end-of-line] 6))
  213.  
  214. (defun te-filter (process string) (byte-code "p
  215. ÉŽÊ !qˆ bˆË!…/Ì!?ƒ!Ɖ‚/qˆdbˆcˆÊ !qˆÍC\"‰ˆÎ ˆ    ÏpÐÑ !=!)ˆÊ !qˆ`‰)*‡" [obuf m meta-flag process te-saved-point te-log-buffer nil string te-pending-output ((byte-code "q‡" [obuf] 1)) process-buffer bufferp buffer-name nconc te-update-pending-output-display te-process-output window-buffer selected-window] 12))
  216.  
  217. (defun te-process-output (preemptable) (byte-code "Á‰ˆÄōˆÆ 
  218. Ç !‰=?…(È !p=…$É `\"ˆ‚*‡" [preemptable t s w te-process-output (byte-code "ÁÁÁÁÁÁA…P
  219. @A@
  220. H‰ˆ T‰
  221. G=ƒDËAABËA@‰ˆÌ ‚IÍ \"ˆÎV…SÏWƒlƒ| Ë=ƒpËÐÑ\"ABB‰‚vÍ S\"ˆÒ ‚
  222. ?ƒŽÓÑ!ˆcˆÔÑ!‚
  223. =…–†¦ÕÖ
  224. #‰†¦
  225. G    ÓÑ!ˆcˆ`‰ˆ× ˆ     `Z\\^‰    ˆbˆ    =…ÑÁ‰ˆØ``     Z\\\"ˆ Ë=…ç    
  226. G=Ĕ
  227. ‚ó
  228.     Ocˆ    
  229. G=ƒ    ËAAB‰‚Í    \"ˆÔ     ZT!)‚=ÙÚ=ƒ/ÛÜ Ý\"A†,ނ8Ûß\"A†8Þ!ˆÔÑ!ˆ
  230. …LࠅLáâÈ\"ˆ‚.‡" [buffer-read-only nil string ostring start char matchpos te-pending-output t end preemptable 0 te-update-pending-output-display setcar 31 255 make-string 1 te-newline delete-char te-redisplay-if-necessary string-match "[--ÿ]" end-of-line delete-region funcall 16 assq te-get-char ((61 . te-move-to-position) (99 . te-clear-rest-of-line) (67 . te-clear-rest-of-screen) (15 . te-insert-lines) (11 . te-delete-lines) (1 . te-beginning-of-line) (2 . te-backward-char) (100 . te-delete-char) (95 . te-insert-spaces) (6 . te-forward-char) (7 . te-beep) (10 . te-down-vertically-or-scroll) (12 . te-clear-screen)) te-losing-unix ((10 . te-newline) (127 . te-delete) (13 . te-beginning-of-line) (7 . te-beep) (8 . te-backward-char) (9 . te-output-tab)) input-pending-p throw te-process-output] 23) selected-window next-window window-buffer set-window-point] 7))
  231.  
  232. (defun te-get-char nil (byte-code "Aƒ,@A@
  233.     H    T‰
  234. G=ƒ#ÃAAB‰‚'Ä    \"ˆ*‚/Åƍ‡" [te-pending-output start string 0 setcar char (byte-code "    !ÎĠ   Å\"ˆÆ    !))‡" [filter te-process process-filter ((byte-code "    \"‡" [te-process filter set-process-filter] 3)) set-process-filter (lambda (p s) (byte-code "GÂ=† ÂD‰ˆÃÄÅH\"‡" [s te-pending-output 1 throw char 0] 4)) accept-process-output] 4)] 4))
  235.  
  236. (defun te-redisplay-if-necessary (length) (byte-code "    Z‰ÃX…\"pÄÅ !=…\"Æ …\"Ç ˆÈÃ!ˆ
  237. ‰‡" [te-redisplay-count length terminal-redisplay-interval 0 window-buffer selected-window waiting-for-user-input-p te-update-pending-output-display sit-for] 7))
  238.  
  239. (defun te-update-pending-output-display nil (byte-code "A?ƒ É‚'Ä 
  240. ÅWƒÃ‰‚&ÆÇÈ
  241. É\\Ê\"\"‰)ˆËÌ !‡" [te-pending-output te-pending-output-info length "" te-pending-output-length 1500 format "(%dK chars output pending) " / 512 1024 set-buffer-modified-p buffer-modified-p] 6))
  242.  
  243. (defun te-sentinel (process message) (byte-code "Æ!Ç=†DÈÉ!!?†DpŠÉ!qˆÄ‰ˆÊ ˆdbˆË ˆÌ ˆÍÎÏ#)ˆ
  244. É!=…:Р…CdbˆÑÒ!)‡" [process t b buffer-read-only nil message process-status run buffer-name process-buffer fundamental-mode delete-blank-lines delete-horizontal-space insert "
  245. *******
  246. " "*******
  247. " waiting-for-user-input-p recenter -1] 12))
  248.  
  249. (defvar te-stty-string "stty -nl new dec echo" "\
  250. Command string (to be interpreted by \"sh\") which sets the modes
  251. of the virtual terminal to be appropriate for interactive use.")
  252.  
  253. (defvar explicit-shell-file-name nil "\
  254. *If non-nil, is file name to use for explicitly requested inferior shell.")
  255.  
  256. (defun terminal-emulator (buffer program args &optional width height) "\
  257. Under a display-terminal emulator in BUFFER, run PROGRAM on arguments ARGS.
  258. ARGS is a list of argument-strings.  Remaining arguments are WIDTH and HEIGHT.
  259. BUFFER's contents are made an image of the display generated by that program,
  260. and any input typed when BUFFER is the current Emacs buffer is sent to that
  261. program an keyboard input.
  262.  
  263. Interactively, BUFFER defaults to \"*terminal*\" and PROGRAM and ARGS
  264. are parsed from an input-string using your usual shell.
  265. WIDTH and HEIGHT are determined from the size of the current window
  266. -- WIDTH will be one less than the window's width, HEIGHT will be its height.
  267.  
  268. To switch buffers and leave the emulator, or to give commands
  269. to the emulator itself (as opposed to the program running under it),
  270. type Control-^.  The following character is an emulator command.
  271. Type Control-^ twice to send it to the subprogram.
  272. This escape character may be changed using the variable `terminal-escape-char'.
  273.  
  274. `Meta' characters may not currently be sent through the terminal emulator.
  275.  
  276. Here is a list of some of the variables which control the behaviour
  277. of the emulator -- see their documentation for more information:
  278. terminal-escape-char, terminal-scrolling, terminal-more-processing,
  279. terminal-redisplay-interval.
  280.  
  281. This function calls the value of terminal-mode-hook if that exists
  282. and is non-nil after the terminal buffer has been set up and the
  283. subprocess started.
  284.  
  285. Presently with `termcap' only; if somebody sends us code to make this
  286. work with `terminfo' we will try to use it." (interactive (byte-code "ŠÄÅ!qˆÆÇÀ!?†?†È!É=?ƒ p‚#ÊÅ!!)Ë
  287. †7ÌÍ!†7ÌÎ!†7ÏÐÑÒ    \"!Ó Ô\"ƒL    ÕD‚OÖ !*!B‡" [te-process default-s explicit-shell-file-name s get-buffer-create "*terminal*" buffer-name boundp process-status run generate-new-buffer append getenv "ESHELL" "SHELL" "/bin/sh" read-string format "Run program in emulator: (default %s) " equal "" nil te-parse-program-and-args] 14)) (byte-code "ËˆÒ !ˆ?…ÓÔ !ÕZ‰ˆ?…#ÖÔ !ÕZ‰ˆ× ˆ‰ˆØÙ#ÚD‰    ˆË
  288. Û )ˆË Üp!‰ …nÝØÞß !\"!ƒcà !‚jáâß !\"ˆ‚G)ˆãä又æç!…‚èé!ˆêÕ!ˆèëì!íìîïÏ#ð##ˆÏ‰ˆñ!ˆòó!‡" [te-process default-s explicit-shell-file-name s buffer width height te-width te-height mode-line-buffer-identification buffer-read-only nil process terminal-escape-char terminal-escape-map t inhibit-quit terminal-map switch-to-buffer window-width selected-window 1 window-height terminal-mode format "Emacs terminal %dx%d: %%b  " te-pending-output-info te-clear-screen get-buffer-process y-or-n-p "Kill process %s? " process-name delete-process error "Process %s not killed" err (byte-code "ÉÊË    
  289. ƒÌ‚Í$ÎÏÐÑÒÓ&ÔÕ!ƒ:ÕÖ×ØÙÚÛpÜÝÞßàBáBD&‰‚dâÖpãäÊåæçP!æèP!éæBê#%%‰ˆë Ú\"ˆì Ý\")‡" [termcap te-width te-height terminal-scrolling te-process program args te-stty-string exec-directory concat format "emacs-virtual:co#%d:li#%d:%s" "" "ns:" "cm=^p=%+ %+ :cr=^p^a:le=^p^b:nd=^p^f:" "nw=^j:ce=^pc:cd=^pC:cl=^p^l:bl=^p^g:" "IC=^p_%+ :DC=^pd%+ :AL=^p^o%+ :DL=^p^k%+ :" "LP:NF:" "ic=^p_!:dc=^pd!:al=^p^o!:dl=^p^k!:ho=^p=  :" "im=:ei=:dm=:ed=:mi:do=^p^j:nl=^p^j:bs:" fboundp start-subprocess "terminal-emulator" channel-type terminal filter te-filter buffer sentinel te-sentinel modify-environment "TERM" "emacs-virtual" "TERMCAP" start-process "/bin/sh" "-c" "%s; exec %s TERM=emacs-virtual %s %s" te-quote-arg-for-sh "env" "TERMCAP=" mapconcat " " set-process-filter set-process-sentinel] 20) ((error (byte-code "Á ˆÂ@A\"‡" [err fundamental-mode signal] 4))) default-value meta-flag message "Note:  Meta key disabled due to maybe-eventually-reparable braindamage" sit-for "Entering emacs terminal-emulator...  Type %s %s for help" single-key-description mapconcat where-is-internal te-escape-help " " use-local-map run-hooks terminal-mode-hook] 28))
  290.  
  291. (defun te-parse-program-and-args (s) (byte-code "ÆÇ\"ƒQÂÈ …AÆÉ #ƒ1 ÊË!OÊÈ!‰ˆ G=…-‰ˆ‚9 ÂO‰ˆ    B‰ˆ‚ ˆÌ    !‰ˆ    @    AD*‚lÆÍ\"…\\Î!?ƒi ÏÐPDD‚lÂD‡" [s l nil p shell-file-name t string-match "\\`\\([a-zA-Z0-9-+=_.@/:]+[     ]*\\)+\\'" 0 "\\([a-zA-Z0-9-+=_.@/:]+\\)\\([     ]+\\)*" match-end 1 nreverse "[     ]" file-exists-p "-c" "exec "] 11))
  292.  
  293. (put (quote terminal-mode) (quote mode-class) (quote special))
  294.  
  295. (defun terminal-mode nil "\
  296. Set up variables for use f the terminal-emualtor.
  297. One should not call this -- it is an internal function
  298. of the terminal-emulator" (byte-code "Ò ˆÓp!ˆÔ‰ˆÕ‰ˆÖ‰ˆÄ‰ˆÄ‰ˆ×Æ!ˆØÆ!‰ˆ×Ç!ˆØÇ!‰ˆ×È!ˆØÈ!‰ˆ×É!ˆØÉ!‰    ˆ×Ù!ˆ×Ú!ˆ×Û!ˆ×Ê!ˆÜC‰
  299. ˆ×Ë!ˆe‰ ˆ×Ì!ˆÝ‰ ˆ×Þ!ˆ×Í!ˆÎ‰ˆ×Ï!ˆß‰ˆ×Ð!ˆ    ‰ˆ×Ñ!ˆÎ‰‡" [major-mode mode-name mode-line-process buffer-read-only t truncate-lines terminal-escape-char terminal-scrolling terminal-more-processing terminal-redisplay-interval te-pending-output te-saved-point te-pending-output-info te-log-buffer nil te-more-count te-redisplay-count meta-flag kill-all-local-variables buffer-flush-undo terminal-mode "terminal" (": %s") make-local-variable default-value te-width te-height te-process 0 "" inhibit-quit -1] 23))
  300.  
  301. (defun te-quote-arg-for-sh (fuckme) (byte-code "ÆÇ\"ƒ ‚`ÆÈ\"?ƒÉ!‚`ÊËË GYƒ*łBÆÌ #‰ƒ8Á‚B
  302. ÅOP‰ˆÅ…Z
  303. OÍ TOR T‰ˆ‚ˆÎ
  304. ÎQ+‡" [fuckme t harder cretin stupid nil string-match "\\`[a-zA-Z0-9-+=_.@/:]+\\'" "[$]" prin1-to-string "" 0 "[\"\\$]" "\\" "\""] 11))
  305.