976 |
(unless (or noninteractive |
(unless (or noninteractive |
977 |
window-system |
window-system |
978 |
(null term-file-prefix)) |
(null term-file-prefix)) |
979 |
(let ((term (getenv "TERM")) |
(let* ((TERM (getenv "TERM")) |
980 |
|
(term TERM) |
981 |
hyphend) |
hyphend) |
982 |
(while (and term |
(while (and term |
983 |
(not (load (concat term-file-prefix term) t t))) |
(not (load (concat term-file-prefix term) t t))) |
984 |
;; Strip off last hyphen and what follows, then try again |
;; Strip off last hyphen and what follows, then try again |
985 |
(setq term |
(setq term |
986 |
(if (setq hyphend (string-match "[-_][^-_]+$" term)) |
(if (setq hyphend (string-match "[-_][^-_]+\\'" term)) |
987 |
(substring term 0 hyphend) |
(substring term 0 hyphend) |
988 |
nil))) |
nil))) |
989 |
(when term |
(setq term TERM) |
990 |
;; The terminal file has been loaded, now call the terminal |
;; The terminal file has been loaded, now call the terminal specific |
991 |
;; specific initialization function. |
;; initialization function. |
992 |
(let ((term-init-func (intern (concat "terminal-init-" term)))) |
(while term |
993 |
(when (fboundp term-init-func) |
(let ((term-init-func (intern-soft (concat "terminal-init-" term)))) |
994 |
|
(if (not (fboundp term-init-func)) |
995 |
|
;; Strip off last hyphen and what follows, then try again |
996 |
|
(setq term |
997 |
|
(if (setq hyphend (string-match "[-_][^-_]+\\'" term)) |
998 |
|
(substring term 0 hyphend) |
999 |
|
nil)) |
1000 |
|
(setq term nil) |
1001 |
(funcall term-init-func)))))) |
(funcall term-init-func)))))) |
1002 |
|
|
1003 |
;; Update the out-of-memory error message based on user's key bindings |
;; Update the out-of-memory error message based on user's key bindings |