annotate lisp/term/tty-init.el @ 96:dbb370e3c29e r20-0final

Import from CVS: tag r20-0final
author cvs
date Mon, 13 Aug 2007 09:12:40 +0200
parents 131b0175ea99
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; tty-init.el --- initialization code for tty's
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;; Copyright (C) 1994 Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;; Copyright (C) 1996 Ben Wing <wing@666.com>.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; Author: various
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;; Keywords: terminals
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
8 ;; This file is part of XEmacs.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
9 ;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
10 ;; XEmacs is free software; you can redistribute it and/or modify
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
13 ;; any later version.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
14 ;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
15 ;; XEmacs is distributed in the hope that it will be useful,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
18 ;; GNU General Public License for more details.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
19 ;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
20 ;; You should have received a copy of the GNU General Public License
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
21 ;; along with XEmacs; see the file COPYING. If not, write to the
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
23 ;; Boston, MA 02111-1307, USA.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 ;;; Commentary:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;;; Code:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 (defvar pre-tty-win-initted nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 ;; called both from init-tty-win and from the C code.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 (defun init-pre-tty-win ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 "Initialize TTY at startup (pre). Don't call this."
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
34 (unless pre-tty-win-initted
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
35 (register-tty-color "black" "\e[30m" "\e[40m")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
36 (register-tty-color "red" "\e[31m" "\e[41m")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
37 (register-tty-color "green" "\e[32m" "\e[42m")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
38 (register-tty-color "yellow" "\e[33m" "\e[43m")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
39 (register-tty-color "blue" "\e[34m" "\e[44m")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
40 (register-tty-color "magenta" "\e[35m" "\e[45m")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
41 (register-tty-color "cyan" "\e[36m" "\e[46m")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
42 (register-tty-color "white" "\e[37m" "\e[47m")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
44 ;; Define `highlighted' tty colors
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
45 (register-tty-color "darkgrey" "\e[1;30m" "\e[1;40m")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
46 (register-tty-color "brightred" "\e[1;31m" "\e[1;41m")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
47 (register-tty-color "brightgreen" "\e[1;32m" "\e[1;42m")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
48 (register-tty-color "brightyellow" "\e[1;33m" "\e[1;43m")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
49 (register-tty-color "brightblue" "\e[1;34m" "\e[1;44m")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
50 (register-tty-color "brightmagenta" "\e[1;35m" "\e[1;45m")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
51 (register-tty-color "brightcyan" "\e[1;36m" "\e[1;46m")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
52 (register-tty-color "brightwhite" "\e[1;37m" "\e[1;47m")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
53
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
54 (setq pre-tty-win-initted t)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 ;; called both from init-tty-win and from the C code.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 ;; we have to do this for every created TTY console.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 (defun init-post-tty-win (console)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 "Initialize TTY at console creation time (post). Don't call this."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 ;; load the appropriate term-type-specific Lisp file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 ;; we don't do this at startup here so that the user can
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 ;; override term-file-prefix. (startup.el does it after
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 ;; loading the init file.)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
64 (when init-file-loaded
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
65 ;; temporarily select the console so that the changes
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
66 ;; to function-key-map are made for the right console.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
67 (let ((foobar (selected-console)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
68 (unwind-protect
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
69 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
70 (select-console console)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
71 (load-terminal-library))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
72 (select-console foobar)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 (defvar tty-win-initted nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 (defun init-tty-win ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 "Initialize TTY at startup. Don't call this."
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
78 (unless tty-win-initted
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
79 (init-pre-tty-win)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
80 (make-tty-device nil nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
81 (init-post-tty-win (selected-console))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
82 (setq tty-win-initted t)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
84 (defun make-frame-on-tty (tty &optional props)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 "Create a frame on the TTY connection named TTY.
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
86 TTY should be a TTY device name such as \"/dev/ttyp3\" (as returned by
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
87 the `tty' command in that TTY), or nil for the standard input/output
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
88 of the running XEmacs process.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
90 PROPS should be a plist of properties, as in the call to `make-frame'.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 This function opens a connection to the TTY or reuses an existing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 connection.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 This function is a trivial wrapper around `make-frame-on-device'."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 (interactive "sMake frame on TTY: ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 (if (equal tty "") (setq tty nil))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
98 (make-frame-on-device 'tty tty props))