comparison lisp/flow-ctrl.el @ 1855:80c1064620a8

(enable-flow-control...): Renamed from evade... (enable-flow-control): Add autoload.
author Richard M. Stallman <rms@gnu.org>
date Thu, 11 Feb 1993 23:32:07 +0000
parents 94f7516ccdc1
children ba185131c3e8
comparison
equal deleted inserted replaced
1854:5a18c36181fa 1855:80c1064620a8
30 ;;;; GNU Emacs users. This file contains Emacs Lisp code that makes it 30 ;;;; GNU Emacs users. This file contains Emacs Lisp code that makes it
31 ;;;; easy for a user to deal with this problem, when using such a 31 ;;;; easy for a user to deal with this problem, when using such a
32 ;;;; terminal. 32 ;;;; terminal.
33 ;;;; 33 ;;;;
34 ;;;; To invoke these adjustments, a user need only invoke the function 34 ;;;; To invoke these adjustments, a user need only invoke the function
35 ;;;; evade-flow-control-on with a list of terminal types in his/her own 35 ;;;; enable-flow-control-on with a list of terminal types in his/her own
36 ;;;; .emacs file. As arguments, give it the names of one or more terminal 36 ;;;; .emacs file. As arguments, give it the names of one or more terminal
37 ;;;; types in use by that user which require flow control adjustments. 37 ;;;; types in use by that user which require flow control adjustments.
38 ;;;; Here's an example: 38 ;;;; Here's an example:
39 ;;;; 39 ;;;;
40 ;;;; (evade-flow-control-on "vt200" "vt300" "vt101" "vt131") 40 ;;;; (enable-flow-control-on "vt200" "vt300" "vt101" "vt131")
41 41
42 ;;; Portability note: This uses (getenv "TERM"), and therefore probably 42 ;;; Portability note: This uses (getenv "TERM"), and therefore probably
43 ;;; won't work outside of UNIX-like environments. 43 ;;; won't work outside of UNIX-like environments.
44 44
45 ;;; Code: 45 ;;; Code:
46 46
47 (defun evade-flow-control () 47 ;;;###autoload
48 (defun enable-flow-control ()
48 "Enable use of flow control; let user type C-s as C-\ and C-q as C-^." 49 "Enable use of flow control; let user type C-s as C-\ and C-q as C-^."
49 (interactive) 50 (interactive)
50 ;; Tell emacs to pass C-s and C-q to OS. 51 ;; Tell emacs to pass C-s and C-q to OS.
51 (set-input-mode nil t nil) 52 (set-input-mode nil t nil)
52 ;; Initialize translate table, saving previous mappings, if any. 53 ;; Initialize translate table, saving previous mappings, if any.
70 "XON/XOFF adjustment for " 71 "XON/XOFF adjustment for "
71 (getenv "TERM") 72 (getenv "TERM")
72 ": use C-\\ for C-s and use C-^ for C-q.")) 73 ": use C-\\ for C-s and use C-^ for C-q."))
73 (sleep-for 2)) ; Give user a chance to see message. 74 (sleep-for 2)) ; Give user a chance to see message.
74 75
75 (defun evade-flow-control-memstr= (e s) 76 (defun enable-flow-control-memstr= (e s)
76 (cond ((null s) nil) 77 (cond ((null s) nil)
77 ((string= e (car s)) t) 78 ((string= e (car s)) t)
78 (t (evade-flow-control-memstr= e (cdr s))))) 79 (t (enable-flow-control-memstr= e (cdr s)))))
79 80
80 ;;;###autoload 81 ;;;###autoload
81 (defun evade-flow-control-on (&rest losing-terminal-types) 82 (defun enable-flow-control-on (&rest losing-terminal-types)
82 "Enable flow control if using one of a specified set of terminal types. 83 "Enable flow control if using one of a specified set of terminal types.
83 Use `(evade-flow-control-on \"vt100\" \"h19\")' to enable flow control 84 Use `(enable-flow-control-on \"vt100\" \"h19\")' to enable flow control
84 on VT-100 and H19 terminals. When flow control is enabled, 85 on VT-100 and H19 terminals. When flow control is enabled,
85 you must type C-\\ to get the effect of a C-s, and type C-^ 86 you must type C-\\ to get the effect of a C-s, and type C-^
86 to get the effect of a C-q." 87 to get the effect of a C-q."
87 (let ((term (getenv "TERM")) 88 (let ((term (getenv "TERM"))
88 hyphend) 89 hyphend)
89 ;; Strip off hyphen and what follows 90 ;; Strip off hyphen and what follows
90 (while (setq hyphend (string-match "[-_][^-_]+$" term)) 91 (while (setq hyphend (string-match "[-_][^-_]+$" term))
91 (setq term (substring term 0 hyphend))) 92 (setq term (substring term 0 hyphend)))
92 (and (evade-flow-control-memstr= term losing-terminal-types) (evade-flow-control))) 93 (and (enable-flow-control-memstr= term losing-terminal-types)
93 ) 94 (enable-flow-control))))
94 95
95 (provide 'flow-ctrl) 96 (provide 'flow-ctrl)
96 97
97 ;;; flow-ctrl.el ends here 98 ;;; flow-ctrl.el ends here