0
|
1 ;;; tty-init.el --- initialization code for tty's
|
|
2 ;; Copyright (C) 1994 Free Software Foundation, Inc.
|
|
3 ;; Copyright (C) 1996 Ben Wing <wing@666.com>.
|
|
4
|
|
5 ;; Author: various
|
|
6 ;; Keywords: terminals
|
|
7
|
70
|
8 ;; This file is part of XEmacs.
|
|
9 ;;
|
|
10 ;; XEmacs 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 2, or (at your option)
|
|
13 ;; any later version.
|
|
14 ;;
|
|
15 ;; XEmacs 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 XEmacs; see the file COPYING. If not, write to the
|
|
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
23 ;; Boston, MA 02111-1307, USA.
|
0
|
24
|
|
25 ;;; Commentary:
|
|
26
|
|
27 ;;; Code:
|
|
28
|
|
29 (defvar pre-tty-win-initted nil)
|
|
30
|
|
31 ;; called both from init-tty-win and from the C code.
|
|
32 (defun init-pre-tty-win ()
|
|
33 "Initialize TTY at startup (pre). Don't call this."
|
70
|
34 (unless pre-tty-win-initted
|
|
35 (register-tty-color "black" "\e[30m" "\e[40m")
|
|
36 (register-tty-color "red" "\e[31m" "\e[41m")
|
|
37 (register-tty-color "green" "\e[32m" "\e[42m")
|
|
38 (register-tty-color "yellow" "\e[33m" "\e[43m")
|
|
39 (register-tty-color "blue" "\e[34m" "\e[44m")
|
|
40 (register-tty-color "magenta" "\e[35m" "\e[45m")
|
|
41 (register-tty-color "cyan" "\e[36m" "\e[46m")
|
|
42 (register-tty-color "white" "\e[37m" "\e[47m")
|
0
|
43
|
70
|
44 ;; Define `highlighted' tty colors
|
|
45 (register-tty-color "darkgrey" "\e[1;30m" "\e[1;40m")
|
|
46 (register-tty-color "brightred" "\e[1;31m" "\e[1;41m")
|
|
47 (register-tty-color "brightgreen" "\e[1;32m" "\e[1;42m")
|
|
48 (register-tty-color "brightyellow" "\e[1;33m" "\e[1;43m")
|
|
49 (register-tty-color "brightblue" "\e[1;34m" "\e[1;44m")
|
|
50 (register-tty-color "brightmagenta" "\e[1;35m" "\e[1;45m")
|
|
51 (register-tty-color "brightcyan" "\e[1;36m" "\e[1;46m")
|
|
52 (register-tty-color "brightwhite" "\e[1;37m" "\e[1;47m")
|
|
53
|
|
54 (setq pre-tty-win-initted t)))
|
0
|
55
|
|
56 ;; called both from init-tty-win and from the C code.
|
|
57 ;; we have to do this for every created TTY console.
|
|
58 (defun init-post-tty-win (console)
|
|
59 "Initialize TTY at console creation time (post). Don't call this."
|
|
60 ;; load the appropriate term-type-specific Lisp file.
|
|
61 ;; we don't do this at startup here so that the user can
|
|
62 ;; override term-file-prefix. (startup.el does it after
|
|
63 ;; loading the init file.)
|
70
|
64 (when init-file-loaded
|
|
65 ;; temporarily select the console so that the changes
|
|
66 ;; to function-key-map are made for the right console.
|
|
67 (let ((foobar (selected-console)))
|
|
68 (unwind-protect
|
|
69 (progn
|
|
70 (select-console console)
|
|
71 (load-terminal-library))
|
|
72 (select-console foobar)))))
|
0
|
73
|
|
74 (defvar tty-win-initted nil)
|
|
75
|
|
76 (defun init-tty-win ()
|
|
77 "Initialize TTY at startup. Don't call this."
|
70
|
78 (unless tty-win-initted
|
|
79 (init-pre-tty-win)
|
|
80 (make-tty-device nil nil)
|
|
81 (init-post-tty-win (selected-console))
|
|
82 (setq tty-win-initted t)))
|
0
|
83
|
70
|
84 (defun make-frame-on-tty (tty &optional props)
|
0
|
85 "Create a frame on the TTY connection named TTY.
|
70
|
86 TTY should be a TTY device name such as \"/dev/ttyp3\" (as returned by
|
|
87 the `tty' command in that TTY), or nil for the standard input/output
|
|
88 of the running XEmacs process.
|
0
|
89
|
70
|
90 PROPS should be a plist of properties, as in the call to `make-frame'.
|
0
|
91
|
|
92 This function opens a connection to the TTY or reuses an existing
|
|
93 connection.
|
|
94
|
|
95 This function is a trivial wrapper around `make-frame-on-device'."
|
|
96 (interactive "sMake frame on TTY: ")
|
|
97 (if (equal tty "") (setq tty nil))
|
70
|
98 (make-frame-on-device 'tty tty props))
|