Mercurial > emacs
annotate lisp/vt100-led.el @ 669:4c64c671426f
*** empty log message ***
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 01 Jun 1992 08:28:58 +0000 |
parents | d74e65773062 |
children | 4f28bd14272c |
rev | line source |
---|---|
656
d74e65773062
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
583
diff
changeset
|
1 ;;; vt100-led.el --- functions for LED control on VT-100 terminals & clones. |
d74e65773062
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
583
diff
changeset
|
2 |
583 | 3 ;; Copyright (C) 1988 Free Software Foundation, Inc. |
4 | |
5 ;; This file is part of GNU Emacs. | |
6 | |
7 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
8 ;; it under the terms of the GNU General Public License as published by | |
9 ;; the Free Software Foundation; either version 1, or (at your option) | |
10 ;; any later version. | |
11 | |
12 ;; GNU Emacs is distributed in the hope that it will be useful, | |
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 ;; GNU General Public License for more details. | |
16 | |
17 ;; You should have received a copy of the GNU General Public License | |
18 ;; along with GNU Emacs; see the file COPYING. If not, write to | |
19 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
20 | |
21 | |
22 ;; Written by Howard Gayle. | |
23 | |
24 (defvar led-state (make-vector 5 nil) | |
25 "The internal state of the LEDs. Choices are nil, t, `flash. | |
26 Element 0 is not used.") | |
27 | |
28 (defun led-flash (l) | |
29 "Flash LED l." | |
30 (aset led-state l 'flash) | |
31 (led-update)) | |
32 | |
33 (defun led-off (&optional l) | |
34 "Turn off vt100 led number L. With no argument, turn them all off." | |
35 (interactive "P") | |
36 (if l | |
37 (aset led-state (prefix-numeric-value l) nil) | |
38 (fillarray led-state nil)) | |
39 (led-update)) | |
40 | |
41 (defun led-on (l) | |
42 "Turn on LED l." | |
43 (aset led-state l t) | |
44 (led-update)) | |
45 | |
46 (defun led-update () | |
47 "Update the terminal's LEDs to reflect the internal state." | |
48 (let ((f "\e[?0") ; String to flash. | |
49 (o "\e[0") ; String for steady on. | |
50 (l 1)) ; Current LED number. | |
51 (while (/= l 5) | |
52 (let ((s (aref led-state l))) | |
53 (cond | |
54 ((eq s 'flash) | |
55 (setq f (concat f ";" (int-to-string l)))) | |
56 (s | |
57 (setq o (concat o ";" (int-to-string l)))))) | |
58 (setq l (1+ l))) | |
59 (setq o (concat o "q" f "t")) | |
60 (send-string-to-terminal o))) | |
61 | |
62 (provide 'vt100-led) | |
656
d74e65773062
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
583
diff
changeset
|
63 |
d74e65773062
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
583
diff
changeset
|
64 ;;; vt100-led.el ends here |