;ELC ;;; compiled by kwzh@hal.gnu.ai.mit.edu on Fri May 6 22:19:08 1994 ;;; from file /gd/gnu/emacs/19.0/lisp/terminal.el ;;; emacs version 19.22.93.1. ;;; bytecomp version FSF 2.10 ;;; optimization is on. ;;; this file uses opcodes which do not exist in Emacs 18. (if (and (boundp 'emacs-version) (or (and (boundp 'epoch::version) epoch::version) (string-lessp emacs-version "19"))) (error "`/gd/gnu/emacs/19.0/lisp/terminal.el' was compiled for Emacs 19")) (require (quote ehelp)) (defvar terminal-escape-char 30 "\ *All characters except for this are passed verbatim through the terminal-emulator. This character acts as a prefix for commands to the emulator program itself. Type this character twice to send it through the emulator. Type ? after typing it for a list of possible commands. This variable is local to each terminal-emulator buffer.") (defvar terminal-scrolling t "\ *If non-nil, the terminal-emulator will losingly `scroll' when output occurs past the bottom of the screen. If nil, output will win and `wrap' to the top of the screen. This variable is local to each terminal-emulator buffer.") (defvar terminal-more-processing t "\ *If non-nil, do more-processing. This variable is local to each terminal-emulator buffer.") (defvar terminal-redisplay-interval 5000 "\ *Maximum number of characters which will be processed by the terminal-emulator before a screen redisplay is forced. Set this to a large value for greater throughput, set it smaller for more frequent updates but overall slower performance.") (byte-code "!! # #)!,\n\nH # #\n)!Q  #HX#HTId)#########(!# )!)))!++& #(!#####+)!/4!85!A6!J7!S8!\\9!e:!n;!w!?@AB\"" [boundp terminal-more-break-insertion "*** More break -- Press space to continue ***" terminal-meta-map nil make-sparse-keymap map define-key [t] te-pass-through terminal-map [t] "" terminal-escape-map [t] undefined "0" s 0 57 digit-argument "b" switch-to-buffer "o" other-window "e" te-set-escape-char "\f" redraw-display "" te-flush-pending-output "m" te-toggle-more-processing "x" te-escape-extended-command "w" te-edit "?" te-escape-help char-to-string help-char te-escape-command-alist (("Set Escape Character" . te-set-escape-char) ("Edit" . te-edit) ("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)) terminal-more-break-map [t] te-more-break-unread te-more-break-help " " te-more-break-resume te-more-break-flush-pending-output " " te-more-break-advance-one-line te-process te-log-buffer te-height te-width te-more-count te-redisplay-count te-pending-output te-more-old-point te-more-old-local-map te-more-old-filter te-more-old-mode-line-format te-pending-output-info defalias te-escape #[nil " Ǝ!! $ !\"%!)! \"C )P \"P !+" [nil current-local-map current-global-map global local s ((byte-code " ! !" [use-global-map global use-local-map local] 2)) use-global-map terminal-escape-map use-local-map read-key-sequence prefix-arg format "Emacs Terminal escape> %d " prefix-numeric-value "Emacs Terminal escape> " message "" make-string 1 terminal-escape-char last-command-char -259 te-pass-through lookup-key call-interactively] 5 nil nil]] 4) (defalias 'te-escape-help #[nil "! !!)" [message "Terminal emulator escape help..." single-key-description terminal-escape-char char with-electric-help #[nil " %!!! ##!!-!\"4!\"x@A!D\"V؉O!@@!!!!)A:)݇" [princ format "Terminal-emulator escape, invoked by \"%s\"\nType \"%s\" twice to send a single \"%s\" through.\n\nOther chars following \"%s\" are interpreted as follows:\n" char substitute-command-keys "\\{terminal-escape-map}\n" "\nSubcommands of \"%s\" (%s)\n" where-is-internal te-escape-extended-command terminal-escape-map t fboundp sortcar copy-sequence te-escape-command-alist string< sort #[(a b) "@ @" [a b] 2] l documentation "Not documented" doc string-match "\n" 0 " \"" "\":\n " write-char 10 nil] 8]] 2 "\ Provide help on commands available after terminal-escape-char is typed." nil]) (byte-code "\"\"" [defalias te-escape-extended-command #[nil "\f$)ȍ)" [t completion-ignore-case completing-read "terminal command: " te-escape-command-alist nil c foo (byte-code " \n&\n@@\n@A!\"\nA )" [c te-escape-command-alist l throw foo call-interactively nil] 5)] 6 nil nil] te-escape-extended-command-unread #[nil " ! " [listify-key-sequence this-command-keys unread-command-events te-escape-extended-command] 2 nil nil]] 3) (defalias 'te-set-escape-char #[(c) " U Ă ! !# )" [terminal-escape-char o message c "\"%s\" is the escape char" "\"%s\" is now the escape; \"%s\" passes through" single-key-description] 5 "\ Change the terminal-emulator escape character." "cSet escape character to: "]) (defalias 'te-stuff-string #[(string) " \n\"" [process-send-string te-process string] 3 "\ Read a string to send to through the terminal emulator as though that string had been typed on the keyboard. Very poor man's file transfer protocol." "sStuff string: "]) (defalias 'te-set-output-log #[(name) "\n!!'!q p! )! !\"" [name "" nil te-log-buffer message "Output logging off." get-buffer get-buffer-create fundamental-mode buffer-disable-undo erase-buffer "Recording terminal emulator output into buffer \"%s\"" buffer-name] 4 "\ Record output from the terminal emulator in a buffer." (list (if te-log-buffer nil (read-buffer "Record output in buffer: " (format "%s output-log" (buffer-name (current-buffer))) nil)))]) (defalias 'te-tofu #[nil "!" [te-set-output-log nil] 2 "\ Discontinue output log." nil]) (byte-code "\"\"\"" [defalias te-toggle #[(sym arg) " \n ! UJ?! W Ă!L" [sym arg 1 0 nil t] 3] te-toggle-more-processing #[(arg) " \"\fĂ !\nƉ" [message te-toggle terminal-more-processing arg "More processing on" "More processing off" -1 te-more-count] 4 nil "p"] te-toggle-scrolling #[(arg) " \"\fĂ !" [message te-toggle terminal-scrolling arg "Scroll at end of page" "Wrap at end of page"] 4 nil "p"]] 3) (defalias 'te-enable-more-processing #[nil "!" [te-toggle-more-processing t] 2 "\ Enable ** MORE ** processing" nil]) (defalias 'te-disable-more-processing #[nil "!" [te-toggle-more-processing nil] 2 "\ Disable ** MORE ** processing" nil]) (defalias 'te-do-scrolling #[nil "!" [te-toggle-scrolling t] 2 "\ Scroll at end of page (yuck)" nil]) (defalias 'te-do-wrapping #[nil "!" [te-toggle-scrolling nil] 2 "\ Wrap to top of window at end of page" nil]) (defalias 'te-set-redisplay-interval #[(arg) "]É" [arg 1 terminal-redisplay-interval 0 te-redisplay-count] 3 "\ Set the maximum interval (in output characters) between screen updates. Set this number to large value for greater throughput, set it smaller for more frequent updates (but overall slower performance." "NMax number of output chars between redisplay updates: "]) (byte-code "#\"" [put te-more-break-unread suppress-keymap t defalias #[nil " =\n!! # \f )" [last-input-char terminal-escape-char 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-count te-more-break-unwind nil terminal-more-processing te-pass-through] 4 nil nil]] 4) (defalias 'te-more-break-resume #[nil "! " [message "Continuing from more break" te-more-break-unwind] 2 "\ Proceed past the **MORE** break, allowing the next page of output to appear" nil]) (defalias 'te-more-break-help #[nil "!!!" [message "Terminal-emulator more break help..." sit-for 0 with-electric-help #[nil "!#!#!!!!̇" [princ "Terminal-emulator more break.\n\n" format "Type \"%s\" (te-more-break-resume)\n%s\n" where-is-internal te-more-break-resume terminal-more-break-map t documentation substitute-command-keys "\\{terminal-more-break-map}\n" "Any other key is passed through to the program\nrunning under the terminal emulator and disables more processing until\nall pending output has been dealt with." nil] 7]] 2 "\ Provide help on commands available in a terminal-emulator **MORE** break" nil]) (defalias 'te-more-break-advance-one-line #[nil " " [1 te-more-count te-more-break-unwind] 1 "\ Allow one more line of text to be output before doing another more break." nil]) (defalias 'te-more-break-flush-pending-output #[nil " " [te-more-break-unwind te-flush-pending-output] 1 "\ Discard any output which has been received by the terminal emulator but not yet processed and then proceed from the more break." nil]) (defalias 'te-flush-pending-output #[nil "A ! \f\"\f\"D !!)" [te-pending-output message "(There is no output pending)" te-pending-output-length length "Flushing %d chars of pending output" 0 format "\n*** %d chars of pending output flushed ***\n" te-update-pending-output-display te-process-output nil sit-for] 4 "\ Discard any as-yet-unprocessed output which has been received by the terminal emulator." nil]) (defalias 'te-pass-through #[nil " =\n!9NN1\"\"U1\"\\R\fE AE!\"\"!!\"" [last-input-char terminal-escape-char call-interactively te-escape ascii-character logand lsh 1 23 0 127 128 terminal-more-processing te-pending-output te-set-more-count nil send-string te-process make-string te-process-output t message "Function key `%s' ignored" single-key-description] 5 "\ Character is passed to the program running under the terminal emulator. One characters is treated specially: the terminal escape character (normally C-^) lets you type a terminal emulator command." nil]) (byte-code "\"\"!# ##" [defalias te-set-window-start #[nil "p! ! ?= `eZ\fTY# e\"= d`Z\fTY< d \fT_ZZ\"=*" [get-buffer-window w window-height h te-width set-window-start -1 nil] 6] te-pending-output-length #[nil "@A \n @G\\ A\n\n*" [te-pending-output tem length] 3] boundp terminal-edit-map nil make-sparse-keymap define-key "" terminal-cease-edit put terminal-edit-mode mode-class special] 4) (defalias 'terminal-edit-mode #[nil " !! !" [use-local-map terminal-edit-map terminal-edit-mode major-mode "Terminal Edit" mode-name default-value mode-line-modified nil mode-line-process run-hooks terminal-edit-mode-hook] 2 "\ Major mode for editing the contents of a terminal-emulator buffer. The editing commands are the same as in Fundamental mode, together with a command \\to return to terminal emulation: \\[terminal-cease-edit]."]) (defalias 'te-edit #[nil " !!=!!!" [terminal-edit-mode set-buffer-modified-p buffer-modified-p key-binding "" terminal-cease-edit message "Editing: Type C-c C-c to return to Terminal" substitute-command-keys "Editing: Type \\[terminal-cease-edit] to return to Terminal"] 3 "\ Start editing the terminal emulator buffer with ordinary Emacs commands." nil]) (defalias 'terminal-cease-edit #[nil "~ \fSeb Y`  \\#:u` ZZ\"uqmL` ZZ\"qgUXuq` #l `S|q d|) Um`d|mc Sb`,!!މ" [nil buffer-read-only point-marker te-width te-height h width opoint 0 p search-forward "\n" move -1 insert-char 32 1 10 t te-saved-point te-redisplay-count te-more-count default-value mode-line-modified use-local-map terminal-map terminal-mode major-mode "terminal" mode-name (":%s") mode-line-process] 6 "\ Finish editing message; switch back to Terminal proper." nil]) (byte-code "\"\"\"" [defalias te-more-break #[nil "!!`! !!\n!!\f E\f\n\" !p=E!m^^u``\\|c)!!\"" [te-set-more-count t make-local-variable te-more-old-point te-more-old-local-map current-local-map use-local-map terminal-more-break-map te-more-old-filter process-filter te-process te-more-old-mode-line-format mode-line-format "-- **MORE** " mode-line-buffer-identification "%-" set-process-filter #[(process string) " !q\n C) " [process-buffer process te-pending-output string te-update-pending-output-display] 2] te-update-pending-output-display window-buffer selected-window message "More break " terminal-more-break-insertion 1 te-width run-hooks terminal-more-break-hook sit-for 0 throw te-process-output] 3] te-more-break-unwind #[nil " ! \f\" b ! m5\f5u``\fG\\|\" b *!" [use-local-map te-more-old-local-map set-process-filter te-process te-more-old-filter te-more-old-point te-more-old-mode-line-format mode-line-format set-buffer-modified-p buffer-modified-p nil buffer-read-only terminal-more-break-insertion 1 insert-char 32 te-width 259259 te-more-count te-newline te-process-output t] 3] te-set-more-count #[(newline) "`eZT\n T U N SU' N ťW7 ZV? ZN VJłKZ)" [te-width line newline te-height te-more-count 2 10 1] 3]] 3) (defalias 'te-newline #[nil " \nSW! \n= m@ee\\|ebJ!dbcJu``\\|\"y " [nil terminal-more-processing te-more-count 0 te-set-more-count t te-more-break te-width terminal-scrolling delete-char 1 10 insert-char 32 te-set-window-start] 3 "\ Move down a line, optionally do more processing, perhaps wrap/scroll, move to start of new line, clear to end of line."]) (byte-code "\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"" [defalias te-move-to-position #[nil " Z Z\n\fV V e\n \fT_\\\\b*Ɖ" [te-get-char 32 x y te-width te-height -1 te-more-count] 4] te-clear-rest-of-line #[nil "``Z`` \\| [\"*" [nil n insert-char 32] 3] te-clear-rest-of-screen #[nil " m? u` Z`| \")" [te-clear-rest-of-line nil 1 te-width insert-char 32] 3] te-clear-screen #[nil " \n W\nT\"c)dSd|ebȉ " [erase-buffer 0 i te-height insert-char 32 te-width 10 -1 te-more-count] 3] te-insert-lines #[nil "nN`eZ TZZ Z ^d T_Zd|`d=.cWMT \" =.c.,‰ " [te-height te-width -1 line te-get-char 32 n 0 i 10 insert-char te-more-count] 3] te-delete-lines #[nil "nJ`eZ TZZ Z ^`` T_\\d^|dbWIT \" =*c*,‰ " [te-height te-width -1 line te-get-char 32 n 0 i insert-char 10 te-more-count] 4] te-beginning-of-line #[nil "y" [0 nil] 1] te-backward-char #[nil "n?!" [backward-char 1] 2] te-forward-char #[nil "l?u" [1] 1] te-delete #[nil "n?`S`|cu" [32 -1] 2] te-beep #[nil " " [beep] 1] te-insert-spaces #[nil "` Z`Z^X!\f[!b\f\"b*" [p te-get-char 32 nil n 0 delete-char insert-char] 4] te-delete-char #[nil "` Z`Z^X \f\"b\f!b*" [p te-get-char 32 nil n 0 insert-char delete-char] 4] te-losing-unix (lambda nil) te-output-tab #[nil "`y`Z\n\"Z`Z^\\b+" [p 0 x 8 logand 7 nil l] 5]] 3) (defalias 'te-down-vertically-or-scroll #[nil "im'ee\n\\|eb!dbc\n\"y*y!) " [column nil te-width delete-char 1 10 insert-char 32 0 move-to-column te-set-window-start] 3 "\ Move down a line vertically, or scroll at bottom."]) (byte-code "\"\"\"\"\"\"" [defalias te-filter #[(process string) "p !q\fb!1! 1qdb\n! !q \nC p !=! !q`*" [obuf ((set-buffer obuf)) process-buffer process te-saved-point bufferp te-log-buffer buffer-name nil insert-before-markers string te-pending-output te-update-pending-output-display te-process-output window-buffer selected-window] 4] te-process-output #[(preemptable) "Í  !=?+!p=\f`\"\f*" [t preemptable te-process-output (byte-code "A< @A@ H T G=AAABA@ F \nV\n\nW\nlw =k\n\"ABBq S * !\nc!*\f = # G!\nc` `\nZ\\^\nb =`` Z\\| = G= Oc G=AAB ZT!)*\n= ֞A$ׂ$\n؞A$ ! \" ." [nil matchpos char start ostring string buffer-read-only te-pending-output 0 te-update-pending-output-display 31 255 make-string 1 te-newline delete-char te-redisplay-if-necessary string-match "[--]" end 16 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)) preemptable input-pending-p throw te-process-output t] 7) selected-window s w next-window window-buffer set-window-point] 4] te-get-char #[nil "A(@A@ \nH\nT G=\"AAB&\n*ō" [te-pending-output string start 0 char (byte-code " !Î \" !*" [process-filter te-process filter ((set-process-filter te-process filter)) set-process-filter #[(p s) "G= DH\"" [s 1 te-pending-output throw char 0] 4] accept-process-output] 3)] 3] te-redisplay-if-necessary #[(length) " ZX#p !=# # !" [te-redisplay-count length 0 window-buffer selected-window waiting-for-user-input-p te-update-pending-output-display sit-for terminal-redisplay-interval] 3] te-update-pending-output-display #[nil "A\n\" W!\f\\ɥ\") !" [te-pending-output "" te-pending-output-info te-pending-output-length length 1500 format "(%dK chars output pending) " 512 1024 set-buffer-modified-p buffer-modified-p] 5] te-sentinel #[(process message) " !=D !!?Dp !q db \fͱ) !=C Cdb!)" [process-status process run buffer-name process-buffer b nil buffer-read-only fundamental-mode delete-blank-lines delete-horizontal-space "\n*******\n" message "*******\n" waiting-for-user-input-p recenter -1] 3]] 3) (defvar te-stty-string "stty -nl erase '^?' kill '^u' intr '^c' echo pass8" "\ Shell command to set terminal modes for terminal emulator.") (defvar explicit-shell-file-name nil "\ *If non-nil, is file name to use for explicitly requested inferior shell.") (defalias 'terminal-emulator #[(buffer program args &optional width height) " !\n !Z !Z \n \n \n#D )p!c!\"!X!;!\";)܏ !!&!*###" [switch-to-buffer buffer width window-width selected-window 1 height window-height terminal-mode te-width te-height format "Emacs terminal %dx%d: %%b " te-pending-output-info mode-line-buffer-identification nil buffer-read-only te-clear-screen process get-buffer-process y-or-n-p "Kill process %s? " process-name delete-process error "Process %s not killed" err (byte-code "\n \f\fł $̰  PBBpB##%)\"\")" [format "emacs-virtual:co#%d:li#%d:%s" te-width te-height terminal-scrolling "" "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:" termcap "TERM=emacs-virtual" "TERMCAP=" process-environment start-process "terminal-emulator" "/bin/sh" "-c" "%s; exec %s" te-stty-string mapconcat te-quote-arg-for-sh program args " " te-process set-process-filter te-filter set-process-sentinel te-sentinel] 12) ((error (byte-code " \n@\nA\"" [fundamental-mode signal err] 3))) t inhibit-quit use-local-map terminal-map run-hooks terminal-mode-hook message "Entering emacs terminal-emulator... Type %s %s for help" single-key-description terminal-escape-char mapconcat where-is-internal te-escape-help terminal-escape-map " "] 9 "\ Under a display-terminal emulator in BUFFER, run PROGRAM on arguments ARGS. ARGS is a list of argument-strings. Remaining arguments are WIDTH and HEIGHT. BUFFER's contents are made an image of the display generated by that program, and any input typed when BUFFER is the current Emacs buffer is sent to that program an keyboard input. Interactively, BUFFER defaults to \"*terminal*\" and PROGRAM and ARGS are parsed from an input-string using your usual shell. WIDTH and HEIGHT are determined from the size of the current window -- WIDTH will be one less than the window's width, HEIGHT will be its height. To switch buffers and leave the emulator, or to give commands to the emulator itself (as opposed to the program running under it), type Control-^. The following character is an emulator command. Type Control-^ twice to send it to the subprogram. This escape character may be changed using the variable `terminal-escape-char'. `Meta' characters may not currently be sent through the terminal emulator. Here is a list of some of the variables which control the behaviour of the emulator -- see their documentation for more information: terminal-escape-char, terminal-scrolling, terminal-more-processing, terminal-redisplay-interval. This function calls the value of terminal-mode-hook if that exists and is non-nil after the terminal buffer has been set up and the subprocess started. Presently with `termcap' only; if somebody sends us code to make this work with `terminfo' we will try to use it." (byte-code "!q!\f\f!=p !!) 5!5!5\"!ӚMDQ!*!B" [get-buffer-create "*terminal*" buffer-name boundp te-process process-status run generate-new-buffer append explicit-shell-file-name getenv "ESHELL" "SHELL" "/bin/sh" default-s read-string format "Run program in emulator: (default %s) " s "" nil te-parse-program-and-args] 7)]) (byte-code "\"#" [defalias te-parse-program-and-args #[(s) "\n\"G :\n #,\n ȕOĕ\nG=22\n OB\f@A*D\n\"]\n!] \nPDD\nD" [string-match "\\`\\([-a-zA-Z0-9+=_.@/:]+[ ]*\\)+\\'" s nil 0 p l "\\([-a-zA-Z0-9+=_.@/:]+\\)\\([ ]+\\)*" 1 "[ ]" file-exists-p shell-file-name "-c" "exec "] 5] put terminal-mode mode-class special] 4) (defalias 'terminal-mode #[nil " p! \n!!\f!!!!!!!!!!C!e!!!!!" [kill-all-local-variables buffer-disable-undo terminal-mode major-mode "terminal" mode-name (":%s") mode-line-process t buffer-read-only truncate-lines make-local-variable terminal-escape-char default-value terminal-scrolling terminal-more-processing terminal-redisplay-interval te-width te-height te-process te-pending-output 0 te-saved-point te-pending-output-info "" inhibit-quit te-log-buffer nil te-more-count -1 te-redisplay-count] 2 "\ Set up variables for use with the terminal-emulator. One should not call this -- it is an internal function of the terminal-emulator"]) (byte-code "\"!" [defalias te-quote-arg-for-sh #[(string) "\n\" \n\n\"\n!Ɖ \nGYY\n#> \nOP Y \nO\nTOR T Q+" [string-match "\\`[-a-zA-Z0-9+=_.@/:]+\\'" string "[$]" prin1-to-string "" 0 end start harder "[\"\\$]" nil "\\" "\""] 7] provide terminal] 3)