396 |
|
|
397 |
;; This is passed to the inferior in the EMACS environment variable, |
;; This is passed to the inferior in the EMACS environment variable, |
398 |
;; so it is important to increase it if there are protocol-relevant changes. |
;; so it is important to increase it if there are protocol-relevant changes. |
399 |
(defconst term-protocol-version "0.95") |
(defconst term-protocol-version "0.96") |
400 |
|
|
401 |
(eval-when-compile |
(eval-when-compile |
402 |
(require 'ange-ftp)) |
(require 'ange-ftp)) |
457 |
;; we want suppressed. |
;; we want suppressed. |
458 |
(defvar term-terminal-parameter) |
(defvar term-terminal-parameter) |
459 |
(defvar term-terminal-previous-parameter) |
(defvar term-terminal-previous-parameter) |
460 |
(defvar term-current-face 'term-default) |
(defvar term-current-face 'default) |
461 |
(defvar term-scroll-start 0) ;; Top-most line (inclusive) of scrolling region. |
(defvar term-scroll-start 0) ;; Top-most line (inclusive) of scrolling region. |
462 |
(defvar term-scroll-end) ;; Number of line (zero-based) after scrolling region. |
(defvar term-scroll-end) ;; Number of line (zero-based) after scrolling region. |
463 |
(defvar term-pager-count nil) ;; If nil, paging is disabled. |
(defvar term-pager-count nil) ;; If nil, paging is disabled. |
1365 |
(defvar term-termcap-format |
(defvar term-termcap-format |
1366 |
"%s%s:li#%d:co#%d:cl=\\E[H\\E[J:cd=\\E[J:bs:am:xn:cm=\\E[%%i%%d;%%dH\ |
"%s%s:li#%d:co#%d:cl=\\E[H\\E[J:cd=\\E[J:bs:am:xn:cm=\\E[%%i%%d;%%dH\ |
1367 |
:nd=\\E[C:up=\\E[A:ce=\\E[K:ho=\\E[H:pt\ |
:nd=\\E[C:up=\\E[A:ce=\\E[K:ho=\\E[H:pt\ |
1368 |
:al=\\E[L:dl=\\E[M:DL=\\E[%%dM:AL=\\E[%%dL:cs=\\E[%%i%%d;%%dr:sf=\\n\ |
:al=\\E[L:dl=\\E[M:DL=\\E[%%dM:AL=\\E[%%dL:cs=\\E[%%i%%d;%%dr:sf=^J\ |
1369 |
:te=\\E[2J\\E[?47l\\E8:ti=\\E7\\E[?47h\ |
:te=\\E[2J\\E[?47l\\E8:ti=\\E7\\E[?47h\ |
1370 |
:dc=\\E[P:DC=\\E[%%dP:IC=\\E[%%d@:im=\\E[4h:ei=\\E[4l:mi:\ |
:dc=\\E[P:DC=\\E[%%dP:IC=\\E[%%d@:im=\\E[4h:ei=\\E[4l:mi:\ |
1371 |
:so=\\E[7m:se=\\E[m:us=\\E[4m:ue=\\E[m:md=\\E[1m:mr=\\E[7m:me=\\E[m\ |
:so=\\E[7m:se=\\E[m:us=\\E[4m:ue=\\E[m:md=\\E[1m:mr=\\E[7m:me=\\E[m\ |
1372 |
:UP=\\E[%%dA:DO=\\E[%%dB:LE=\\E[%%dD:RI=\\E[%%dC" |
:UP=\\E[%%dA:DO=\\E[%%dB:LE=\\E[%%dD:RI=\\E[%%dC\ |
1373 |
|
:kl=\\EOD:kd=\\EOB:kr=\\EOC:ku=\\EOA:kN=\\E[6~:kP=\\E[5~:@7=\\E[4~:kh=\\E[1~\ |
1374 |
|
:mk=\\E[8m:cb=\\E[1K:op=\\E[39;49m:Co#8:pa#64:AB=\\E[4%%dm:AF=\\E[3%%dm:cr=^M\ |
1375 |
|
:bl=^G:do=^J:le=^H:ta=^I:se=\E[27m:ue=\E24m:" |
1376 |
;;; : -undefine ic |
;;; : -undefine ic |
1377 |
"termcap capabilities supported") |
"termcap capabilities supported") |
1378 |
|
|
1389 |
(nconc |
(nconc |
1390 |
(list |
(list |
1391 |
(format "TERM=%s" term-term-name) |
(format "TERM=%s" term-term-name) |
1392 |
(if (and (boundp 'system-uses-terminfo) system-uses-terminfo) |
(format "TERMINFO=%s" data-directory) |
1393 |
(format "TERMINFO=%s" data-directory) |
(format term-termcap-format "TERMCAP=" |
1394 |
(format term-termcap-format "TERMCAP=" |
term-term-name term-height term-width) |
|
term-term-name term-height term-width)) |
|
1395 |
;; Breaks `./configure' of w3 and url which try to run $EMACS. |
;; Breaks `./configure' of w3 and url which try to run $EMACS. |
1396 |
(format "EMACS=%s (term:%s)" emacs-version term-protocol-version) |
(format "EMACS=%s (term:%s)" emacs-version term-protocol-version) |
1397 |
(format "LINES=%d" term-height) |
(format "LINES=%d" term-height) |
1411 |
".." |
".." |
1412 |
command switches))) |
command switches))) |
1413 |
|
|
|
;;; This should be in Emacs, but it isn't. |
|
|
(defun term-mem (item list &optional elt=) |
|
|
"Test to see if ITEM is equal to an item in LIST. |
|
|
Option comparison function ELT= defaults to equal." |
|
|
(let ((elt= (or elt= (function equal))) |
|
|
(done nil)) |
|
|
(while (and list (not done)) |
|
|
(if (funcall elt= item (car list)) |
|
|
(setq done list) |
|
|
(setq list (cdr list)))) |
|
|
done)) |
|
|
|
|
1414 |
|
|
1415 |
;;; Input history processing in a buffer |
;;; Input history processing in a buffer |
1416 |
;;; =========================================================================== |
;;; =========================================================================== |
2980 |
((eq parameter 8) |
((eq parameter 8) |
2981 |
(setq term-ansi-current-invisible 1)) |
(setq term-ansi-current-invisible 1)) |
2982 |
|
|
2983 |
|
;;; Reset reverse (i.e. terminfo rmso) |
2984 |
|
((eq parameter 24) |
2985 |
|
(setq term-ansi-current-reverse 0)) |
2986 |
|
|
2987 |
|
;;; Reset underline (i.e. terminfo rmul) |
2988 |
|
((eq parameter 27) |
2989 |
|
(setq term-ansi-current-underline 0)) |
2990 |
|
|
2991 |
;;; Foreground |
;;; Foreground |
2992 |
((and (>= parameter 30) (<= parameter 37)) |
((and (>= parameter 30) (<= parameter 37)) |
2993 |
(setq term-ansi-current-color (- parameter 29))) |
(setq term-ansi-current-color (- parameter 29))) |
3042 |
) |
) |
3043 |
(setq term-current-face |
(setq term-current-face |
3044 |
(list :background |
(list :background |
3045 |
(elt ansi-term-color-vector term-ansi-current-color) |
(if (= term-ansi-current-color 0) |
3046 |
|
(face-foreground 'default) |
3047 |
|
(elt ansi-term-color-vector term-ansi-current-color)) |
3048 |
:foreground |
:foreground |
3049 |
(elt ansi-term-color-vector term-ansi-current-bg-color))) |
(if (= term-ansi-current-bg-color 0) |
3050 |
|
(face-background 'default) |
3051 |
|
(elt ansi-term-color-vector term-ansi-current-bg-color)))) |
3052 |
(if (= term-ansi-current-bold 1) |
(if (= term-ansi-current-bold 1) |
3053 |
(setq term-current-face |
(setq term-current-face |
3054 |
(append '(:weight bold) term-current-face))) |
(append '(:weight bold) term-current-face))) |
3505 |
(if (and check-for-scroll (or term-scroll-with-delete term-pager-count)) |
(if (and check-for-scroll (or term-scroll-with-delete term-pager-count)) |
3506 |
(setq down (term-handle-scroll down))) |
(setq down (term-handle-scroll down))) |
3507 |
(term-adjust-current-row-cache down) |
(term-adjust-current-row-cache down) |
3508 |
(if (/= (point) (point-max)) |
(if (or (/= (point) (point-max)) (< down 0)) |
3509 |
(setq down (- down (term-vertical-motion down)))) |
(setq down (- down (term-vertical-motion down)))) |
3510 |
;; Extend buffer with extra blank lines if needed. |
;; Extend buffer with extra blank lines if needed. |
3511 |
(cond ((> down 0) |
(cond ((> down 0) |