diff options
| author | Stefan Monnier | 2005-09-12 15:47:31 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2005-09-12 15:47:31 +0000 |
| commit | c7dc8ae18a2567d0caabe6d73b7ad233c4ece791 (patch) | |
| tree | edea86f03876527aafe2ec85e6b28890a2c3c043 | |
| parent | 595f66af31d19086d4031a9d9123796332b069ac (diff) | |
| download | emacs-c7dc8ae18a2567d0caabe6d73b7ad233c4ece791.tar.gz emacs-c7dc8ae18a2567d0caabe6d73b7ad233c4ece791.zip | |
(command-line): Try calling various terminal-init-foo-bar
functions by stripping hyphenated suffixes from $TERM.
| -rw-r--r-- | lisp/startup.el | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/lisp/startup.el b/lisp/startup.el index 32021225e7e..d5cf91d622b 100644 --- a/lisp/startup.el +++ b/lisp/startup.el | |||
| @@ -976,20 +976,28 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'." | |||
| 976 | (unless (or noninteractive | 976 | (unless (or noninteractive |
| 977 | window-system | 977 | window-system |
| 978 | (null term-file-prefix)) | 978 | (null term-file-prefix)) |
| 979 | (let ((term (getenv "TERM")) | 979 | (let* ((TERM (getenv "TERM")) |
| 980 | (term TERM) | ||
| 980 | hyphend) | 981 | hyphend) |
| 981 | (while (and term | 982 | (while (and term |
| 982 | (not (load (concat term-file-prefix term) t t))) | 983 | (not (load (concat term-file-prefix term) t t))) |
| 983 | ;; Strip off last hyphen and what follows, then try again | 984 | ;; Strip off last hyphen and what follows, then try again |
| 984 | (setq term | 985 | (setq term |
| 985 | (if (setq hyphend (string-match "[-_][^-_]+$" term)) | 986 | (if (setq hyphend (string-match "[-_][^-_]+\\'" term)) |
| 986 | (substring term 0 hyphend) | 987 | (substring term 0 hyphend) |
| 987 | nil))) | 988 | nil))) |
| 988 | (when term | 989 | (setq term TERM) |
| 989 | ;; The terminal file has been loaded, now call the terminal | 990 | ;; The terminal file has been loaded, now call the terminal specific |
| 990 | ;; specific initialization function. | 991 | ;; initialization function. |
| 991 | (let ((term-init-func (intern (concat "terminal-init-" term)))) | 992 | (while term |
| 992 | (when (fboundp term-init-func) | 993 | (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) | ||
| 993 | (funcall term-init-func)))))) | 1001 | (funcall term-init-func)))))) |
| 994 | 1002 | ||
| 995 | ;; Update the out-of-memory error message based on user's key bindings | 1003 | ;; Update the out-of-memory error message based on user's key bindings |