emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/term.el [lexbind]


From: Miles Bader
Subject: [Emacs-diffs] Changes to emacs/lisp/term.el [lexbind]
Date: Wed, 06 Oct 2004 01:43:42 -0400

Index: emacs/lisp/term.el
diff -c emacs/lisp/term.el:1.47.2.7 emacs/lisp/term.el:1.47.2.8
*** emacs/lisp/term.el:1.47.2.7 Wed Oct  6 05:21:52 2004
--- emacs/lisp/term.el  Wed Oct  6 05:23:55 2004
***************
*** 1,6 ****
  ;;; term.el --- general command interpreter in a window stuff
  
! ;;; Copyright (C) 1988, 1990, 1992, 1994, 1995 Free Software Foundation, Inc.
  
  ;; Author: Per Bothner <address@hidden>
  ;; Based on comint mode written by: Olin Shivers <address@hidden>
--- 1,6 ----
  ;;; term.el --- general command interpreter in a window stuff
  
! ;;; Copyright (C) 1988, 1990, 1992, 1994, 1995, 2004 Free Software 
Foundation, Inc.
  
  ;; Author: Per Bothner <address@hidden>
  ;; Based on comint mode written by: Olin Shivers <address@hidden>
***************
*** 676,682 ****
  (defvar term-terminal-menu)
  
  ;;; Let's silence the byte-compiler -mm
- (defvar term-ansi-at-eval-string nil)
  (defvar term-ansi-at-host nil)
  (defvar term-ansi-at-dir nil)
  (defvar term-ansi-at-user nil)
--- 676,681 ----
***************
*** 692,700 ****
  (defvar term-ansi-current-highlight 0)
  (defvar term-ansi-current-reverse 0)
  (defvar term-ansi-current-invisible 0)
- (defvar term-ansi-default-fg 0)
- (defvar term-ansi-default-bg 0)
- (defvar term-ansi-current-temp 0)
  
  ;;; Four should be enough, if you want more, just add. -mm
  (defvar term-terminal-more-parameters 0)
