Mercurial > emacs
annotate lisp/vt-control.el @ 4730:09e1fb3bf84d
Test for res_init in libc.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 16 Sep 1993 20:08:34 +0000 |
parents | 3a3993b99ea8 |
children | 9cde7d7fea1f |
rev | line source |
---|---|
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 | |
4450 | 9 ;; This file is part of GNU Emacs. |
10 | |
11 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
12 ;; it under the terms of the GNU General Public License as published by | |
13 ;; the Free Software Foundation; either version 2, or (at your option) | |
14 ;; any later version. | |
4421 | 15 |
4450 | 16 ;; GNU Emacs is distributed in the hope that it will be useful, |
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 ;; GNU General Public License for more details. | |
20 | |
21 ;; You should have received a copy of the GNU General Public License | |
22 ;; along with GNU Emacs; see the file COPYING. If not, write to | |
23 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
4421 | 24 |
25 ;;; Commentary: | |
26 | |
27 ;; The functions contained in this file send various VT control codes | |
28 ;; to the terminal where emacs is running. The following functions are | |
29 ;; available. | |
30 | |
31 ;; Function Action | |
32 | |
33 ;; vt-wide set wide screen (132 characters) | |
34 ;; vt-narrow set narrow screen (80 characters) | |
35 ;; vt-toggle-screen toggle wide/narrow screen | |
36 ;; vt-keypad-on set applications keypad on | |
37 ;; vt-keypad-off set applications keypad off | |
38 ;; vt-numlock toggle applications keypad on/off | |
39 | |
40 ;;; Usage: | |
41 | |
42 ;; To use enable these functions, simply load this file. | |
43 | |
44 ;; Note: vt-control makes no effort to determine how the terminal is | |
45 ;; initially set. It assumes the terminal starts with a width | |
46 ;; of 80 characters and the applications keypad enabled. Nor | |
47 ;; does vt-control try to restore the terminal when emacs is | |
48 ;; killed or suspended. | |
49 | |
50 ;;; Code: | |
51 | |
52 | |
53 ;;; Revision Information | |
54 | |
4527
3a3993b99ea8
Change revision number and comments.
Richard M. Stallman <rms@gnu.org>
parents:
4450
diff
changeset
|
55 (defconst vt-revision "$Revision: 2.4 $" |
4421 | 56 "Revision number of vt-control.") |
57 | |
58 | |
59 ;;; Global variables | |
60 | |
61 (defvar vt-applications-keypad-p t | |
62 "If non-nil, keypad is in applications mode.") | |
63 | |
64 (defvar vt-wide-p nil | |
65 "If non-nil, the screen is 132 characters wide.") | |
66 | |
67 | |
68 ;;; Screen width functions. | |
69 | |
70 (defun vt-wide nil | |
71 "Set the screen 132 characters wide." | |
72 (interactive) | |
73 (send-string-to-terminal "\e[?3h") | |
74 (set-screen-width 132) | |
75 (setq vt-wide-p t)) | |
76 | |
77 (defun vt-narrow nil | |
78 "Set the screen 80 characters wide." | |
79 (interactive) | |
80 (send-string-to-terminal "\e[?3l") | |
81 (set-screen-width 80) | |
82 (setq vt-wide-p nil)) | |
83 | |
84 (defun vt-toggle-screen nil | |
85 "Toggle between 80 and 132 character screen width." | |
86 (interactive) | |
87 (if vt-wide-p (vt-narrow) (vt-wide))) | |
88 | |
89 | |
90 ;;; Applications keypad functions. | |
91 | |
92 (defun vt-keypad-on (&optional tell) | |
93 "Turn on the VT applications keypad." | |
94 (interactive) | |
95 (send-string-to-terminal "\e[\e=") | |
96 (setq vt-applications-keypad-p t) | |
97 (if (or tell (interactive-p)) (message "Applications keypad enabled."))) | |
98 | |
99 (defun vt-keypad-off (&optional tell) | |
100 "Turn off the VT applications keypad." | |
101 (interactive "p") | |
102 (send-string-to-terminal "\e[\e>") | |
103 (setq vt-applications-keypad-p nil) | |
104 (if (or tell (interactive-p)) (message "Applications keypad disabled."))) | |
105 | |
106 (defun vt-numlock nil | |
107 "Toggle VT application keypad on and off." | |
108 (interactive) | |
109 (if vt-applications-keypad-p (vt-keypad-off (interactive-p)) | |
110 (vt-keypad-on (interactive-p)))) | |
111 | |
112 ;;; vt-control.el ends here |