diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2005-09-12 15:47:31 +0000 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2005-09-12 15:47:31 +0000 |
commit | c7dc8ae18a2567d0caabe6d73b7ad233c4ece791 (patch) | |
tree | edea86f03876527aafe2ec85e6b28890a2c3c043 /lisp | |
parent | 595f66af31d19086d4031a9d9123796332b069ac (diff) | |
download | emacs-c7dc8ae18a2567d0caabe6d73b7ad233c4ece791.tar.gz emacs-c7dc8ae18a2567d0caabe6d73b7ad233c4ece791.tar.bz2 emacs-c7dc8ae18a2567d0caabe6d73b7ad233c4ece791.zip |
(command-line): Try calling various terminal-init-foo-bar
functions by stripping hyphenated suffixes from $TERM.
Diffstat (limited to 'lisp')
-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'." (unless (or noninteractive window-system (null term-file-prefix)) - (let ((term (getenv "TERM")) + (let* ((TERM (getenv "TERM")) + (term TERM) hyphend) (while (and term (not (load (concat term-file-prefix term) t t))) ;; Strip off last hyphen and what follows, then try again (setq term - (if (setq hyphend (string-match "[-_][^-_]+$" term)) + (if (setq hyphend (string-match "[-_][^-_]+\\'" term)) (substring term 0 hyphend) nil))) - (when term - ;; The terminal file has been loaded, now call the terminal - ;; specific initialization function. - (let ((term-init-func (intern (concat "terminal-init-" term)))) - (when (fboundp term-init-func) + (setq term TERM) + ;; The terminal file has been loaded, now call the terminal specific + ;; initialization function. + (while term + (let ((term-init-func (intern-soft (concat "terminal-init-" term)))) + (if (not (fboundp term-init-func)) + ;; Strip off last hyphen and what follows, then try again + (setq term + (if (setq hyphend (string-match "[-_][^-_]+\\'" term)) + (substring term 0 hyphend) + nil)) + (setq term nil) (funcall term-init-func)))))) ;; Update the out-of-memory error message based on user's key bindings |