--- 691,696 ----
***************
*** 917,922 ****
--- 913,921 ----
      (define-key term-raw-map [backspace] 'term-send-backspace)
      (define-key term-raw-map [home] 'term-send-home)
      (define-key term-raw-map [end] 'term-send-end)
+     (define-key term-raw-map [S-prior] 'scroll-down)
+     (define-key term-raw-map [S-next] 'scroll-up)
+     (define-key term-raw-map [S-insert] 'term-paste)
      (define-key term-raw-map [prior] 'term-send-prior)
      (define-key term-raw-map [next] 'term-send-next)))
  
***************
*** 932,937 ****
--- 931,957 ----
  
  (put 'term-mode 'mode-class 'special)
  
+ 
+ ;;; Use this variable as a display table for `term-mode'.
+ (defvar term-display-table
+   (let ((dt (or (copy-sequence standard-display-table)
+               (make-display-table)))
+         i)
+     ;; avoid changing the display table for ^J
+     (setq i 0) 
+     (while (< i 10)
+       (aset dt i (vector i))
+       (setq i (1+ i)))
+     (setq i 11) 
+     (while (< i 32)
+       (aset dt i (vector i))
+       (setq i (1+ i)))
+     (setq i 128)
+     (while (< i 256)
+       (aset dt i (vector i))
+       (setq i (1+ i)))
+     dt))
+ 
  (defun term-mode ()
    "Major mode for interacting with an inferior interpreter.
  The interpreter name is same as buffer name, sans the asterisks.
***************
*** 981,986 ****
--- 1001,1009 ----
    (setq major-mode 'term-mode)
    (setq mode-name "Term")
    (use-local-map term-mode-map)
+   ;; we do not want indent to sneak in any tabs
+   (setq indent-tabs-mode nil)
+   (setq buffer-display-table term-display-table)
    (make-local-variable 'term-home-marker)
    (setq term-home-marker (copy-marker 0))
    (make-local-variable 'term-saved-home-marker)
***************
*** 1184,1189 ****
--- 1207,1217 ----
                                        ((eq arg '-) -1)
                                        (t (1- arg)))))))
  
+ (defun term-paste ()
+   "Insert the last stretch of killed text at point."
+   (interactive)
+    (term-send-raw-string (current-kill 0)))
+ 
  ;; Which would be better:  "\e[A" or "\eOA"? readline accepts either.
  ;; For my configuration it's definitely better \eOA but YMMV. -mm
  ;; For example: vi works with \eOA while elm wants \e[A ...
***************
*** 1195,1202 ****
  (defun term-send-end   () (interactive) (term-send-raw-string "\e[4~"))
  (defun term-send-prior () (interactive) (term-send-raw-string "\e[5~"))
  (defun term-send-next  () (interactive) (term-send-raw-string "\e[6~"))
! (defun term-send-del   () (interactive) (term-send-raw-string "\C-?"))
! (defun term-send-backspace  () (interactive) (term-send-raw-string "\C-H"))
  
  (defun term-char-mode ()
    "Switch to char (\"raw\") sub-mode of term mode.
--- 1223,1230 ----
  (defun term-send-end   () (interactive) (term-send-raw-string "\e[4~"))
  (defun term-send-prior () (interactive) (term-send-raw-string "\e[5~"))
  (defun term-send-next  () (interactive) (term-send-raw-string "\e[6~"))
! (defun term-send-del   () (interactive) (term-send-raw-string "\e[3~"))
! (defun term-send-backspace  () (interactive) (term-send-raw-string "\C-?"))
  
  (defun term-char-mode ()
    "Switch to char (\"raw\") sub-mode of term mode.
***************
*** 1366,1379 ****
    "%s%s:li#%d:co#%d:cl=\\E[H\\E[J:cd=\\E[J:bs:am:xn:cm=\\E[%%i%%d;%%dH\
  :nd=\\E[C:up=\\E[A:ce=\\E[K:ho=\\E[H:pt\
  :al=\\E[L:dl=\\E[M:DL=\\E[%%dM:AL=\\E[%%dL:cs=\\E[%%i%%d;%%dr:sf=^J\
- :te=\\E[2J\\E[?47l\\E8:ti=\\E7\\E[?47h\
  :dc=\\E[P:DC=\\E[%%dP:IC=\\E[%%d@:im=\\E[4h:ei=\\E[4l:mi:\
  :so=\\E[7m:se=\\E[m:us=\\E[4m:ue=\\E[m:md=\\E[1m:mr=\\E[7m:me=\\E[m\
  :UP=\\E[%%dA:DO=\\E[%%dB:LE=\\E[%%dD:RI=\\E[%%dC\
  :kl=\\EOD:kd=\\EOB:kr=\\EOC:ku=\\EOA:kN=\\E[6~:kP=\\E[5~:@7=\\E[4~:kh=\\E[1~\
  :mk=\\E[8m:cb=\\E[1K:op=\\E[39;49m:Co#8:pa#64:AB=\\E[4%%dm:AF=\\E[3%%dm:cr=^M\
! :bl=^G:do=^J:le=^H:ta=^I:se=\E[27m:ue=\E24m:"
  ;;; : -undefine ic
    "termcap capabilities supported")
  
  ;;; This auxiliary function cranks up the process for term-exec in
--- 1394,1408 ----
    "%s%s:li#%d:co#%d:cl=\\E[H\\E[J:cd=\\E[J:bs:am:xn:cm=\\E[%%i%%d;%%dH\
  :nd=\\E[C:up=\\E[A:ce=\\E[K:ho=\\E[H:pt\
  :al=\\E[L:dl=\\E[M:DL=\\E[%%dM:AL=\\E[%%dL:cs=\\E[%%i%%d;%%dr:sf=^J\
  :dc=\\E[P:DC=\\E[%%dP:IC=\\E[%%d@:im=\\E[4h:ei=\\E[4l:mi:\
  :so=\\E[7m:se=\\E[m:us=\\E[4m:ue=\\E[m:md=\\E[1m:mr=\\E[7m:me=\\E[m\
  :UP=\\E[%%dA:DO=\\E[%%dB:LE=\\E[%%dD:RI=\\E[%%dC\
  :kl=\\EOD:kd=\\EOB:kr=\\EOC:ku=\\EOA:kN=\\E[6~:kP=\\E[5~:@7=\\E[4~:kh=\\E[1~\
  :mk=\\E[8m:cb=\\E[1K:op=\\E[39;49m:Co#8:pa#64:AB=\\E[4%%dm:AF=\\E[3%%dm:cr=^M\
! :bl=^G:do=^J:le=^H:ta=^I:se=\E[27m:ue=\E24m\
! :kb=^?:kD=^[[3~:sc=\E7:rc=\E8:"
  ;;; : -undefine ic
+ ;;; don't define :te=\\E[2J\\E[?47l\\E8:ti=\\E7\\E[?47h\
    "termcap capabilities supported")
  
  ;;; This auxiliary function cranks up the process for term-exec in
***************
*** 1400,1408 ****
        (process-connection-type t)
        ;; We should suppress conversion of end-of-line format.
        (inhibit-eol-conversion t)
!       ;; inhibit-eol-conversion doesn't seem to do the job, but this does.
!       (coding-system-for-read 'unknown-unix)
!       )
      (apply 'start-process name buffer
           "/bin/sh" "-c"
           (format "stty -nl echo rows %d columns %d sane 2>/dev/null;\
--- 1429,1438 ----
        (process-connection-type t)
        ;; We should suppress conversion of end-of-line format.
        (inhibit-eol-conversion t)
!       ;; The process's output contains not just chars but also binary
!       ;; escape codes, so we need to see the raw output.  We will have to
!       ;; do the decoding by hand on the parts that are made of chars.
!       (coding-system-for-read 'binary))
      (apply 'start-process name buffer
           "/bin/sh" "-c"
           (format "stty -nl echo rows %d columns %d sane 2>/dev/null;\
***************
*** 2558,2565 ****
                   (- (term-vertical-motion -9999))))))))
  
  (defun term-adjust-current-row-cache (delta)
!   (if term-current-row
!       (setq term-current-row (+ term-current-row delta))))
  
  (defun term-terminal-pos ()
    (save-excursion ;    save-restriction
--- 2588,2596 ----
                   (- (term-vertical-motion -9999))))))))
  
  (defun term-adjust-current-row-cache (delta)
!   (when term-current-row
!     (setq term-current-row 
!         (max 0 (+ term-current-row delta)))))
  
  (defun term-terminal-pos ()
    (save-excursion ;    save-restriction
***************
*** 2693,2699 ****
                   (if (not funny) (setq funny str-length))
                   (cond ((> funny i)
                          (cond ((eq term-terminal-state 1)
!                                (term-move-columns 1)
                                 (setq term-terminal-state 0)))
                          (setq count (- funny i))
                          (setq temp (- (+ (term-horizontal-column) count)
--- 2724,2735 ----
                   (if (not funny) (setq funny str-length))
                   (cond ((> funny i)
                          (cond ((eq term-terminal-state 1)
!                                ;; We are in state 1, we need to wrap
!                                ;; around.  Go to the beginning of
!                                ;; the next line and switch to state
!                                ;; 0.
!                                (term-down 1)
!                                (term-move-columns (- (term-current-column)))
                                 (setq term-terminal-state 0)))
                          (setq count (- funny i))
                          (setq temp (- (+ (term-horizontal-column) count)
***************
*** 2702,2707 ****
--- 2738,2744 ----
                                ((> count temp) ;; Some chars fit.
                                 ;; This iteration, handle only what fits.
                                 (setq count (- count temp))
+                                (setq temp 0)
                                 (setq funny (+ count i)))
                                ((or (not (or term-pager-count
                                              term-scroll-with-delete))
***************
*** 2722,2734 ****
                          ;; following point if not eob nor insert-mode.
                          (let ((old-column (current-column))
                                columns pos)
!                           (insert (substring str i funny))
                            (setq term-current-column (current-column)
                                  columns (- term-current-column old-column))
                            (when (not (or (eobp) term-insert-mode))
                              (setq pos (point))
                              (term-move-columns columns)
!                             (delete-region pos (point))))
                          (setq term-current-column nil)
  
                          (put-text-property old-point (point)
--- 2759,2781 ----
                          ;; following point if not eob nor insert-mode.
                          (let ((old-column (current-column))
                                columns pos)
!                           (insert (decode-coding-string (substring str i 
funny) locale-coding-system))
                            (setq term-current-column (current-column)
                                  columns (- term-current-column old-column))
                            (when (not (or (eobp) term-insert-mode))
                              (setq pos (point))
                              (term-move-columns columns)
!                             (delete-region pos (point)))
!                           ;; In insert if the if the current line
!                           ;; has become too long it needs to be
!                           ;; chopped off.
!                           (when term-insert-mode 
!                             (setq pos (point))
!                             (end-of-line)
!                             (when (> (current-column) term-width)
!                               (delete-region (- (point) (- (current-column) 
term-width)) 
!                                              (point)))
!                             (goto-char pos)))
                          (setq term-current-column nil)
  
                          (put-text-property old-point (point)
***************
*** 2741,2753 ****
                                 (setq term-terminal-state 1)))
                          (setq i (1- funny)))
                         ((and (setq term-terminal-state 0)
!                              (eq char ?\^I)) ; TAB
!                         ;; FIXME:  Does not handle line wrap!
                          (setq count (term-current-column))
!                         (setq count (+ count 8 (- (mod count 8))))
!                         (if (< (move-to-column count nil) count)
!                             (term-insert-char char 1))
!                         (setq term-current-column count))
                         ((eq char ?\r)
                          ;; Optimize CRLF at end of buffer:
                          (cond ((and (< (setq temp (1+ i)) str-length)
--- 2788,2809 ----
                                 (setq term-terminal-state 1)))
                          (setq i (1- funny)))
                         ((and (setq term-terminal-state 0)
!                              (eq char ?\^I)) ; TAB (terminfo: ht)
                          (setq count (term-current-column))
!                         ;; The line cannot exceed term-width. TAB at
!                         ;; the end of a line should not cause wrapping.
!                         (setq count (min term-width 
!                                          (+ count 8 (- (mod count 8)))))
!                         (if (> term-width count)
!                           (progn
!                             (term-move-columns 
!                              (- count (term-current-column)))
!                             (setq term-current-column count))
!                           (when (> term-width (term-current-column))
!                             (term-move-columns 
!                              (1- (- term-width (term-current-column)))))
!                           (when (= term-width (term-current-column))
!                             (term-move-columns -1))))
                         ((eq char ?\r)
                          ;; Optimize CRLF at end of buffer:
                          (cond ((and (< (setq temp (1+ i)) str-length)
***************
*** 2768,2774 ****
                          (if (not (and term-kill-echo-list
                                        (term-check-kill-echo-list)))
                              (term-down 1 t)))
!                        ((eq char ?\b)
                          (term-move-columns -1))
                         ((eq char ?\033) ; Escape
                          (setq term-terminal-state 2))
--- 2824,2830 ----
                          (if (not (and term-kill-echo-list
                                        (term-check-kill-echo-list)))
                              (term-down 1 t)))
!                        ((eq char ?\b)  ;; (terminfo: cub1)
                          (term-move-columns -1))
                         ((eq char ?\033) ; Escape
                          (setq term-terminal-state 2))
***************
*** 2815,2834 ****
                          (term-handle-deferred-scroll)
                          (term-down 1 t)
                          (setq term-terminal-state 0))
!                        ((eq char ?M) ;; scroll reversed
!                         (term-insert-lines 1)
                          (setq term-terminal-state 0))
!                        ((eq char ?7) ;; Save cursor
                          (term-handle-deferred-scroll)
                          (setq term-saved-cursor
                                (cons (term-current-row)
                                      (term-horizontal-column)))
                          (setq term-terminal-state 0))
!                        ((eq char ?8) ;; Restore cursor
                          (if term-saved-cursor
                              (term-goto (car term-saved-cursor)
                                         (cdr term-saved-cursor)))
                          (setq term-terminal-state 0))
                         ((setq term-terminal-state 0))))
                  ((eq term-terminal-state 3) ; Seen Esc [
                   (cond ((and (>= char ?0) (<= char ?9))
--- 2871,2903 ----
                          (term-handle-deferred-scroll)
                          (term-down 1 t)
                          (setq term-terminal-state 0))
!                        ;; ((eq char ?E) ;; (terminfo: nw), not used for
!                        ;;            ;; now, but this is a working
!                        ;;            ;; implementation
!                        ;;  (term-down 1)
!                        ;;  (term-goto term-current-row 0)
!                        ;;  (setq term-terminal-state 0))
!                        ((eq char ?M) ;; scroll reversed (terminfo: ri)
!                         (term-down -1)
                          (setq term-terminal-state 0))
!                        ((eq char ?7) ;; Save cursor (terminfo: sc)
                          (term-handle-deferred-scroll)
                          (setq term-saved-cursor
                                (cons (term-current-row)
                                      (term-horizontal-column)))
                          (setq term-terminal-state 0))
!                        ((eq char ?8) ;; Restore cursor (terminfo: rc)
                          (if term-saved-cursor
                              (term-goto (car term-saved-cursor)
                                         (cdr term-saved-cursor)))
                          (setq term-terminal-state 0))
+                        ;; The \E#8 reset sequence for xterm. We
+                        ;; probably don't need to handle it, but this
+                        ;; is the code to parse it.
+                        ;; ((eq char ?#)
+                        ;;  (when (eq (aref str (1+ i)) ?8)
+                        ;;    (setq i (1+ i))
+                        ;;    (setq term-terminal-state 0)))
                         ((setq term-terminal-state 0))))
                  ((eq term-terminal-state 3) ; Seen Esc [
                   (cond ((and (>= char ?0) (<= char ?9))
***************
*** 2976,2988 ****
     ((eq parameter 8)
      (setq term-ansi-current-invisible 1))
  
! ;;; Reset reverse (i.e. terminfo rmso)
     ((eq parameter 24)
!     (setq term-ansi-current-reverse 0))
  
! ;;; Reset underline (i.e. terminfo rmul)
     ((eq parameter 27)
!     (setq term-ansi-current-underline 0))
  
  ;;; Foreground
     ((and (>= parameter 30) (<= parameter 37))
--- 3045,3057 ----
     ((eq parameter 8)
      (setq term-ansi-current-invisible 1))
  
! ;;; Reset underline (i.e. terminfo rmul)
     ((eq parameter 24)
!     (setq term-ansi-current-underline 0))
  
! ;;; Reset reverse (i.e. terminfo rmso)
     ((eq parameter 27)
!     (setq term-ansi-current-reverse 0))
  
  ;;; Foreground
     ((and (>= parameter 30) (<= parameter 37))
***************
*** 3085,3091 ****
  
  (defun term-handle-ansi-escape (proc char)
    (cond
!    ((eq char ?H) ; cursor motion
      (if (<= term-terminal-parameter 0)
        (setq term-terminal-parameter 1))
      (if (<= term-terminal-previous-parameter 0)
--- 3154,3163 ----
  
  (defun term-handle-ansi-escape (proc char)
    (cond
!    ((or (eq char ?H)  ; cursor motion (terminfo: cup)
!       ;; (eq char ?f) ; xterm seems to handle this sequence too, not
!       ;; needed for now
!       ) 
      (if (<= term-terminal-parameter 0)
        (setq term-terminal-parameter 1))
      (if (<= term-terminal-previous-parameter 0)
***************
*** 3097,3122 ****
      (term-goto
       (1- term-terminal-previous-parameter)
       (1- term-terminal-parameter)))
!    ;; \E[A - cursor up
     ((eq char ?A)
      (term-handle-deferred-scroll)
      (term-down (- (max 1 term-terminal-parameter)) t))
!    ;; \E[B - cursor down
     ((eq char ?B)
      (term-down (max 1 term-terminal-parameter) t))
!    ;; \E[C - cursor right
     ((eq char ?C)
!     (term-move-columns (max 1 term-terminal-parameter)))
!    ;; \E[D - cursor left
     ((eq char ?D)
      (term-move-columns (- (max 1 term-terminal-parameter))))
!    ;; \E[J - clear to end of screen
     ((eq char ?J)
      (term-erase-in-display term-terminal-parameter))
!    ;; \E[K - clear to end of line
     ((eq char ?K)
      (term-erase-in-line term-terminal-parameter))
!    ;; \E[L - insert lines
     ((eq char ?L)
      (term-insert-lines (max 1 term-terminal-parameter)))
     ;; \E[M - delete lines
--- 3169,3198 ----
      (term-goto
       (1- term-terminal-previous-parameter)
       (1- term-terminal-parameter)))
!    ;; \E[A - cursor up (terminfo: cuu, cuu1)
     ((eq char ?A)
      (term-handle-deferred-scroll)
      (term-down (- (max 1 term-terminal-parameter)) t))
!    ;; \E[B - cursor down (terminfo: cud)
     ((eq char ?B)
      (term-down (max 1 term-terminal-parameter) t))
!    ;; \E[C - cursor right (terminfo: cuf)
     ((eq char ?C)
!     (term-move-columns 
!      (max 1 
!         (if (>= (+ term-terminal-parameter (term-current-column)) term-width)
!             (- term-width (term-current-column)  1)
!           term-terminal-parameter))))
!    ;; \E[D - cursor left (terminfo: cub)
     ((eq char ?D)
      (term-move-columns (- (max 1 term-terminal-parameter))))
!    ;; \E[J - clear to end of screen (terminfo: ed, clear)
     ((eq char ?J)
      (term-erase-in-display term-terminal-parameter))
!    ;; \E[K - clear to end of line (terminfo: el, el1)
     ((eq char ?K)
      (term-erase-in-line term-terminal-parameter))
!    ;; \E[L - insert lines (terminfo: il, il1)
     ((eq char ?L)
      (term-insert-lines (max 1 term-terminal-parameter)))
     ;; \E[M - delete lines
***************
*** 3130,3148 ****
      (term-insert-spaces (max 1 term-terminal-parameter)))
     ;; \E[?h - DEC Private Mode Set
     ((eq char ?h)
!     (cond ((eq term-terminal-parameter 4)
           (setq term-insert-mode t))
!         ((eq term-terminal-parameter 47)
!          (term-switch-to-alternate-sub-buffer t))))
     ;; \E[?l - DEC Private Mode Reset
     ((eq char ?l)
!     (cond ((eq term-terminal-parameter 4)
           (setq term-insert-mode nil))
!         ((eq term-terminal-parameter 47)
!          (term-switch-to-alternate-sub-buffer nil))))
  
  ;;; Modified to allow ansi coloring -mm
!    ;; \E[m - Set/reset standard mode
     ((eq char ?m)
      (when (= term-terminal-more-parameters 1)
        (if (>= term-terminal-previous-parameter-4 0)
--- 3206,3227 ----
      (term-insert-spaces (max 1 term-terminal-parameter)))
     ;; \E[?h - DEC Private Mode Set
     ((eq char ?h)
!     (cond ((eq term-terminal-parameter 4)  ;; (terminfo: smir)
           (setq term-insert-mode t))
!         ;; ((eq term-terminal-parameter 47) ;; (terminfo: smcup)
!         ;; (term-switch-to-alternate-sub-buffer t))
!         ))
     ;; \E[?l - DEC Private Mode Reset
     ((eq char ?l)
!     (cond ((eq term-terminal-parameter 4)  ;; (terminfo: rmir)
           (setq term-insert-mode nil))
!         ;; ((eq term-terminal-parameter 47) ;; (terminfo: rmcup)
!         ;; (term-switch-to-alternate-sub-buffer nil))
!         ))
  
  ;;; Modified to allow ansi coloring -mm
!    ;; \E[m - Set/reset modes, set bg/fg 
!    ;;(terminfo: smso,rmso,smul,rmul,rev,bold,sgr0,invis,op,setab,setaf)
     ((eq char ?m)
      (when (= term-terminal-more-parameters 1)
        (if (>= term-terminal-previous-parameter-4 0)
***************
*** 3162,3168 ****
                                 (1+ (term-current-row))
                                 (1+ (term-horizontal-column)))))
     ;; \E[r - Set scrolling region
!    ((eq char ?r)
      (term-scroll-region
       (1- term-terminal-previous-parameter)
       term-terminal-parameter))
--- 3241,3247 ----
                                 (1+ (term-current-row))
                                 (1+ (term-horizontal-column)))))
     ;; \E[r - Set scrolling region
!    ((eq char ?r) ;; (terminfo: csr)
      (term-scroll-region
       (1- term-terminal-previous-parameter)
       term-terminal-parameter))
***************
*** 3184,3217 ****
    (setq term-scroll-with-delete
        (or (term-using-alternate-sub-buffer)
            (not (and (= term-scroll-start 0)
!                     (= term-scroll-end term-height))))))
! 
! (defun term-switch-to-alternate-sub-buffer (set)
!   ;; If asked to switch to (from) the alternate sub-buffer, and already (not)
!   ;; using it, do nothing.  This test is needed for some programs (including
!   ;; Emacs) that emit the ti termcap string twice, for unknown reason.
!   (term-handle-deferred-scroll)
!   (if (eq set (not (term-using-alternate-sub-buffer)))
!       (let ((row (term-current-row))
!           (col (term-horizontal-column)))
!       (cond (set
!              (goto-char (point-max))
!              (if (not (eq (preceding-char) ?\n))
!                  (term-insert-char ?\n 1))
!              (setq term-scroll-with-delete t)
!              (setq term-saved-home-marker (copy-marker term-home-marker))
!              (set-marker term-home-marker (point)))
!             (t
!              (setq term-scroll-with-delete
!                    (not (and (= term-scroll-start 0)
!                              (= term-scroll-end term-height))))
!              (set-marker term-home-marker term-saved-home-marker)
!              (set-marker term-saved-home-marker nil)
!              (setq term-saved-home-marker nil)
!              (goto-char term-home-marker)))
!       (setq term-current-column nil)
!       (setq term-current-row 0)
!       (term-goto row col))))
  
  ;; Default value for the symbol term-command-hook.
  
--- 3263,3299 ----
    (setq term-scroll-with-delete
        (or (term-using-alternate-sub-buffer)
            (not (and (= term-scroll-start 0)
!                     (= term-scroll-end term-height)))))
!   (term-move-columns (- (term-current-column)))
!   (term-goto 
!    term-scroll-start (term-current-column)))
! 
! ;; (defun term-switch-to-alternate-sub-buffer (set)
! ;;   ;; If asked to switch to (from) the alternate sub-buffer, and already 
(not)
! ;;   ;; using it, do nothing.  This test is needed for some programs 
(including
! ;;   ;; Emacs) that emit the ti termcap string twice, for unknown reason.
! ;;   (term-handle-deferred-scroll)
! ;;   (if (eq set (not (term-using-alternate-sub-buffer)))
! ;;       (let ((row (term-current-row))
! ;;        (col (term-horizontal-column)))
! ;;    (cond (set
! ;;           (goto-char (point-max))
! ;;           (if (not (eq (preceding-char) ?\n))
! ;;               (term-insert-char ?\n 1))
! ;;           (setq term-scroll-with-delete t)
! ;;           (setq term-saved-home-marker (copy-marker term-home-marker))
! ;;           (set-marker term-home-marker (point)))
! ;;          (t
! ;;           (setq term-scroll-with-delete
! ;;                 (not (and (= term-scroll-start 0)
! ;;                           (= term-scroll-end term-height))))
! ;;           (set-marker term-home-marker term-saved-home-marker)
! ;;           (set-marker term-saved-home-marker nil)
! ;;           (setq term-saved-home-marker nil)
! ;;           (goto-char term-home-marker)))
! ;;    (setq term-current-column nil)
! ;;    (setq term-current-row 0)
! ;;    (term-goto row col))))
  
  ;; Default value for the symbol term-command-hook.
  
***************
*** 3521,3531 ****
    (if (not (bolp)) (insert-before-markers ?\n)))
  
  (defun term-erase-in-line (kind)
!   (if (> kind 1) ;; erase left of point
        (let ((cols (term-horizontal-column)) (saved-point (point)))
        (term-vertical-motion 0)
        (delete-region (point) saved-point)
!       (term-insert-char ?\n cols)))
    (if (not (eq kind 1)) ;; erase right of point
        (let ((saved-point (point))
            (wrapped (and (zerop (term-horizontal-column))
--- 3603,3613 ----
    (if (not (bolp)) (insert-before-markers ?\n)))
  
  (defun term-erase-in-line (kind)
!   (if (= kind 1) ;; erase left of point
        (let ((cols (term-horizontal-column)) (saved-point (point)))
        (term-vertical-motion 0)
        (delete-region (point) saved-point)
!       (term-insert-char ?  cols)))
    (if (not (eq kind 1)) ;; erase right of point
        (let ((saved-point (point))
            (wrapped (and (zerop (term-horizontal-column))
***************
*** 3562,3569 ****
              (end-region (if (eq kind 1) (point) (point-max))))
           (delete-region start-region end-region)
           (term-unwrap-line)
!          (if (eq kind 1)
!              (term-insert-char ?\n row))
           (setq term-current-column nil)
           (setq term-current-row nil)
           (term-goto row col)))))
--- 3644,3651 ----
              (end-region (if (eq kind 1) (point) (point-max))))
           (delete-region start-region end-region)
           (term-unwrap-line)
!          (when (eq kind 1)
!            (term-insert-char ?\n row))
           (setq term-current-column nil)
           (setq term-current-row nil)
           (term-goto row col)))))
***************
*** 3624,3630 ****
      (term-insert-char ?\n lines)
      (goto-char start)))
  
! (defun term-set-output-log (name)
    "Record raw inferior process output in a buffer."
    (interactive (list (if term-log-buffer
                         nil
--- 3706,3712 ----
      (term-insert-char ?\n lines)
      (goto-char start)))
  
! (defun term-start-output-log (name)
    "Record raw inferior process output in a buffer."
    (interactive (list (if term-log-buffer
                         nil
***************
*** 3646,3655 ****
      (message "Recording terminal emulator output into buffer \"%s\""
             (buffer-name term-log-buffer))))
  
! (defun term-stop-photo ()
    "Discontinue raw inferior process logging."
    (interactive)
!   (term-set-output-log nil))
  
  (defun term-show-maximum-output ()
    "Put the end of the buffer at the bottom of the window."
--- 3728,3737 ----
      (message "Recording terminal emulator output into buffer \"%s\""
             (buffer-name term-log-buffer))))
  
! (defun term-stop-output-log ()
    "Discontinue raw inferior process logging."
    (interactive)
!   (term-start-output-log nil))
  
  (defun term-show-maximum-output ()
    "Put the end of the buffer at the bottom of the window."




reply via email to

[Prev in Thread] Current Thread [Next in Thread]