Introduce `term-file-aliases', replacing some small lisp/term files
authorGlenn Morris <rgm@gnu.org>
Fri, 28 Mar 2014 01:29:54 +0000 (21:29 -0400)
committerGlenn Morris <rgm@gnu.org>
Fri, 28 Mar 2014 01:29:54 +0000 (21:29 -0400)
* 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.

23 files changed:
doc/emacs/ChangeLog
doc/emacs/custom.texi
doc/lispref/ChangeLog
doc/lispref/os.texi
etc/NEWS
lisp/ChangeLog
lisp/faces.el
lisp/term/AT386.el
lisp/term/README
lisp/term/apollo.el [deleted file]
lisp/term/news.el
lisp/term/tvi970.el
lisp/term/vt100.el
lisp/term/vt102.el [deleted file]
lisp/term/vt125.el [deleted file]
lisp/term/vt201.el [deleted file]
lisp/term/vt220.el [deleted file]
lisp/term/vt240.el [deleted file]
lisp/term/vt300.el [deleted file]
lisp/term/vt320.el [deleted file]
lisp/term/vt400.el [deleted file]
lisp/term/vt420.el [deleted file]
lisp/term/wyse50.el

index 36044d8..507d9cb 100644 (file)
@@ -1,3 +1,7 @@
+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.
index bb02f1e..5dbcac7 100644 (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
index fdc2664..5c0941b 100644 (file)
@@ -1,3 +1,7 @@
+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
index df30ac1..8706d89 100644 (file)
@@ -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
index 2ddcf84..0265f26 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -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.
+
 \f
 * 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'.
index 1054db7..2cd29d8 100644 (file)
@@ -1,3 +1,11 @@
+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.
index e008993..4a1fa68 100644 (file)
@@ -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
index 9750da1..dc6899e 100644 (file)
@@ -22,8 +22,6 @@
 
 ;;; Commentary:
 
-;; Uses the Emacs 19 terminal initialization features --- won't work with 18.
-
 ;;; Code:
 
 (defun terminal-init-AT386 ()
index b8756c3..b523063 100644 (file)
@@ -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
diff --git a/lisp/term/apollo.el b/lisp/term/apollo.el
deleted file mode 100644 (file)
index e4cabac..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-(defun terminal-init-apollo ()
-  "Terminal initialization function for apollo."
-  (tty-run-terminal-initialization (selected-frame) "vt100"))
-
-;;; apollo.el ends here
index a58ff76..a1e459a 100644 (file)
@@ -22,8 +22,6 @@
 
 ;;; Commentary:
 
-;; Uses the Emacs 19 terminal initialization features --- won't work with 18.
-
 ;;; Code:
 
 (defun terminal-init-news ()
index 841d88d..3b77ab4 100644 (file)
@@ -23,8 +23,6 @@
 
 ;;; Commentary:
 
-;; Uses the Emacs 19 terminal initialization features --- won't work with 18.
-
 ;;; Code:
 
 (defvar tvi970-terminal-map
index 19e64d2..6761e83 100644 (file)
@@ -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
diff --git a/lisp/term/vt102.el b/lisp/term/vt102.el
deleted file mode 100644 (file)
index 261b0bb..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-
-(defun terminal-init-vt102 ()
-  "Terminal initialization function for vt102."
-  (tty-run-terminal-initialization (selected-frame) "vt100"))
-
-;;; vt102.el ends here
diff --git a/lisp/term/vt125.el b/lisp/term/vt125.el
deleted file mode 100644 (file)
index 2b2098d..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-
-(defun terminal-init-vt125 ()
-  "Terminal initialization function for vt125."
-  (tty-run-terminal-initialization (selected-frame) "vt100"))
-
-;;; vt125.el ends here
diff --git a/lisp/term/vt201.el b/lisp/term/vt201.el
deleted file mode 100644 (file)
index a65b473..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-;; 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
diff --git a/lisp/term/vt220.el b/lisp/term/vt220.el
deleted file mode 100644 (file)
index 0dd4335..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-;; 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
diff --git a/lisp/term/vt240.el b/lisp/term/vt240.el
deleted file mode 100644 (file)
index b58d421..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-;; 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
diff --git a/lisp/term/vt300.el b/lisp/term/vt300.el
deleted file mode 100644 (file)
index a266455..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-(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
diff --git a/lisp/term/vt320.el b/lisp/term/vt320.el
deleted file mode 100644 (file)
index 08ed9a8..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-(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
diff --git a/lisp/term/vt400.el b/lisp/term/vt400.el
deleted file mode 100644 (file)
index ad4a5fd..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-(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
diff --git a/lisp/term/vt420.el b/lisp/term/vt420.el
deleted file mode 100644 (file)
index f6745a3..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-(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
index aa9ba43..77c1655 100644 (file)
@@ -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.