4421
|
1 ;;; vt-control.el --- Common VTxxx control functions
|
|
2
|
|
3 ;; Copyright (C) 1993 Free Software Foundation, Inc.
|
|
4
|
|
5 ;; Author: Rob Riepel <riepel@networking.stanford.edu>
|
|
6 ;; Maintainer: Rob Riepel <riepel@networking.stanford.edu>
|
|
7 ;; Keywords: vt100
|
|
8
|
|
9 ;; GNU Emacs is distributed in the hope that it will be useful,
|
|
10 ;; but WITHOUT ANY WARRANTY. No author or distributor
|
|
11 ;; accepts responsibility to anyone for the consequences of using it
|
|
12 ;; or for whether it serves any particular purpose or works at all,
|
|
13 ;; unless he says so in writing. Refer to the GNU Emacs General Public
|
|
14 ;; License for full details.
|
|
15
|
|
16 ;; Everyone is granted permission to copy, modify and redistribute
|
|
17 ;; GNU Emacs, but only under the conditions described in the
|
|
18 ;; GNU Emacs General Public License. A copy of this license is
|
|
19 ;; supposed to have been given to you along with GNU Emacs so you
|
|
20 ;; can know your rights and responsibilities. It should be in a
|
|
21 ;; file named COPYING. Among other things, the copyright notice
|
|
22 ;; and this notice must be preserved on all copies.
|
|
23 ;;
|
|
24
|
|
25 ;;; Revision: $Id: vt-control.el,v 2.2 1993/08/01 21:47:43 riepel Exp $
|
|
26
|
|
27 ;;; Commentary:
|
|
28
|
|
29 ;; The functions contained in this file send various VT control codes
|
|
30 ;; to the terminal where emacs is running. The following functions are
|
|
31 ;; available.
|
|
32
|
|
33 ;; Function Action
|
|
34
|
|
35 ;; vt-wide set wide screen (132 characters)
|
|
36 ;; vt-narrow set narrow screen (80 characters)
|
|
37 ;; vt-toggle-screen toggle wide/narrow screen
|
|
38 ;; vt-keypad-on set applications keypad on
|
|
39 ;; vt-keypad-off set applications keypad off
|
|
40 ;; vt-numlock toggle applications keypad on/off
|
|
41
|
|
42 ;;; Usage:
|
|
43
|
|
44 ;; To use enable these functions, simply load this file.
|
|
45
|
|
46 ;; Note: vt-control makes no effort to determine how the terminal is
|
|
47 ;; initially set. It assumes the terminal starts with a width
|
|
48 ;; of 80 characters and the applications keypad enabled. Nor
|
|
49 ;; does vt-control try to restore the terminal when emacs is
|
|
50 ;; killed or suspended.
|
|
51
|
|
52 ;;; Code:
|
|
53
|
|
54
|
|
55 ;;; Revision Information
|
|
56
|
|
57 (defconst vt-revision "$Revision: 2.2 $"
|
|
58 "Revision number of vt-control.")
|
|
59
|
|
60
|
|
61 ;;; Global variables
|
|
62
|
|
63 (defvar vt-applications-keypad-p t
|
|
64 "If non-nil, keypad is in applications mode.")
|
|
65
|
|
66 (defvar vt-wide-p nil
|
|
67 "If non-nil, the screen is 132 characters wide.")
|
|
68
|
|
69
|
|
70 ;;; Screen width functions.
|
|
71
|
|
72 (defun vt-wide nil
|
|
73 "Set the screen 132 characters wide."
|
|
74 (interactive)
|
|
75 (send-string-to-terminal "\e[?3h")
|
|
76 (set-screen-width 132)
|
|
77 (setq vt-wide-p t))
|
|
78
|
|
79 (defun vt-narrow nil
|
|
80 "Set the screen 80 characters wide."
|
|
81 (interactive)
|
|
82 (send-string-to-terminal "\e[?3l")
|
|
83 (set-screen-width 80)
|
|
84 (setq vt-wide-p nil))
|
|
85
|
|
86 (defun vt-toggle-screen nil
|
|
87 "Toggle between 80 and 132 character screen width."
|
|
88 (interactive)
|
|
89 (if vt-wide-p (vt-narrow) (vt-wide)))
|
|
90
|
|
91
|
|
92 ;;; Applications keypad functions.
|
|
93
|
|
94 (defun vt-keypad-on (&optional tell)
|
|
95 "Turn on the VT applications keypad."
|
|
96 (interactive)
|
|
97 (send-string-to-terminal "\e[\e=")
|
|
98 (setq vt-applications-keypad-p t)
|
|
99 (if (or tell (interactive-p)) (message "Applications keypad enabled.")))
|
|
100
|
|
101 (defun vt-keypad-off (&optional tell)
|
|
102 "Turn off the VT applications keypad."
|
|
103 (interactive "p")
|
|
104 (send-string-to-terminal "\e[\e>")
|
|
105 (setq vt-applications-keypad-p nil)
|
|
106 (if (or tell (interactive-p)) (message "Applications keypad disabled.")))
|
|
107
|
|
108 (defun vt-numlock nil
|
|
109 "Toggle VT application keypad on and off."
|
|
110 (interactive)
|
|
111 (if vt-applications-keypad-p (vt-keypad-off (interactive-p))
|
|
112 (vt-keypad-on (interactive-p))))
|
|
113
|
|
114 ;;; vt-control.el ends here
|