Mercurial > emacs
annotate lisp/vt-control.el @ 83743:7b1f798e89ff
Increase version to 23.0.50.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Wed, 29 Aug 2007 08:12:44 +0000 |
parents | 9355f9b7bbff |
children | 73661ddc7ac7 f55f9811f5d7 |
rev | line source |
---|---|
4421 | 1 ;;; vt-control.el --- Common VTxxx control functions |
2 | |
74442 | 3 ;; Copyright (C) 1993, 1994, 2001, 2002, 2003, |
75347 | 4 ;; 2004, 2005, 2006, 2007 Free Software Foundation, Inc. |
4421 | 5 |
6 ;; Author: Rob Riepel <riepel@networking.stanford.edu> | |
7 ;; Maintainer: Rob Riepel <riepel@networking.stanford.edu> | |
5140 | 8 ;; Keywords: terminals |
4421 | 9 |
4450 | 10 ;; This file is part of GNU Emacs. |
11 | |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
13 ;; it under the terms of the GNU General Public License as published by | |
78236
9355f9b7bbff
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
75347
diff
changeset
|
14 ;; the Free Software Foundation; either version 3, or (at your option) |
4450 | 15 ;; any later version. |
4421 | 16 |
4450 | 17 ;; GNU Emacs is distributed in the hope that it will be useful, |
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 ;; GNU General Public License for more details. | |
21 | |
22 ;; You should have received a copy of the GNU General Public License | |
14169 | 23 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
64091 | 24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
25 ;; Boston, MA 02110-1301, USA. | |
4421 | 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 ;;; Global variables | |
56 | |
57 (defvar vt-applications-keypad-p t | |
58 "If non-nil, keypad is in applications mode.") | |
59 | |
60 (defvar vt-wide-p nil | |
61 "If non-nil, the screen is 132 characters wide.") | |
62 | |
63 | |
64 ;;; Screen width functions. | |
65 | |
66 (defun vt-wide nil | |
67 "Set the screen 132 characters wide." | |
68 (interactive) | |
69 (send-string-to-terminal "\e[?3h") | |
42321
dc54396f2b69
(vt-wide, vt-narrow): Use set-frame-width instead of obsolete
Pavel Janík <Pavel@Janik.cz>
parents:
18383
diff
changeset
|
70 (set-frame-width (selected-frame) 132) |
4421 | 71 (setq vt-wide-p t)) |
72 | |
73 (defun vt-narrow nil | |
74 "Set the screen 80 characters wide." | |
75 (interactive) | |
76 (send-string-to-terminal "\e[?3l") | |
42321
dc54396f2b69
(vt-wide, vt-narrow): Use set-frame-width instead of obsolete
Pavel Janík <Pavel@Janik.cz>
parents:
18383
diff
changeset
|
77 (set-frame-width (selected-frame) 80) |
4421 | 78 (setq vt-wide-p nil)) |
79 | |
80 (defun vt-toggle-screen nil | |
81 "Toggle between 80 and 132 character screen width." | |
82 (interactive) | |
83 (if vt-wide-p (vt-narrow) (vt-wide))) | |
84 | |
85 | |
86 ;;; Applications keypad functions. | |
87 | |
88 (defun vt-keypad-on (&optional tell) | |
89 "Turn on the VT applications keypad." | |
90 (interactive) | |
12362
03e8afdeabb3
(vt-keypad-on, vt-keypad-off): Updated codes sent
Richard M. Stallman <rms@gnu.org>
parents:
7979
diff
changeset
|
91 (send-string-to-terminal "\e=") |
4421 | 92 (setq vt-applications-keypad-p t) |
93 (if (or tell (interactive-p)) (message "Applications keypad enabled."))) | |
94 | |
95 (defun vt-keypad-off (&optional tell) | |
96 "Turn off the VT applications keypad." | |
97 (interactive "p") | |
12362
03e8afdeabb3
(vt-keypad-on, vt-keypad-off): Updated codes sent
Richard M. Stallman <rms@gnu.org>
parents:
7979
diff
changeset
|
98 (send-string-to-terminal "\e>") |
4421 | 99 (setq vt-applications-keypad-p nil) |
100 (if (or tell (interactive-p)) (message "Applications keypad disabled."))) | |
101 | |
102 (defun vt-numlock nil | |
103 "Toggle VT application keypad on and off." | |
104 (interactive) | |
105 (if vt-applications-keypad-p (vt-keypad-off (interactive-p)) | |
106 (vt-keypad-on (interactive-p)))) | |
107 | |
18383 | 108 (provide 'vt-control) |
109 | |
52401 | 110 ;;; arch-tag: d4fed1bf-2524-4ba1-a4fe-86bca3d928a2 |
4421 | 111 ;;; vt-control.el ends here |