BBS水木清华站∶精华区

发信人: althea (稻草人), 信区: Linux        
标  题: Emacs里面上BBS (term.el的patch) 
发信站: BBS 水木清华站 (Wed Dec 27 05:33:33 2000) 
 
/usr/local/share/emacs/21.0.91/lisp/term.el /tmp/ange-ftp13433i2d   
/usr/local/share/emacs/21.0.91/lisp/term.el                        
--- /pact@162.105.30.51:/usr/local/share/emacs/21.0.91/lisp/term.el 
+++ /usr/local/share/emacs/21.0.91/lisp/term.el                     
@@ -1277,7 +1277,7 @@                           
 intervention from Emacs, except for the escape character (usually C-c)." 
   (interactive)                                                          
   (if (not term-raw-map) 
-      (let* ((map (make-keymap)) 
+      (let* ((map (list 'keymap (make-char-table 'keymap 'term-send-raw))) 
             (esc-map (make-keymap))                                        
             (i 0))                  
        (while (< i 128) 
@@ -2607,7 +2607,7 @@    
 ;;; Move DELTA column right (or left if delta < 0). 
                                                     
 (defun term-move-columns (delta) 
-  (setq term-current-column (+ (term-current-column) delta)) 
+  (setq term-current-column (max 0 (+ (term-current-column) delta))) 
   (move-to-column term-current-column t))                            
                                           
 ;; Insert COUNT copies of CHAR in the default face. 
@@ -2704,6 +2704,7 @@                                
 (defun term-emulate-terminal (proc str) 
   (let* ((previous-buffer (current-buffer)) 
         (i 0) char funny count save-point save-marker old-point temp win 
+        old-column delete-begin-point                                    
         (selected (selected-window))  
         last-win                     
         (str-length (length str))) 
@@ -2784,21 +2785,31 @@             
                                   (setq term-current-column nil) 
                                   (setq term-start-line-column nil))) 
                            (setq old-point (point))                   
+                           (setq old-column (current-column)) 
                            ;; In the common case that we're at the end of 
                            ;; the buffer, we can save a little work.      
-                           (cond ((/= (point) (point-max))           
-                                  (if term-insert-mode     
-                                      ;; Inserting spaces, then deleting them, 
-                                      ;; then inserting the actual text is 
-                                      ;; inefficient, but it is simple, and 
-                                      ;; the actual overhead is miniscule.  
-                                      (term-insert-spaces count))          
-                                  (term-move-columns count)       
-                                  (delete-region old-point (point))) 
-       (t (setq term-current-column (+ (term-current-column) count)))) 
+                           ;;(cond ((/= (point) (point-max))           
+                           ;;     (if term-insert-mode       
+                           ;;         ;; Inserting spaces, then deleting them, 
+                           ;;         ;; then inserting the actual text is 
+                           ;;         ;; inefficient, but it is simple, and 
+                           ;;         ;; the actual overhead is miniscule.  
+                           ;;         (term-insert-spaces count))          
+                           ;;     (term-move-columns count)       
+                           ;;     (delete-region old-point (point))) 
+       ;;(t (setq term-current-column (+ (term-current-column) count)))) 
+                           (setq term-current-column nil)                
                            (insert (substring str i funny)) 
+                           (cond ((and (/= (point) (point-max))  
+                                       (not term-insert-mode)) 
+                                  (setq delete-begin-point (point)) 
+                                  (term-move-columns (- (current-column) old-column)) 
+                                  (delete-region delete-begin-point (point)))) 
+                           (setq term-current-column nil) 
+                                                          
+                           ;(if (<= old-point (point)) 
                            (put-text-property old-point (point) 
                                               'face term-current-face) 
+                           ;  )                                        
                            ;; If the last char was written in last column, 
                            ;; back up one column, but remember we did so.  
                            ;; Thus we emulate xterm/vt100-style line-wrapping. 
 
 
-- 
Look Ma, this man can twist his fingers as if they were made of rubber, 
isn't that amazing? -- Not really, he's been using emacs for years...! 
 
 
※ 修改:·althea 於 Dec 28 11:56:34 修改本文·[FROM:   162.105.30.51] 
※ 来源:·BBS 水木清华站 smth.org·[FROM: 162.105.203.100] 

BBS水木清华站∶精华区