]> code.delx.au - gnu-emacs/blobdiff - lisp/term.el
(locale-language-names): Map "es" to "Spanish" and "nl" to "Dutch".
[gnu-emacs] / lisp / term.el
index ac6201c8b33ffaf99eb8e1812c64dc6e6a26f5c5..452d5f29a8e1f07c80a63d91f436a4e1e8e27fef 100644 (file)
@@ -4,7 +4,7 @@
 
 ;;; Author: Per Bothner <bothner@cygnus.com>
 ;;; Based on comint mode written by: Olin Shivers <shivers@cs.cmu.edu>
-;;; Keyword: processes
+;;; Keywords: processes
 
 ;; This file is part of GNU Emacs.
 
 ;; so it is important to increase it if there are protocol-relevant changes.
 (defconst term-protocol-version "0.95")
 
+(eval-when-compile
+  (require 'ange-ftp))
 (require 'ring)
 (require 'ehelp)
 
@@ -719,6 +721,7 @@ Buffer local variable.")
 
 (when (fboundp 'make-face)
 ;;; --- Simple faces ---
+  (copy-face 'default 'term-default)
   (make-face 'term-default-fg)
   (make-face 'term-default-bg)
   (make-face 'term-default-fg-inv)
@@ -1202,20 +1205,22 @@ without any interpretation."
 
 (defun term-send-raw-meta ()
   (interactive)
-  (if (symbolp last-input-char)
+  (let ((char last-input-char))
+    (when (symbolp last-input-char)
       ;; Convert `return' to C-m, etc.
-      (let ((tmp (get last-input-char 'event-symbol-elements)))
-       (if tmp
-           (setq last-input-char (car tmp)))
-       (if (symbolp last-input-char)
-           (progn
-             (setq tmp (get last-input-char 'ascii-character))
-             (if tmp (setq last-input-char tmp))))))
-  (term-send-raw-string (if (and (numberp last-input-char)
-                                (> last-input-char 127)
-                                (< last-input-char 256))
-                           (make-string 1 last-input-char)
-                         (format "\e%c" last-input-char))))
+      (let ((tmp (get char 'event-symbol-elements)))
+       (when tmp
+         (setq char (car tmp)))
+       (when (symbolp char)
+         (setq tmp (get char 'ascii-character))
+         (when tmp
+           (setq char tmp)))))
+    (setq char (event-basic-type char))
+    (term-send-raw-string (if (and (numberp char)
+                                  (> char 127)
+                                  (< char 256))
+                             (make-string 1 char)
+                           (format "\e%c" char)))))
 
 (defun term-mouse-paste (click arg)
   "Insert the last stretch of killed text at the position clicked on."
@@ -1279,6 +1284,8 @@ intervention from Emacs, except for the escape character (usually C-c)."
          (define-key map (make-string 1 i) 'term-send-raw)
          (define-key esc-map (make-string 1 i) 'term-send-raw-meta)
          (setq i (1+ i)))
+       (dolist (elm (generic-character-list))
+         (define-key map (vector elm) 'term-send-raw))
        (define-key map "\e" esc-map)
        (setq term-raw-map map)
        (setq term-raw-escape-map
@@ -2700,6 +2707,7 @@ See `term-prompt-regexp'."
   (let* ((previous-buffer (current-buffer))
         (i 0) char funny count save-point save-marker old-point temp win
         (selected (selected-window))
+        last-win
         (str-length (length str)))
     (unwind-protect
        (progn
@@ -2957,6 +2965,11 @@ See `term-prompt-regexp'."
          ;; Scroll each window displaying the buffer but (by default)
          ;; only if the point matches the process-mark we started with.
          (setq win selected)
+         ;; Avoid infinite loop in strange case where minibuffer window
+         ;; is selected but not active.
+         (while (window-minibuffer-p win)
+           (setq win (next-window win nil t)))
+         (setq last-win win)
          (while (progn
                   (setq win (next-window win nil t))
                   (if (eq (window-buffer win) (process-buffer proc))
@@ -2982,7 +2995,7 @@ See `term-prompt-regexp'."
                             (save-excursion
                               (goto-char (point-max))
                               (recenter -1)))))
-                  (not (eq win selected))))
+                  (not (eq win last-win))))
 
 ;;; Stolen from comint.el and adapted -mm
          (if (> term-buffer-maximum-size 0)
@@ -3034,12 +3047,22 @@ See `term-prompt-regexp'."
    ((eq parameter 8)
     (setq term-ansi-current-invisible 1))
 
+;;; Foreground
    ((and (>= parameter 30) (<= parameter 37))
     (setq term-ansi-current-color (- parameter 29)))
 
+;;; Reset foreground
+   ((eq parameter 39)
+    (setq term-ansi-current-color 0))
+
+;;; Background
    ((and (>= parameter 40) (<= parameter 47))
     (setq term-ansi-current-bg-color (- parameter 39)))
 
+;;; Reset background
+   ((eq parameter 49)
+    (setq term-ansi-current-bg-color 0))
+
 ;;; 0 (Reset) or unknown (reset anyway)
    (t
     (setq term-current-face