comparison lisp/term.el @ 83652:5b644ae74c91

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 846-851) - Update from CVS - Merge from emacs--rel--22 * emacs--rel--22 (patch 88-92) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 242-244) - Update from CVS Revision: emacs@sv.gnu.org/emacs--multi-tty--0--patch-31
author Miles Bader <miles@gnu.org>
date Mon, 13 Aug 2007 13:51:08 +0000
parents e5a68f18fcb9
children 107ccd98fa12 424b655804ca
comparison
equal deleted inserted replaced
83651:47230f3f349b 83652:5b644ae74c91
405 (require 'ring) 405 (require 'ring)
406 (require 'ehelp) 406 (require 'ehelp)
407 407
408 (defgroup term nil 408 (defgroup term nil
409 "General command interpreter in a window." 409 "General command interpreter in a window."
410 :group 'processes 410 :group 'processes)
411 :group 'unix)
412 411
413 412
414 ;;; Buffer Local Variables: 413 ;;; Buffer Local Variables:
415 ;;;============================================================================ 414 ;;;============================================================================
416 ;;; Term mode buffer local variables: 415 ;;; Term mode buffer local variables:
468 (defvar term-command-hook) 467 (defvar term-command-hook)
469 (defvar term-log-buffer nil) 468 (defvar term-log-buffer nil)
470 (defvar term-scroll-with-delete nil) ;; term-scroll-with-delete is t if 469 (defvar term-scroll-with-delete nil) ;; term-scroll-with-delete is t if
471 ;; forward scrolling should be implemented by delete to 470 ;; forward scrolling should be implemented by delete to
472 ;; top-most line(s); and nil if scrolling should be implemented 471 ;; top-most line(s); and nil if scrolling should be implemented
473 ;; by moving term-home-marker. It is set to t iff there is a 472 ;; by moving term-home-marker. It is set to t if there is a
474 ;; (non-default) scroll-region OR the alternate buffer is used. 473 ;; (non-default) scroll-region OR the alternate buffer is used.
475 (defvar term-pending-delete-marker) ;; New user input in line mode needs to 474 (defvar term-pending-delete-marker) ;; New user input in line mode needs to
476 ;; be deleted, because it gets echoed by the inferior. 475 ;; be deleted, because it gets echoed by the inferior.
477 ;; To reduce flicker, we defer the delete until the next output. 476 ;; To reduce flicker, we defer the delete until the next output.
478 (defvar term-old-mode-map nil) ;; Saves the old keymap when in char mode. 477 (defvar term-old-mode-map nil) ;; Saves the old keymap when in char mode.
693 (defvar term-terminal-previous-parameter-4 -1) 692 (defvar term-terminal-previous-parameter-4 -1)
694 ;;; 693 ;;;
695 694
696 ;;; faces -mm 695 ;;; faces -mm
697 696
698 (defcustom term-default-fg-color 'unspecified 697 (defcustom term-default-fg-color (face-foreground term-current-face)
699 "Default color for foreground in `term'." 698 "Default color for foreground in `term'."
700 :group 'term 699 :group 'term
701 :type 'string) 700 :type 'string)
702 701
703 (defcustom term-default-bg-color 'unspecified 702 (defcustom term-default-bg-color (face-background term-current-face)
704 "Default color for background in `term'." 703 "Default color for background in `term'."
705 :group 'term 704 :group 'term
706 :type 'string) 705 :type 'string)
707 706
708 ;;; Use the same colors that xterm uses, see `xterm-standard-colors'. 707 ;;; Use the same colors that xterm uses, see `xterm-standard-colors'.
1096 (make-local-variable 'term-exec-hook) 1095 (make-local-variable 'term-exec-hook)
1097 (make-local-variable 'term-vertical-motion) 1096 (make-local-variable 'term-vertical-motion)
1098 (make-local-variable 'term-pending-delete-marker) 1097 (make-local-variable 'term-pending-delete-marker)
1099 (setq term-pending-delete-marker (make-marker)) 1098 (setq term-pending-delete-marker (make-marker))
1100 (make-local-variable 'term-current-face) 1099 (make-local-variable 'term-current-face)
1100 (setq term-current-face (list :background term-default-bg-color
1101 :foreground term-default-fg-color))
1101 (make-local-variable 'term-pending-frame) 1102 (make-local-variable 'term-pending-frame)
1102 (setq term-pending-frame nil) 1103 (setq term-pending-frame nil)
1103 ;; Cua-mode's keybindings interfere with the term keybindings, disable it. 1104 ;; Cua-mode's keybindings interfere with the term keybindings, disable it.
1104 (set (make-local-variable 'cua-mode) nil) 1105 (set (make-local-variable 'cua-mode) nil)
1105 (run-mode-hooks 'term-mode-hook) 1106 (run-mode-hooks 'term-mode-hook)
3053 (setq term-current-row 0) 3054 (setq term-current-row 0)
3054 (setq term-current-column 1) 3055 (setq term-current-column 1)
3055 (setq term-scroll-start 0) 3056 (setq term-scroll-start 0)
3056 (setq term-scroll-end term-height) 3057 (setq term-scroll-end term-height)
3057 (setq term-insert-mode nil) 3058 (setq term-insert-mode nil)
3058 (setq term-current-face nil) 3059 (setq term-current-face (list :background term-default-bg-color
3060 :foreground term-default-fg-color))
3059 (setq term-ansi-current-underline nil) 3061 (setq term-ansi-current-underline nil)
3060 (setq term-ansi-current-bold nil) 3062 (setq term-ansi-current-bold nil)
3061 (setq term-ansi-current-reverse nil) 3063 (setq term-ansi-current-reverse nil)
3062 (setq term-ansi-current-color 0) 3064 (setq term-ansi-current-color 0)
3063 (setq term-ansi-current-invisible nil) 3065 (setq term-ansi-current-invisible nil)
3115 ((eq parameter 49) 3117 ((eq parameter 49)
3116 (setq term-ansi-current-bg-color 0)) 3118 (setq term-ansi-current-bg-color 0))
3117 3119
3118 ;;; 0 (Reset) or unknown (reset anyway) 3120 ;;; 0 (Reset) or unknown (reset anyway)
3119 (t 3121 (t
3120 (setq term-current-face nil) 3122 (setq term-current-face (list :background term-default-bg-color
3123 :foreground term-default-fg-color))
3121 (setq term-ansi-current-underline nil) 3124 (setq term-ansi-current-underline nil)
3122 (setq term-ansi-current-bold nil) 3125 (setq term-ansi-current-bold nil)
3123 (setq term-ansi-current-reverse nil) 3126 (setq term-ansi-current-reverse nil)
3124 (setq term-ansi-current-color 0) 3127 (setq term-ansi-current-color 0)
3125 (setq term-ansi-current-invisible nil) 3128 (setq term-ansi-current-invisible nil)
3152 ;; No need to bother with anything else if it's invisible 3155 ;; No need to bother with anything else if it's invisible
3153 ) 3156 )
3154 (setq term-current-face 3157 (setq term-current-face
3155 (list :background 3158 (list :background
3156 (if (= term-ansi-current-color 0) 3159 (if (= term-ansi-current-color 0)
3157 (face-foreground 'default) 3160 term-default-fg-color
3158 (elt ansi-term-color-vector term-ansi-current-color)) 3161 (elt ansi-term-color-vector term-ansi-current-color))
3159 :foreground 3162 :foreground
3160 (if (= term-ansi-current-bg-color 0) 3163 (if (= term-ansi-current-bg-color 0)
3161 (face-background 'default) 3164 term-default-bg-color
3162 (elt ansi-term-color-vector term-ansi-current-bg-color)))) 3165 (elt ansi-term-color-vector term-ansi-current-bg-color))))
3163 (when term-ansi-current-bold 3166 (when term-ansi-current-bold
3164 (setq term-current-face 3167 (setq term-current-face
3165 (append '(:weight bold) term-current-face))) 3168 (append '(:weight bold) term-current-face)))
3166 (when term-ansi-current-underline 3169 (when term-ansi-current-underline
3179 (elt ansi-term-color-vector term-ansi-current-bg-color))) 3182 (elt ansi-term-color-vector term-ansi-current-bg-color)))
3180 ;; No need to bother with anything else if it's invisible 3183 ;; No need to bother with anything else if it's invisible
3181 ) 3184 )
3182 (setq term-current-face 3185 (setq term-current-face
3183 (list :foreground 3186 (list :foreground
3184 (elt ansi-term-color-vector term-ansi-current-color) 3187 (if (= term-ansi-current-color 0)
3188 term-default-fg-color
3189 (elt ansi-term-color-vector term-ansi-current-color))
3185 :background 3190 :background
3186 (elt ansi-term-color-vector term-ansi-current-bg-color))) 3191 (if (= term-ansi-current-bg-color 0)
3192 term-default-bg-color
3193 (elt ansi-term-color-vector term-ansi-current-bg-color))))
3187 (when term-ansi-current-bold 3194 (when term-ansi-current-bold
3188 (setq term-current-face 3195 (setq term-current-face
3189 (append '(:weight bold) term-current-face))) 3196 (append '(:weight bold) term-current-face)))
3190 (when term-ansi-current-underline 3197 (when term-ansi-current-underline
3191 (setq term-current-face 3198 (setq term-current-face
3713 (goto-char saved-point)))) 3720 (goto-char saved-point))))
3714 3721
3715 (defun term-erase-in-display (kind) 3722 (defun term-erase-in-display (kind)
3716 "Erases (that is blanks out) part of the window. 3723 "Erases (that is blanks out) part of the window.
3717 If KIND is 0, erase from (point) to (point-max); 3724 If KIND is 0, erase from (point) to (point-max);
3718 if KIND is 1, erase from home to point; else erase from home to point-max. 3725 if KIND is 1, erase from home to point; else erase from home to point-max."
3719 Should only be called when point is at the start of a screen line."
3720 (term-handle-deferred-scroll) 3726 (term-handle-deferred-scroll)
3721 (cond ((eq term-terminal-parameter 0) 3727 (cond ((eq term-terminal-parameter 0)
3722 (delete-region (point) (point-max)) 3728 (let ((need-unwrap (bolp)))
3723 (term-unwrap-line)) 3729 (delete-region (point) (point-max))
3730 (when need-unwrap (term-unwrap-line))))
3724 ((let ((row (term-current-row)) 3731 ((let ((row (term-current-row))
3725 (col (term-horizontal-column)) 3732 (col (term-horizontal-column))
3726 (start-region term-home-marker) 3733 (start-region term-home-marker)
3727 (end-region (if (eq kind 1) (point) (point-max)))) 3734 (end-region (if (eq kind 1) (point) (point-max))))
3728 (delete-region start-region end-region) 3735 (delete-region start-region end-region)