Mercurial > emacs
comparison lisp/term.el @ 83310:e58cb448e07c
Merged from miles@gnu.org--gnu-2005 (patch 80-82, 350-422)
Patches applied:
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-350
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-351
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-352
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-353
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-354
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-355
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-356
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-357
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-358
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-359
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-360
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-361
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-362
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-363
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-364
Remove "-face" suffix from widget faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Remove "-face" suffix from custom faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Remove "-face" suffix from change-log faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-367
Remove "-face" suffix from compilation faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-368
Remove "-face" suffix from diff-mode faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-369
lisp/longlines.el (longlines-visible-face): Face removed
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-370
Remove "-face" suffix from woman faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-371
Remove "-face" suffix from whitespace-highlight face
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Remove "-face" suffix from ruler-mode faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-373
Remove "-face" suffix from show-paren faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-374
Remove "-face" suffix from log-view faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-375
Remove "-face" suffix from smerge faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-376
Remove "-face" suffix from show-tabs faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-377
Remove "-face" suffix from highlight-changes faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-378
Remove "-face" suffix from and downcase info faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-379
Remove "-face" suffix from pcvs faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-380
Update uses of renamed pcvs faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-381
Tweak ChangeLog
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-382
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-383
Remove "-face" suffix from strokes-char face
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-384
Remove "-face" suffix from compare-windows face
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-385
Remove "-face" suffix from calendar faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-386
Remove "-face" suffix from diary-button face
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-387
Remove "-face" suffix from testcover faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-388
Remove "-face" suffix from viper faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Remove "-face" suffix from org faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-390
Remove "-face" suffix from sgml-namespace face
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-391
Remove "-face" suffix from table-cell face
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-392
Remove "-face" suffix from tex-mode faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-393
Remove "-face" suffix from texinfo-heading face
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-394
Remove "-face" suffix from flyspell faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-395
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-396
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-397
Remove "-face" suffix from gomoku faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-398
Remove "-face" suffix from mpuz faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-399
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-400
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-401
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-402
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-403
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-404
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-405
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-406
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-407
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-408
Remove "-face" suffix from Buffer-menu-buffer face
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-409
Remove "-face" suffix from antlr-mode faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-410
Remove "-face" suffix from ebrowse faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-411
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-412
Remove "-face" suffix from flymake faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-413
Remove "-face" suffix from idlwave faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-414
Remove "-face" suffix from sh-script faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-415
Remove "-face" suffix from vhdl-mode faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-416
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-417
Remove "-face" suffix from which-func face
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-418
Remove "-face" suffix from cperl-mode faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-419
Remove "-face" suffix from ld-script faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-420
Fix cperl-mode font-lock problem
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-421
Tweak which-func face
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-422
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-80
Merge from emacs--cvs-trunk--0
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-81
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-82
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-350
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Wed, 15 Jun 2005 12:57:51 +0000 |
parents | 7a34bd511117 |
children | 8890da0e9393 a1b34dec1104 |
comparison
equal
deleted
inserted
replaced
83309:6aee1e9b0bd7 | 83310:e58cb448e07c |
---|---|
595 | 595 |
596 (defvar term-input-sender (function term-simple-send) | 596 (defvar term-input-sender (function term-simple-send) |
597 "Function to actually send to PROCESS the STRING submitted by user. | 597 "Function to actually send to PROCESS the STRING submitted by user. |
598 Usually this is just 'term-simple-send, but if your mode needs to | 598 Usually this is just 'term-simple-send, but if your mode needs to |
599 massage the input string, this is your hook. This is called from | 599 massage the input string, this is your hook. This is called from |
600 the user command term-send-input. term-simple-send just sends | 600 the user command term-send-input. `term-simple-send' just sends |
601 the string plus a newline.") | 601 the string plus a newline.") |
602 | 602 |
603 (defcustom term-eol-on-send t | 603 (defcustom term-eol-on-send t |
604 "*Non-nil means go to the end of the line before sending input. | 604 "*Non-nil means go to the end of the line before sending input. |
605 See `term-send-input'." | 605 See `term-send-input'." |
886 (esc-map (make-keymap)) | 886 (esc-map (make-keymap)) |
887 (i 0)) | 887 (i 0)) |
888 (while (< i 128) | 888 (while (< i 128) |
889 (define-key map (make-string 1 i) 'term-send-raw) | 889 (define-key map (make-string 1 i) 'term-send-raw) |
890 ;; Avoid O and [. They are used in escape sequences for various keys. | 890 ;; Avoid O and [. They are used in escape sequences for various keys. |
891 (unless (or (eq i ?O) (eq i 91)) | 891 (unless (or (eq i ?O) (eq i 91)) |
892 (define-key esc-map (make-string 1 i) 'term-send-raw-meta)) | 892 (define-key esc-map (make-string 1 i) 'term-send-raw-meta)) |
893 (setq i (1+ i))) | 893 (setq i (1+ i))) |
894 (dolist (elm (generic-character-list)) | 894 (dolist (elm (generic-character-list)) |
895 (define-key map (vector elm) 'term-send-raw)) | 895 (define-key map (vector elm) 'term-send-raw)) |
896 (define-key map "\e" esc-map) | 896 (define-key map "\e" esc-map) |
939 (defvar term-display-table | 939 (defvar term-display-table |
940 (let ((dt (or (copy-sequence standard-display-table) | 940 (let ((dt (or (copy-sequence standard-display-table) |
941 (make-display-table))) | 941 (make-display-table))) |
942 i) | 942 i) |
943 ;; avoid changing the display table for ^J | 943 ;; avoid changing the display table for ^J |
944 (setq i 0) | 944 (setq i 0) |
945 (while (< i 10) | 945 (while (< i 10) |
946 (aset dt i (vector i)) | 946 (aset dt i (vector i)) |
947 (setq i (1+ i))) | 947 (setq i (1+ i))) |
948 (setq i 11) | 948 (setq i 11) |
949 (while (< i 32) | 949 (while (< i 32) |
950 (aset dt i (vector i)) | 950 (aset dt i (vector i)) |
951 (setq i (1+ i))) | 951 (setq i (1+ i))) |
952 (setq i 128) | 952 (setq i 128) |
953 (while (< i 256) | 953 (while (< i 256) |
981 and `term-scroll-to-bottom-on-output'. | 981 and `term-scroll-to-bottom-on-output'. |
982 | 982 |
983 If you accidentally suspend your process, use \\[term-continue-subjob] | 983 If you accidentally suspend your process, use \\[term-continue-subjob] |
984 to continue it. | 984 to continue it. |
985 | 985 |
986 This mode can be customised to create specific modes for running | 986 This mode can be customized to create specific modes for running |
987 particular subprocesses. This can be done by setting the hooks | 987 particular subprocesses. This can be done by setting the hooks |
988 `term-input-filter-functions', `term-input-filter', | 988 `term-input-filter-functions', `term-input-filter', |
989 `term-input-sender' and `term-get-old-input' to appropriate functions, | 989 `term-input-sender' and `term-get-old-input' to appropriate functions, |
990 and the variable `term-prompt-regexp' to the appropriate regular | 990 and the variable `term-prompt-regexp' to the appropriate regular |
991 expression. | 991 expression. |
1271 (force-mode-line-update)) | 1271 (force-mode-line-update)) |
1272 | 1272 |
1273 (defun term-check-proc (buffer) | 1273 (defun term-check-proc (buffer) |
1274 "True if there is a process associated w/buffer BUFFER, and | 1274 "True if there is a process associated w/buffer BUFFER, and |
1275 it is alive (status RUN or STOP). BUFFER can be either a buffer or the | 1275 it is alive (status RUN or STOP). BUFFER can be either a buffer or the |
1276 name of one" | 1276 name of one." |
1277 (let ((proc (get-buffer-process buffer))) | 1277 (let ((proc (get-buffer-process buffer))) |
1278 (and proc (memq (process-status proc) '(run stop))))) | 1278 (and proc (memq (process-status proc) '(run stop))))) |
1279 | 1279 |
1280 ;;;###autoload | 1280 ;;;###autoload |
1281 (defun make-term (name program &optional startfile &rest switches) | 1281 (defun make-term (name program &optional startfile &rest switches) |
2086 (<= proc-pos (point)))) | 2086 (<= proc-pos (point)))) |
2087 | 2087 |
2088 (defun term-simple-send (proc string) | 2088 (defun term-simple-send (proc string) |
2089 "Default function for sending to PROC input STRING. | 2089 "Default function for sending to PROC input STRING. |
2090 This just sends STRING plus a newline. To override this, | 2090 This just sends STRING plus a newline. To override this, |
2091 set the hook TERM-INPUT-SENDER." | 2091 set the hook `term-input-sender'." |
2092 (term-send-string proc string) | 2092 (term-send-string proc string) |
2093 (term-send-string proc "\n")) | 2093 (term-send-string proc "\n")) |
2094 | 2094 |
2095 (defun term-bol (arg) | 2095 (defun term-bol (arg) |
2096 "Goes to the beginning of line, then skips past the prompt, if any. | 2096 "Goes to the beginning of line, then skips past the prompt, if any. |
2178 (defvar term-input-chunk-size 512 | 2178 (defvar term-input-chunk-size 512 |
2179 "*Long inputs send to term processes are broken up into chunks of this size. | 2179 "*Long inputs send to term processes are broken up into chunks of this size. |
2180 If your process is choking on big inputs, try lowering the value.") | 2180 If your process is choking on big inputs, try lowering the value.") |
2181 | 2181 |
2182 (defun term-send-string (proc str) | 2182 (defun term-send-string (proc str) |
2183 "Send PROCESS the contents of STRING as input. | 2183 "Send to PROC the contents of STR as input. |
2184 This is equivalent to process-send-string, except that long input strings | 2184 This is equivalent to process-send-string, except that long input strings |
2185 are broken up into chunks of size term-input-chunk-size. Processes | 2185 are broken up into chunks of size term-input-chunk-size. Processes |
2186 are given a chance to output between chunks. This can help prevent processes | 2186 are given a chance to output between chunks. This can help prevent processes |
2187 from hanging when you send them long inputs on some OS's." | 2187 from hanging when you send them long inputs on some OS's." |
2188 (let* ((len (length str)) | 2188 (let* ((len (length str)) |
2193 (accept-process-output) | 2193 (accept-process-output) |
2194 (process-send-string proc (substring str i (min len next-i))) | 2194 (process-send-string proc (substring str i (min len next-i))) |
2195 (setq i next-i))))) | 2195 (setq i next-i))))) |
2196 | 2196 |
2197 (defun term-send-region (proc start end) | 2197 (defun term-send-region (proc start end) |
2198 "Sends to PROC the region delimited by START and END. | 2198 "Send to PROC the region delimited by START and END. |
2199 This is a replacement for process-send-region that tries to keep | 2199 This is a replacement for process-send-region that tries to keep |
2200 your process from hanging on long inputs. See term-send-string." | 2200 your process from hanging on long inputs. See `term-send-string'." |
2201 (term-send-string proc (buffer-substring start end))) | 2201 (term-send-string proc (buffer-substring start end))) |
2202 | 2202 |
2203 | 2203 |
2204 ;;; Random input hackage | 2204 ;;; Random input hackage |
2205 | 2205 |
2425 ;;; '(lisp-mode) t)) | 2425 ;;; '(lisp-mode) t)) |
2426 | 2426 |
2427 ;;; This is pretty stupid about strings. It decides we're in a string | 2427 ;;; This is pretty stupid about strings. It decides we're in a string |
2428 ;;; if there's a quote on both sides of point on the current line. | 2428 ;;; if there's a quote on both sides of point on the current line. |
2429 (defun term-extract-string () | 2429 (defun term-extract-string () |
2430 "Returns string around POINT that starts the current line or nil." | 2430 "Return string around `point' that starts the current line or nil." |
2431 (save-excursion | 2431 (save-excursion |
2432 (let* ((point (point)) | 2432 (let* ((point (point)) |
2433 (bol (progn (beginning-of-line) (point))) | 2433 (bol (progn (beginning-of-line) (point))) |
2434 (eol (progn (end-of-line) (point))) | 2434 (eol (progn (end-of-line) (point))) |
2435 (start (progn (goto-char point) | 2435 (start (progn (goto-char point) |
2599 (narrow-to-region term-home-marker (point-max)) | 2599 (narrow-to-region term-home-marker (point-max)) |
2600 (- (term-vertical-motion -9999)))))))) | 2600 (- (term-vertical-motion -9999)))))))) |
2601 | 2601 |
2602 (defun term-adjust-current-row-cache (delta) | 2602 (defun term-adjust-current-row-cache (delta) |
2603 (when term-current-row | 2603 (when term-current-row |
2604 (setq term-current-row | 2604 (setq term-current-row |
2605 (max 0 (+ term-current-row delta))))) | 2605 (max 0 (+ term-current-row delta))))) |
2606 | 2606 |
2607 (defun term-terminal-pos () | 2607 (defun term-terminal-pos () |
2608 (save-excursion ; save-restriction | 2608 (save-excursion ; save-restriction |
2609 (let ((save-col (term-current-column)) | 2609 (let ((save-col (term-current-column)) |
2779 (term-move-columns columns) | 2779 (term-move-columns columns) |
2780 (delete-region pos (point))) | 2780 (delete-region pos (point))) |
2781 ;; In insert if the if the current line | 2781 ;; In insert if the if the current line |
2782 ;; has become too long it needs to be | 2782 ;; has become too long it needs to be |
2783 ;; chopped off. | 2783 ;; chopped off. |
2784 (when term-insert-mode | 2784 (when term-insert-mode |
2785 (setq pos (point)) | 2785 (setq pos (point)) |
2786 (end-of-line) | 2786 (end-of-line) |
2787 (when (> (current-column) term-width) | 2787 (when (> (current-column) term-width) |
2788 (delete-region (- (point) (- (current-column) term-width)) | 2788 (delete-region (- (point) (- (current-column) term-width)) |
2789 (point))) | 2789 (point))) |
2790 (goto-char pos))) | 2790 (goto-char pos))) |
2791 (setq term-current-column nil) | 2791 (setq term-current-column nil) |
2792 | 2792 |
2793 (put-text-property old-point (point) | 2793 (put-text-property old-point (point) |
2802 ((and (setq term-terminal-state 0) | 2802 ((and (setq term-terminal-state 0) |
2803 (eq char ?\^I)) ; TAB (terminfo: ht) | 2803 (eq char ?\^I)) ; TAB (terminfo: ht) |
2804 (setq count (term-current-column)) | 2804 (setq count (term-current-column)) |
2805 ;; The line cannot exceed term-width. TAB at | 2805 ;; The line cannot exceed term-width. TAB at |
2806 ;; the end of a line should not cause wrapping. | 2806 ;; the end of a line should not cause wrapping. |
2807 (setq count (min term-width | 2807 (setq count (min term-width |
2808 (+ count 8 (- (mod count 8))))) | 2808 (+ count 8 (- (mod count 8))))) |
2809 (if (> term-width count) | 2809 (if (> term-width count) |
2810 (progn | 2810 (progn |
2811 (term-move-columns | 2811 (term-move-columns |
2812 (- count (term-current-column))) | 2812 (- count (term-current-column))) |
2813 (setq term-current-column count)) | 2813 (setq term-current-column count)) |
2814 (when (> term-width (term-current-column)) | 2814 (when (> term-width (term-current-column)) |
2815 (term-move-columns | 2815 (term-move-columns |
2816 (1- (- term-width (term-current-column))))) | 2816 (1- (- term-width (term-current-column))))) |
2817 (when (= term-width (term-current-column)) | 2817 (when (= term-width (term-current-column)) |
2818 (term-move-columns -1)))) | 2818 (term-move-columns -1)))) |
2819 ((eq char ?\r) | 2819 ((eq char ?\r) |
2820 ;; Optimize CRLF at end of buffer: | 2820 ;; Optimize CRLF at end of buffer: |
2901 ((eq char ?8) ;; Restore cursor (terminfo: rc) | 2901 ((eq char ?8) ;; Restore cursor (terminfo: rc) |
2902 (if term-saved-cursor | 2902 (if term-saved-cursor |
2903 (term-goto (car term-saved-cursor) | 2903 (term-goto (car term-saved-cursor) |
2904 (cdr term-saved-cursor))) | 2904 (cdr term-saved-cursor))) |
2905 (setq term-terminal-state 0)) | 2905 (setq term-terminal-state 0)) |
2906 ((eq char ?c) ;; \Ec - Reset (terminfo: rs1) | 2906 ((eq char ?c) ;; \Ec - Reset (terminfo: rs1) |
2907 ;; This is used by the "clear" program. | 2907 ;; This is used by the "clear" program. |
2908 (setq term-terminal-state 0) | 2908 (setq term-terminal-state 0) |
2909 (term-reset-terminal)) | 2909 (term-reset-terminal)) |
2910 ;; The \E#8 reset sequence for xterm. We | 2910 ;; The \E#8 reset sequence for xterm. We |
2911 ;; probably don't need to handle it, but this | 2911 ;; probably don't need to handle it, but this |
3033 (term-vertical-motion (1+ count)) | 3033 (term-vertical-motion (1+ count)) |
3034 (set-marker term-home-marker (point)) | 3034 (set-marker term-home-marker (point)) |
3035 (setq term-current-row (1- term-height)))))) | 3035 (setq term-current-row (1- term-height)))))) |
3036 | 3036 |
3037 ;;; Reset the terminal, delete all the content and set the face to the | 3037 ;;; Reset the terminal, delete all the content and set the face to the |
3038 ;;; default one. | 3038 ;;; default one. |
3039 (defun term-reset-terminal () | 3039 (defun term-reset-terminal () |
3040 (erase-buffer) | 3040 (erase-buffer) |
3041 (setq term-current-row 0) | 3041 (setq term-current-row 0) |
3042 (setq term-current-column 1) | 3042 (setq term-current-column 1) |
3043 (setq term-insert-mode nil) | 3043 (setq term-insert-mode nil) |
3187 (defun term-handle-ansi-escape (proc char) | 3187 (defun term-handle-ansi-escape (proc char) |
3188 (cond | 3188 (cond |
3189 ((or (eq char ?H) ; cursor motion (terminfo: cup) | 3189 ((or (eq char ?H) ; cursor motion (terminfo: cup) |
3190 ;; (eq char ?f) ; xterm seems to handle this sequence too, not | 3190 ;; (eq char ?f) ; xterm seems to handle this sequence too, not |
3191 ;; needed for now | 3191 ;; needed for now |
3192 ) | 3192 ) |
3193 (if (<= term-terminal-parameter 0) | 3193 (if (<= term-terminal-parameter 0) |
3194 (setq term-terminal-parameter 1)) | 3194 (setq term-terminal-parameter 1)) |
3195 (if (<= term-terminal-previous-parameter 0) | 3195 (if (<= term-terminal-previous-parameter 0) |
3196 (setq term-terminal-previous-parameter 1)) | 3196 (setq term-terminal-previous-parameter 1)) |
3197 (if (> term-terminal-previous-parameter term-height) | 3197 (if (> term-terminal-previous-parameter term-height) |
3208 ;; \E[B - cursor down (terminfo: cud) | 3208 ;; \E[B - cursor down (terminfo: cud) |
3209 ((eq char ?B) | 3209 ((eq char ?B) |
3210 (term-down (max 1 term-terminal-parameter) t)) | 3210 (term-down (max 1 term-terminal-parameter) t)) |
3211 ;; \E[C - cursor right (terminfo: cuf) | 3211 ;; \E[C - cursor right (terminfo: cuf) |
3212 ((eq char ?C) | 3212 ((eq char ?C) |
3213 (term-move-columns | 3213 (term-move-columns |
3214 (max 1 | 3214 (max 1 |
3215 (if (>= (+ term-terminal-parameter (term-current-column)) term-width) | 3215 (if (>= (+ term-terminal-parameter (term-current-column)) term-width) |
3216 (- term-width (term-current-column) 1) | 3216 (- term-width (term-current-column) 1) |
3217 term-terminal-parameter)))) | 3217 term-terminal-parameter)))) |
3218 ;; \E[D - cursor left (terminfo: cub) | 3218 ;; \E[D - cursor left (terminfo: cub) |
3219 ((eq char ?D) | 3219 ((eq char ?D) |
3250 ;; ((eq term-terminal-parameter 47) ;; (terminfo: rmcup) | 3250 ;; ((eq term-terminal-parameter 47) ;; (terminfo: rmcup) |
3251 ;; (term-switch-to-alternate-sub-buffer nil)) | 3251 ;; (term-switch-to-alternate-sub-buffer nil)) |
3252 )) | 3252 )) |
3253 | 3253 |
3254 ;;; Modified to allow ansi coloring -mm | 3254 ;;; Modified to allow ansi coloring -mm |
3255 ;; \E[m - Set/reset modes, set bg/fg | 3255 ;; \E[m - Set/reset modes, set bg/fg |
3256 ;;(terminfo: smso,rmso,smul,rmul,rev,bold,sgr0,invis,op,setab,setaf) | 3256 ;;(terminfo: smso,rmso,smul,rmul,rev,bold,sgr0,invis,op,setab,setaf) |
3257 ((eq char ?m) | 3257 ((eq char ?m) |
3258 (when (= term-terminal-more-parameters 1) | 3258 (when (= term-terminal-more-parameters 1) |
3259 (if (>= term-terminal-previous-parameter-4 0) | 3259 (if (>= term-terminal-previous-parameter-4 0) |
3260 (term-handle-colors-array term-terminal-previous-parameter-4)) | 3260 (term-handle-colors-array term-terminal-previous-parameter-4)) |
3295 (setq term-scroll-with-delete | 3295 (setq term-scroll-with-delete |
3296 (or (term-using-alternate-sub-buffer) | 3296 (or (term-using-alternate-sub-buffer) |
3297 (not (and (= term-scroll-start 0) | 3297 (not (and (= term-scroll-start 0) |
3298 (= term-scroll-end term-height))))) | 3298 (= term-scroll-end term-height))))) |
3299 (term-move-columns (- (term-current-column))) | 3299 (term-move-columns (- (term-current-column))) |
3300 (term-goto | 3300 (term-goto |
3301 term-scroll-start (term-current-column))) | 3301 term-scroll-start (term-current-column))) |
3302 | 3302 |
3303 ;; (defun term-switch-to-alternate-sub-buffer (set) | 3303 ;; (defun term-switch-to-alternate-sub-buffer (set) |
3304 ;; ;; If asked to switch to (from) the alternate sub-buffer, and already (not) | 3304 ;; ;; If asked to switch to (from) the alternate sub-buffer, and already (not) |
3305 ;; ;; using it, do nothing. This test is needed for some programs (including | 3305 ;; ;; using it, do nothing. This test is needed for some programs (including |
3844 (concat term-file-name-prefix directory) | 3844 (concat term-file-name-prefix directory) |
3845 directory))) | 3845 directory))) |
3846 | 3846 |
3847 | 3847 |
3848 (defun term-word (word-chars) | 3848 (defun term-word (word-chars) |
3849 "Return the word of WORD-CHARS at point, or nil if non is found. | 3849 "Return the word of WORD-CHARS at point, or nil if none is found. |
3850 Word constituents are considered to be those in WORD-CHARS, which is like the | 3850 Word constituents are considered to be those in WORD-CHARS, which is like the |
3851 inside of a \"[...]\" (see `skip-chars-forward')." | 3851 inside of a \"[...]\" (see `skip-chars-forward')." |
3852 (save-excursion | 3852 (save-excursion |
3853 (let ((limit (point)) | 3853 (let ((limit (point)) |
3854 (word (concat "[" word-chars "]")) | 3854 (word (concat "[" word-chars "]")) |
3861 (re-search-forward (concat word "+") limit) | 3861 (re-search-forward (concat word "+") limit) |
3862 (buffer-substring (match-beginning 0) (match-end 0)))))) | 3862 (buffer-substring (match-beginning 0) (match-end 0)))))) |
3863 | 3863 |
3864 | 3864 |
3865 (defun term-match-partial-filename () | 3865 (defun term-match-partial-filename () |
3866 "Return the filename at point, or nil if non is found. | 3866 "Return the filename at point, or nil if none is found. |
3867 Environment variables are substituted. See `term-word'." | 3867 Environment variables are substituted. See `term-word'." |
3868 (let ((filename (term-word "~/A-Za-z0-9+@:_.$#,={}-"))) | 3868 (let ((filename (term-word "~/A-Za-z0-9+@:_.$#,={}-"))) |
3869 (and filename (substitute-in-file-name filename)))) | 3869 (and filename (substitute-in-file-name filename)))) |
3870 | 3870 |
3871 | 3871 |