1 ;;; vt100-led.el --- functions for LED control on VT-100 terminals & clones.
3 ;; Copyright (C) 1988 Free Software Foundation, Inc.
5 ;; This file is part of GNU Emacs.
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)
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.
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.
22 ;; Written by Howard Gayle.
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.")
30 (aset led-state l
'flash
)
33 (defun led-off (&optional l
)
34 "Turn off vt100 led number L. With no argument, turn them all off."
37 (aset led-state
(prefix-numeric-value l
) nil
)
38 (fillarray led-state nil
))
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.
52 (let ((s (aref led-state l
)))
55 (setq f
(concat f
";" (int-to-string l
))))
57 (setq o
(concat o
";" (int-to-string l
))))))
59 (setq o
(concat o
"q" f
"t"))
60 (send-string-to-terminal o
)))
64 ;;; vt100-led.el ends here