aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/obsolete
diff options
context:
space:
mode:
authorLars Ingebrigtsen2022-02-02 19:39:29 +0100
committerLars Ingebrigtsen2022-02-02 19:39:29 +0100
commit0ef371cb12e4b2f42444afeaeb456665aad37e2b (patch)
tree346e0fd16c636795ea0fc8c275c4b7ff0a8558c0 /lisp/obsolete
parentd34dd869d2223254bc5262ca1194eb2edaff029a (diff)
downloademacs-0ef371cb12e4b2f42444afeaeb456665aad37e2b.tar.gz
emacs-0ef371cb12e4b2f42444afeaeb456665aad37e2b.zip
Move vt-control and vt100-led to obsolete (bug#37562)
Diffstat (limited to 'lisp/obsolete')
-rw-r--r--lisp/obsolete/vt-control.el107
-rw-r--r--lisp/obsolete/vt100-led.el68
2 files changed, 175 insertions, 0 deletions
diff --git a/lisp/obsolete/vt-control.el b/lisp/obsolete/vt-control.el
new file mode 100644
index 00000000000..b80d3505b30
--- /dev/null
+++ b/lisp/obsolete/vt-control.el
@@ -0,0 +1,107 @@
1;;; vt-control.el --- Common VTxxx control functions -*- lexical-binding:t -*-
2
3;; Copyright (C) 1993-1994, 2001-2022 Free Software Foundation, Inc.
4
5;; Author: Rob Riepel <riepel@networking.stanford.edu>
6;; Keywords: terminals
7
8;; This file is part of GNU Emacs.
9
10;; GNU Emacs is free software: you can redistribute it and/or modify
11;; it under the terms of the GNU General Public License as published by
12;; the Free Software Foundation, either version 3 of the License, or
13;; (at your option) any later version.
14
15;; GNU Emacs is distributed in the hope that it will be useful,
16;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;; GNU General Public License for more details.
19
20;; You should have received a copy of the GNU General Public License
21;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
22
23;;; Commentary:
24
25;; The functions contained in this file send various VT control codes
26;; to the terminal where Emacs is running. The following functions are
27;; available.
28
29;; Function Action
30
31;; vt-wide set wide screen (132 characters)
32;; vt-narrow set narrow screen (80 characters)
33;; vt-toggle-screen toggle wide/narrow screen
34;; vt-keypad-on set applications keypad on
35;; vt-keypad-off set applications keypad off
36;; vt-numlock toggle applications keypad on/off
37
38;;; Usage:
39
40;; To use enable these functions, simply load this file.
41
42;; Note: vt-control makes no effort to determine how the terminal is
43;; initially set. It assumes the terminal starts with a width
44;; of 80 characters and the applications keypad enabled. Nor
45;; does vt-control try to restore the terminal when emacs is
46;; killed or suspended.
47
48;;; Code:
49
50
51;;; Global variables
52
53(defvar vt-applications-keypad-p t
54 "If non-nil, keypad is in applications mode.")
55
56(defvar vt-wide-p nil
57 "If non-nil, the screen is 132 characters wide.")
58
59
60;;; Screen width functions.
61
62(defun vt-wide nil
63 "Set the screen 132 characters wide."
64 (interactive)
65 (send-string-to-terminal "\e[?3h")
66 (set-frame-width (selected-frame) 132)
67 (setq vt-wide-p t))
68
69(defun vt-narrow nil
70 "Set the screen 80 characters wide."
71 (interactive)
72 (send-string-to-terminal "\e[?3l")
73 (set-frame-width (selected-frame) 80)
74 (setq vt-wide-p nil))
75
76(defun vt-toggle-screen nil
77 "Toggle between 80 and 132 character screen width."
78 (interactive)
79 (if vt-wide-p (vt-narrow) (vt-wide)))
80
81
82;;; Applications keypad functions.
83
84(defun vt-keypad-on (&optional tell)
85 "Turn on the VT applications keypad."
86 (interactive "p")
87 (send-string-to-terminal "\e=")
88 (setq vt-applications-keypad-p t)
89 (if tell (message "Applications keypad enabled.")))
90
91(defun vt-keypad-off (&optional tell)
92 "Turn off the VT applications keypad."
93 (interactive "p")
94 (send-string-to-terminal "\e>")
95 (setq vt-applications-keypad-p nil)
96 (if tell (message "Applications keypad disabled.")))
97
98(defun vt-numlock (&optional tell)
99 "Toggle VT application keypad on and off."
100 (interactive "p")
101 (if vt-applications-keypad-p
102 (vt-keypad-off tell)
103 (vt-keypad-on tell)))
104
105(provide 'vt-control)
106
107;;; vt-control.el ends here
diff --git a/lisp/obsolete/vt100-led.el b/lisp/obsolete/vt100-led.el
new file mode 100644
index 00000000000..a6a256a6a74
--- /dev/null
+++ b/lisp/obsolete/vt100-led.el
@@ -0,0 +1,68 @@
1;;; vt100-led.el --- functions for LED control on VT-100 terminals & clones -*- lexical-binding:t -*-
2
3;; Copyright (C) 1988, 2001-2022 Free Software Foundation, Inc.
4
5;; Author: Howard Gayle
6;; Maintainer: emacs-devel@gnu.org
7;; Keywords: hardware
8
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 3 of the License, or
14;; (at your option) any later version.
15
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. If not, see <https://www.gnu.org/licenses/>.
23
24;;; Commentary:
25
26;;; Code:
27
28(defvar led-state (make-vector 5 nil)
29 "The internal state of the LEDs. Choices are nil, t, `flash'.
30Element 0 is not used.")
31
32(defun led-flash (l)
33 "Flash LED l."
34 (aset led-state l 'flash)
35 (led-update))
36
37(defun led-off (&optional l)
38 "Turn off vt100 led number L. With no argument, turn them all off."
39 (interactive "P")
40 (if l
41 (aset led-state (prefix-numeric-value l) nil)
42 (fillarray led-state nil))
43 (led-update))
44
45(defun led-on (l)
46 "Turn on LED L."
47 (aset led-state l t)
48 (led-update))
49
50(defun led-update ()
51 "Update the terminal's LEDs to reflect the internal state."
52 (let ((f "\e[?0") ; String to flash.
53 (o "\e[0") ; String for steady on.
54 (l 1)) ; Current LED number.
55 (while (/= l 5)
56 (let ((s (aref led-state l)))
57 (cond
58 ((eq s 'flash)
59 (setq f (concat f ";" (int-to-string l))))
60 (s
61 (setq o (concat o ";" (int-to-string l))))))
62 (setq l (1+ l)))
63 (setq o (concat o "q" f "t"))
64 (send-string-to-terminal o)))
65
66(provide 'vt100-led)
67
68;;; vt100-led.el ends here