Commit 95de732d authored by Glenn Morris's avatar Glenn Morris

Introduce `term-file-aliases', replacing some small lisp/term files

* lisp/faces.el (term-file-aliases): New variable.
(tty-run-terminal-initialization): Respect term-file-aliases.

* lisp/term/apollo.el, lisp/term/vt102.el, lisp/term/vt125.el:
* lisp/term/vt201.el, lisp/term/vt220.el, lisp/term/vt240.el:
* lisp/term/vt300.el, lisp/term/vt320.el, lisp/term/vt400.el:
* lisp/term/vt420.el: Remove files, replaced by aliases.

* lisp/term/README: Mention term-file-aliases.

* lisp/term/AT386.el, lisp/term/news.el, lisp/term/tvi970.el:
* lisp/term/vt100.el, lisp/term/wyse50.el: Remove obsolete comment.

* doc/emacs/custom.texi (Terminal Init): Mention term-file-aliases.

* doc/lispref/os.texi (Terminal-Specific): Mention term-file-aliases.

* etc/NEWS: Mention this.
parent 4e74624d
2014-03-28 Glenn Morris <rgm@gnu.org>
* custom.texi (Terminal Init): Mention term-file-aliases.
2014-03-26 Glenn Morris <rgm@gnu.org>
* ack.texi (Acknowledgments): Remove reference to obsolete file.
......
......@@ -2445,9 +2445,13 @@ harmless, so those do not need a conditional.
@node Terminal Init
@subsection Terminal-specific Initialization
@vindex term-file-aliases
Each terminal type can have a Lisp library to be loaded into Emacs when
it is run on that type of terminal. For a terminal type named
@var{termtype}, the library is called @file{term/@var{termtype}} and it is
@var{termtype}, the library is called @file{term/@var{termtype}}.
(If there is an entry of the form @code{(@var{termtype} . @var{alias})}
in the @code{term-file-aliases} association list, Emacs uses
@var{alias} in place of @var{termtype}.) The library is
found by searching the directories @code{load-path} as usual and trying the
suffixes @samp{.elc} and @samp{.el}. Normally it appears in the
subdirectory @file{term} of the directory where most Emacs libraries are
......
2014-03-28 Glenn Morris <rgm@gnu.org>
* os.texi (Terminal-Specific): Mention term-file-aliases.
2014-03-26 Eli Zaretskii <eliz@gnu.org>
* files.texi (Kinds of Files): Improve documentation of
......
......@@ -430,10 +430,13 @@ This variable holds the name of the @file{.emacs.d} directory. It is
run on that type of terminal. The library's name is constructed by
concatenating the value of the variable @code{term-file-prefix} and the
terminal type (specified by the environment variable @env{TERM}).
Normally, @code{term-file-prefix} has the value
@code{"term/"}; changing this is not recommended. Emacs finds the file
in the normal manner, by searching the @code{load-path} directories, and
trying the @samp{.elc} and @samp{.el} suffixes.
Normally, @code{term-file-prefix} has the value @code{"term/"};
changing this is not recommended. If there is an entry matching
@env{TERM} in the @code{term-file-aliases} association list,
Emacs uses the associated value in place of @env{TERM}.
Emacs finds the file in the normal manner, by searching the
@code{load-path} directories, and trying the @samp{.elc} and
@samp{.el} suffixes.
@cindex Termcap
The usual role of a terminal-specific library is to enable special
......@@ -479,6 +482,13 @@ terminal-initialization file.
On MS-DOS, Emacs sets the @env{TERM} environment variable to @samp{internal}.
@end defvar
@defvar term-file-aliases
This variable is an an association list mapping terminal types to
their aliases. For example, an element of the form @code{("vt102"
. "vt100")} means to treat a terminal of type @samp{vt102} like one of
type @samp{vt100}.
@end defvar
@defvar tty-setup-hook
This variable is a normal hook that Emacs runs after initializing a
new text terminal. (This applies when Emacs starts up in non-windowed
......
......@@ -36,6 +36,11 @@ otherwise leave it unmarked.
---
** The default value of `history-length' has increased to 100.
+++
** The new variable `term-file-aliases' replaces some files from lisp/term.
The function `tty-run-terminal-initialization' consults this variable
when deciding what terminal-specific initialization code to run.
* Editing Changes in Emacs 24.5
......@@ -413,8 +418,9 @@ means to always load the .elc file.
+++
*** `electric-indent-mode' is now enabled by default.
E.g., typing RET reindents the current line and indents the new line.
`C-j' inserts a newline but does not indent.
Typing RET reindents the current line and indents the new line.
`C-j' inserts a newline but does not indent. In some programming modes,
additional characters are electric (eg `{').
+++
*** New buffer-local `electric-indent-local-mode'.
......
2014-03-28 Glenn Morris <rgm@gnu.org>
* faces.el (term-file-aliases): New variable.
(tty-run-terminal-initialization): Respect term-file-aliases.
* term/apollo.el, term/vt102.el, term/vt125.el, term/vt201.el:
* term/vt220.el, term/vt240.el, term/vt300.el, term/vt320.el:
* term/vt400.el, term/vt420.el: Remove files, replaced by aliases.
2014-03-27 Glenn Morris <rgm@gnu.org>
* startup.el (inhibit-startup-hooks): Doc tweak.
......
......@@ -2110,16 +2110,36 @@ the above example."
Specifically, `tty-run-terminal-initialization' runs this.
This can be used to fine tune the `input-decode-map', for example.")
(defvar term-file-aliases
'(("apollo" . "vt100")
("vt102" . "vt100")
("vt125" . "vt100")
("vt201" . "vt200")
("vt220" . "vt200")
("vt240" . "vt200")
("vt300" . "vt200")
("vt320" . "vt200")
("vt400" . "vt200")
("vt420" . "vt200")
)
"Alist of terminal type aliases.
Entries are of the form (TYPE . ALIAS), where both elements are strings.
This means to treat a terminal of type TYPE as if it were of type ALIAS.")
(defun tty-run-terminal-initialization (frame &optional type run-hook)
"Run the special initialization code for the terminal type of FRAME.
The optional TYPE parameter may be used to override the autodetected
terminal type to a different value.
This consults `term-file-aliases' to map terminal types to their aliases.
If optional argument RUN-HOOK is non-nil, then as a final step,
this runs the hook `tty-setup-hook'.
If you set `term-file-prefix' to nil, this function does nothing."
(setq type (or type (tty-type frame)))
(let ((alias (assoc type term-file-aliases)))
(if alias (setq type (cdr alias))))
;; Load library for our terminal type.
;; User init file can set term-file-prefix to nil to prevent this.
(with-selected-frame frame
......
......@@ -22,8 +22,6 @@
;;; Commentary:
;; Uses the Emacs 19 terminal initialization features --- won't work with 18.
;;; Code:
(defun terminal-init-AT386 ()
......
......@@ -5,9 +5,11 @@ See the end of the file for license conditions.
This directory contains files of elisp that customize Emacs for certain
terminal types.
When Emacs opens a new terminal, it checks the TERM environment variable to
see what type of terminal the user is running on, searches for an elisp file
named "term/${TERM}.el", and if one exists, loads it. If Emacs finds no
When Emacs opens a new terminal, it checks the TERM environment variable
to see what type of terminal the user is running on. (If there is an entry
for TERM in the `term-file-aliases' variable, Emacs uses the associated value
in place of TERM in the following.) Emacs searches for an elisp file named
"term/${TERM}.el", and if one exists, loads it. If Emacs finds no
suitable file, then it strips the last hyphen and what follows it from TERM,
and tries again. If that still doesn't yield a file, then the previous hyphen
is stripped, and so on until all hyphens are gone. For example, if the
......
(defun terminal-init-apollo ()
"Terminal initialization function for apollo."
(tty-run-terminal-initialization (selected-frame) "vt100"))
;;; apollo.el ends here
......@@ -22,8 +22,6 @@
;;; Commentary:
;; Uses the Emacs 19 terminal initialization features --- won't work with 18.
;;; Code:
(defun terminal-init-news ()
......
......@@ -23,8 +23,6 @@
;;; Commentary:
;; Uses the Emacs 19 terminal initialization features --- won't work with 18.
;;; Code:
(defvar tvi970-terminal-map
......
......@@ -22,8 +22,6 @@
;;; Commentary:
;; Uses the Emacs 19 terminal initialization features --- won't work with 18.
;; Handles all VT100 clones, including the Apollo terminal. Also handles
;; the VT200 --- its PF- and arrow- keys are different, but all those
;; are really set up by the terminal initialization code, which mines them
......
(defun terminal-init-vt102 ()
"Terminal initialization function for vt102."
(tty-run-terminal-initialization (selected-frame) "vt100"))
;;; vt102.el ends here
(defun terminal-init-vt125 ()
"Terminal initialization function for vt125."
(tty-run-terminal-initialization (selected-frame) "vt100"))
;;; vt125.el ends here
;; For our purposes we can treat the vt200 and vt100 almost alike.
;; Most differences are handled by the termcap entry.
(defun terminal-init-vt201 ()
"Terminal initialization function for vt201."
(tty-run-terminal-initialization (selected-frame) "vt100")
;; Make F11 an escape key.
(define-key input-decode-map "\e[23~" [f11]) ;Probably redundant.
(define-key local-function-key-map [f11] [?\e]))
;;; vt201.el ends here
;; For our purposes we can treat the vt200 and vt100 almost alike.
;; Most differences are handled by the termcap entry.
(defun terminal-init-vt220 ()
"Terminal initialization function for vt220."
(tty-run-terminal-initialization (selected-frame) "vt100")
;; Make F11 an escape key.
(define-key input-decode-map "\e[23~" [f11]) ;Probably redundant.
(define-key local-function-key-map [f11] [?\e]))
;;; vt220.el ends here
;; For our purposes we can treat the vt200 and vt100 almost alike.
;; Most differences are handled by the termcap entry.
(defun terminal-init-vt240 ()
"Terminal initialization function for vt240."
(tty-run-terminal-initialization (selected-frame) "vt100")
;; Make F11 an escape key.
(define-key input-decode-map "\e[23~" [f11]) ;Probably redundant.
(define-key local-function-key-map [f11] [?\e]))
;;; vt240.el ends here
(defun terminal-init-vt300 ()
"Terminal initialization function for vt300."
(tty-run-terminal-initialization (selected-frame) "vt100")
;; Make F11 an escape key.
(define-key input-decode-map "\e[23~" [f11]) ;Probably redundant.
(define-key local-function-key-map [f11] [?\e]))
;;; vt300.el ends here
(defun terminal-init-vt320 ()
"Terminal initialization function for vt320."
(tty-run-terminal-initialization (selected-frame) "vt100")
;; Make F11 an escape key.
(define-key input-decode-map "\e[23~" [f11]) ;Probably redundant.
(define-key local-function-key-map [f11] [?\e]))
;;; vt320.el ends here
(defun terminal-init-vt400 ()
"Terminal initialization function for vt400."
(tty-run-terminal-initialization (selected-frame) "vt100")
;; Make F11 an escape key.
(define-key input-decode-map "\e[23~" [f11]) ;Probably redundant.
(define-key local-function-key-map [f11] [?\e]))
;;; vt400.el ends here
(defun terminal-init-vt420 ()
"Terminal initialization function for vt420."
(tty-run-terminal-initialization (selected-frame) "vt100")
;; Make F11 an escape key.
(define-key input-decode-map "\e[23~" [f11]) ;Probably redundant.
(define-key local-function-key-map [f11] [?\e]))
;;; vt420.el ends here
......@@ -23,7 +23,6 @@
;;; Commentary:
;; Uses the Emacs 19 terminal initialization features --- won't work with 18.
;; Rewritten for Emacs 19 by jimb, January 1992
;; Cleaned up for new terminal package conventions by esr, March 1993
;; Should work well for Televideo TVI 925 although it's overkill.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment