(facemenu-active-faces):
[bpt/emacs.git] / lisp / terminal.el
index d6138aa..303bb69 100644 (file)
@@ -1,4 +1,4 @@
-;;; terminal.el --- terminal emulator for GNU Emacs.
+;;; terminal.el --- terminal emulator for GNU Emacs
 
 ;; Copyright (C) 1986,87,88,89,93,94 Free Software Foundation, Inc.
 
@@ -60,7 +60,7 @@ This variable is local to each terminal-emulator buffer."
   :type 'character
   :group 'terminal)
 
-(defcustom terminal-scrolling t ;;>> Setting this to T sort-of defeats my whole aim in writing this package...
+(defcustom terminal-scrolling t ;;>> Setting this to t sort-of defeats my whole aim in writing this package...
   "*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.
@@ -187,7 +187,9 @@ performance."
 ;; Required to support terminfo systems
 (defconst te-terminal-name-prefix "emacs-em"
   "Prefix used for terminal type names for Terminfo.")
-(defconst te-terminfo-directory "/tmp/emacs-terminfo/"
+(defconst te-terminfo-directory
+  (file-name-as-directory
+   (expand-file-name "emacs-terminfo" temporary-file-directory))
   "Directory used for run-time terminal definition files for Terminfo.")
 (defvar te-terminal-name nil)
 \f
@@ -673,7 +675,7 @@ move to start of new line, clear to end of line."
   (cond ((not terminal-more-processing))
        ((< (setq te-more-count (1- te-more-count)) 0)
         (te-set-more-count t))
-       ((eql te-more-count 0)
+       ((eq te-more-count 0)
         ;; this doesn't return
         (te-more-break)))
   (if (eobp)
@@ -746,11 +748,11 @@ move to start of new line, clear to end of line."
             (n (min (- (te-get-char) ?\ ) line))
             (i 0))
        (delete-region (- (point-max) (* n (1+ te-width))) (point-max))
-       (if (eql (point) (point-max)) (insert ?\n))
+       (if (eq (point) (point-max)) (insert ?\n))
        (while (< i n)
          (setq i (1+ i))
          (insert-char ?\  te-width)
-         (or (eql i line) (insert ?\n))))))
+         (or (eq i line) (insert ?\n))))))
   (setq te-more-count -1))
 
 
@@ -768,7 +770,7 @@ move to start of new line, clear to end of line."
        (while (< i n)
          (setq i (1+ i))
          (insert-char ?\  te-width)
-         (or (eql i line) (insert ?\n))))))
+         (or (eq i line) (insert ?\n))))))
   (setq te-more-count -1))
 
 ;; ^p ^a
@@ -905,7 +907,7 @@ move to start of new line, clear to end of line."
              start (car te-pending-output)
              string (car (cdr te-pending-output))
              char (aref string start))
-       (if (eql (setq start (1+ start)) (length string))
+       (if (eq (setq start (1+ start)) (length string))
            (progn (setq te-pending-output
                           (cons 0 (cdr (cdr te-pending-output)))
                         start 0
@@ -915,7 +917,7 @@ move to start of new line, clear to end of line."
        (if (and (> char ?\037) (< char ?\377))
            (cond ((eolp)
                   ;; unread char
-                  (if (eql start 0)
+                  (if (eq start 0)
                       (setq te-pending-output
                             (cons 0 (cons (make-string 1 char)
                                           (cdr te-pending-output))))
@@ -934,13 +936,13 @@ move to start of new line, clear to end of line."
                     (setq char (point)) (end-of-line)
                     (setq end (min end (+ start (- (point) char))))
                     (goto-char char)
-                    (if (eql end matchpos) (setq matchpos nil))
+                    (if (eq end matchpos) (setq matchpos nil))
                     (delete-region (point) (+ (point) (- end start)))
-                    (insert (if (and (eql start 0)
-                                     (eql end (length string)))
+                    (insert (if (and (eq start 0)
+                                     (eq end (length string)))
                                 string
                                 (substring string start end)))
-                    (if (eql end (length string))
+                    (if (eq end (length string))
                         (setq te-pending-output
                               (cons 0 (cdr (cdr te-pending-output))))
                         (setcar te-pending-output end))
@@ -949,7 +951,7 @@ move to start of new line, clear to end of line."
          ;;  function we could trivially emulate different terminals
          ;; Who cares in any case?  (Apart from stupid losers using rlogin)
          (funcall
-           (if (eql char ?\^p)
+           (if (eq char ?\^p)
                (or (cdr (assq (te-get-char)
                               '((?= . te-move-to-position)
                                 (?c . te-clear-rest-of-line)
@@ -989,18 +991,17 @@ move to start of new line, clear to end of line."
             ;; preemptible output!  Oh my!!
             (throw 'te-process-output t)))))
   ;; We must update window-point in every window displaying our buffer
-  (let* ((s (selected-window))
-        (w s))
-    (while (not (eq s (setq w (next-window w))))
-      (if (eq (window-buffer w) (current-buffer))
-         (set-window-point w (point))))))
+  (walk-windows (lambda (w)
+                 (when (and (not (eq w (selected-window)))
+                            (eq (window-buffer w) (current-buffer)))
+                   (set-window-point w (point))))))
 
 (defun te-get-char ()
   (if (cdr te-pending-output)
       (let ((start (car te-pending-output))
            (string (car (cdr te-pending-output))))
        (prog1 (aref string start)
-         (if (eql (setq start (1+ start)) (length string))
+         (if (eq (setq start (1+ start)) (length string))
              (setq te-pending-output (cons 0 (cdr (cdr te-pending-output))))
              (setcar te-pending-output start))))
     (catch 'char
@@ -1009,7 +1010,7 @@ move to start of new line, clear to end of line."
            (progn
              (set-process-filter te-process
                                  (function (lambda (p s)
-                                    (or (eql (length s) 1)
+                                    (or (eq (length s) 1)
                                         (setq te-pending-output (list 1 s)))
                                     (throw 'char (aref s 0)))))
              (accept-process-output te-process))
@@ -1069,7 +1070,7 @@ move to start of new line, clear to end of line."
 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.
+program as keyboard input.
 
 Interactively, BUFFER defaults to \"*terminal*\" and PROGRAM and ARGS
 are parsed from an input-string using your usual shell.
@@ -1119,8 +1120,9 @@ subprocess started."
   (if (null height) (setq height (- (window-height (selected-window)) 1)))
   (terminal-mode)
   (setq te-width width te-height height)
-  (setq te-terminal-name (concat te-terminal-name-prefix te-width
-                                te-height))
+  (setq te-terminal-name (concat te-terminal-name-prefix
+                                (number-to-string te-width)
+                                (number-to-string te-height)))
   (setq mode-line-buffer-identification
        (list (format "Emacs terminal %dx%d: %%b  " te-width te-height)
              'te-pending-output-info))
@@ -1171,7 +1173,7 @@ subprocess started."
                                s p)
                               (prog1 (substring s p (match-end 1))
                                 (setq p (match-end 0))
-                                (if (eql p (length s)) (setq p nil)))
+                                (if (eq p (length s)) (setq p nil)))
                               (prog1 (substring s p)
                                 (setq p nil)))
                           l)))