From 95de732d843a80a5061842d230a739190d00dfee Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Thu, 27 Mar 2014 21:29:54 -0400 Subject: [PATCH] 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. --- doc/emacs/ChangeLog | 4 ++++ doc/emacs/custom.texi | 6 +++++- doc/lispref/ChangeLog | 4 ++++ doc/lispref/os.texi | 18 ++++++++++++++---- etc/NEWS | 10 ++++++++-- lisp/ChangeLog | 8 ++++++++ lisp/faces.el | 20 ++++++++++++++++++++ lisp/term/AT386.el | 2 -- lisp/term/README | 8 +++++--- lisp/term/apollo.el | 5 ----- lisp/term/news.el | 2 -- lisp/term/tvi970.el | 2 -- lisp/term/vt100.el | 2 -- lisp/term/vt102.el | 6 ------ lisp/term/vt125.el | 6 ------ lisp/term/vt201.el | 10 ---------- lisp/term/vt220.el | 10 ---------- lisp/term/vt240.el | 10 ---------- lisp/term/vt300.el | 8 -------- lisp/term/vt320.el | 8 -------- lisp/term/vt400.el | 8 -------- lisp/term/vt420.el | 8 -------- lisp/term/wyse50.el | 1 - 23 files changed, 68 insertions(+), 98 deletions(-) delete mode 100644 lisp/term/apollo.el delete mode 100644 lisp/term/vt102.el delete mode 100644 lisp/term/vt125.el delete mode 100644 lisp/term/vt201.el delete mode 100644 lisp/term/vt220.el delete mode 100644 lisp/term/vt240.el delete mode 100644 lisp/term/vt300.el delete mode 100644 lisp/term/vt320.el delete mode 100644 lisp/term/vt400.el delete mode 100644 lisp/term/vt420.el diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index 36044d89ccd..507d9cb427a 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog @@ -1,3 +1,7 @@ +2014-03-28 Glenn Morris + + * custom.texi (Terminal Init): Mention term-file-aliases. + 2014-03-26 Glenn Morris * ack.texi (Acknowledgments): Remove reference to obsolete file. diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi index bb02f1e7c9f..5dbcac77f86 100644 --- a/doc/emacs/custom.texi +++ b/doc/emacs/custom.texi @@ -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 diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index fdc266472e0..5c0941b7918 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -1,3 +1,7 @@ +2014-03-28 Glenn Morris + + * os.texi (Terminal-Specific): Mention term-file-aliases. + 2014-03-26 Eli Zaretskii * files.texi (Kinds of Files): Improve documentation of diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi index df30ac12e2e..8706d898888 100644 --- a/doc/lispref/os.texi +++ b/doc/lispref/os.texi @@ -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 diff --git a/etc/NEWS b/etc/NEWS index 2ddcf845b78..0265f2604bf 100644 --- 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. + * 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'. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1054db7c118..2cd29d8a5c9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2014-03-28 Glenn Morris + + * 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 * startup.el (inhibit-startup-hooks): Doc tweak. diff --git a/lisp/faces.el b/lisp/faces.el index e008993b49f..4a1fa687dee 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -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 diff --git a/lisp/term/AT386.el b/lisp/term/AT386.el index 9750da15c72..dc6899e3835 100644 --- a/lisp/term/AT386.el +++ b/lisp/term/AT386.el @@ -22,8 +22,6 @@ ;;; Commentary: -;; Uses the Emacs 19 terminal initialization features --- won't work with 18. - ;;; Code: (defun terminal-init-AT386 () diff --git a/lisp/term/README b/lisp/term/README index b8756c3873d..b523063c0fd 100644 --- a/lisp/term/README +++ b/lisp/term/README @@ -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 index e4cabac3bf1..00000000000 --- a/lisp/term/apollo.el +++ /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 diff --git a/lisp/term/news.el b/lisp/term/news.el index a58ff76aefe..a1e459a1261 100644 --- a/lisp/term/news.el +++ b/lisp/term/news.el @@ -22,8 +22,6 @@ ;;; Commentary: -;; Uses the Emacs 19 terminal initialization features --- won't work with 18. - ;;; Code: (defun terminal-init-news () diff --git a/lisp/term/tvi970.el b/lisp/term/tvi970.el index 841d88d4e19..3b77ab46400 100644 --- a/lisp/term/tvi970.el +++ b/lisp/term/tvi970.el @@ -23,8 +23,6 @@ ;;; Commentary: -;; Uses the Emacs 19 terminal initialization features --- won't work with 18. - ;;; Code: (defvar tvi970-terminal-map diff --git a/lisp/term/vt100.el b/lisp/term/vt100.el index 19e64d2bd90..6761e83891e 100644 --- a/lisp/term/vt100.el +++ b/lisp/term/vt100.el @@ -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 index 261b0bb5fd6..00000000000 --- a/lisp/term/vt102.el +++ /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 index 2b2098d483d..00000000000 --- a/lisp/term/vt125.el +++ /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 index a65b4737731..00000000000 --- a/lisp/term/vt201.el +++ /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 index 0dd43353c55..00000000000 --- a/lisp/term/vt220.el +++ /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 index b58d4211ce7..00000000000 --- a/lisp/term/vt240.el +++ /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 index a2664552a64..00000000000 --- a/lisp/term/vt300.el +++ /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 index 08ed9a8ffb9..00000000000 --- a/lisp/term/vt320.el +++ /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 index ad4a5fdbb4f..00000000000 --- a/lisp/term/vt400.el +++ /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 index f6745a3953a..00000000000 --- a/lisp/term/vt420.el +++ /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 diff --git a/lisp/term/wyse50.el b/lisp/term/wyse50.el index aa9ba43d3d7..77c1655dfd1 100644 --- a/lisp/term/wyse50.el +++ b/lisp/term/wyse50.el @@ -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. -- 2.39.2