diff options
| author | Karoly Lorentey | 2005-09-07 02:29:18 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2005-09-07 02:29:18 +0000 |
| commit | cd85984a2dc0c2cfa169834b11712845cbb93364 (patch) | |
| tree | 19d204938d46df5bdc62715e876e652b603677da | |
| parent | e40b3340ac2275d7c5caee7e1d16f0c37ac77779 (diff) | |
| download | emacs-cd85984a2dc0c2cfa169834b11712845cbb93364.tar.gz emacs-cd85984a2dc0c2cfa169834b11712845cbb93364.zip | |
Slightly refactor the terminal initialization code for simplicity.
* lisp/faces.el (tty-run-terminal-initialization): New function.
(tty-create-frame-with-faces): Use it.
* lisp/startup.el (command-line): Replace duplicated code with a call to
tty-run-terminal-initialization.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-399
| -rw-r--r-- | README.multi-tty | 8 | ||||
| -rw-r--r-- | lisp/faces.el | 47 | ||||
| -rw-r--r-- | lisp/startup.el | 24 |
3 files changed, 34 insertions, 45 deletions
diff --git a/README.multi-tty b/README.multi-tty index 3bced7e6580..5a5ff63a306 100644 --- a/README.multi-tty +++ b/README.multi-tty | |||
| @@ -386,6 +386,14 @@ is probably not very interesting for anyone else.) | |||
| 386 | THINGS TO DO | 386 | THINGS TO DO |
| 387 | ------------ | 387 | ------------ |
| 388 | 388 | ||
| 389 | ** Dan Nicolaescu writes: | ||
| 390 | > The terminal initialization code still has some issues. | ||
| 391 | > This can be seen when using emacsclient -t on a 256 color xterm. The | ||
| 392 | > terminal frame is only created with 8 color. | ||
| 393 | > The reason is that terminal-init-xterm calls | ||
| 394 | > xterm-register-default-colors which calls (display-color-cells (selected-frame)) | ||
| 395 | > and probably `selected-frame' is not completely setup at that time. | ||
| 396 | |||
| 389 | ** emacsclient --no-wait and --eval is currently broken. | 397 | ** emacsclient --no-wait and --eval is currently broken. |
| 390 | 398 | ||
| 391 | ** xt-mouse.el needs to be adapted for multi-tty. It currently | 399 | ** xt-mouse.el needs to be adapted for multi-tty. It currently |
diff --git a/lisp/faces.el b/lisp/faces.el index eb61a04cb70..505b53bcc05 100644 --- a/lisp/faces.el +++ b/lisp/faces.el | |||
| @@ -1816,38 +1816,39 @@ created." | |||
| 1816 | (tty-handle-reverse-video frame (frame-parameters frame)) | 1816 | (tty-handle-reverse-video frame (frame-parameters frame)) |
| 1817 | (frame-set-background-mode frame) | 1817 | (frame-set-background-mode frame) |
| 1818 | (face-set-after-frame-default frame) | 1818 | (face-set-after-frame-default frame) |
| 1819 | ;; Load library for our terminal type. | 1819 | |
| 1820 | ;; User init file can set term-file-prefix to nil to prevent this. | ||
| 1821 | (unless (null term-file-prefix) | ||
| 1822 | (let ((term (cdr (assq 'tty-type parameters))) | ||
| 1823 | hyphend | ||
| 1824 | term-init-func) | ||
| 1825 | (while (and term | ||
| 1826 | (not (fboundp | ||
| 1827 | (setq term-init-func (intern (concat "terminal-init-" term))))) | ||
| 1828 | (not (load (concat term-file-prefix term) t t))) | ||
| 1829 | ;; Strip off last hyphen and what follows, then try again | ||
| 1830 | (setq term | ||
| 1831 | (if (setq hyphend (string-match "[-_][^-_]+$" term)) | ||
| 1832 | (substring term 0 hyphend) | ||
| 1833 | nil)) | ||
| 1834 | (setq term-init-func nil)) | ||
| 1835 | (when term | ||
| 1836 | ;; The terminal file has been loaded, now call the terminal | ||
| 1837 | ;; specific initialization function. | ||
| 1838 | (unless term-init-func | ||
| 1839 | (setq term-init-func (intern (concat "terminal-init-" term))) | ||
| 1840 | (when (fboundp term-init-func) | ||
| 1841 | (funcall term-init-func)))))) | ||
| 1842 | ;; Make sure the kill and yank functions do not touch the X clipboard. | 1820 | ;; Make sure the kill and yank functions do not touch the X clipboard. |
| 1843 | (modify-frame-parameters frame '((interprogram-cut-function . nil))) | 1821 | (modify-frame-parameters frame '((interprogram-cut-function . nil))) |
| 1844 | (modify-frame-parameters frame '((interprogram-paste-function . nil))) | 1822 | (modify-frame-parameters frame '((interprogram-paste-function . nil))) |
| 1823 | |||
| 1845 | (set-locale-environment nil frame) | 1824 | (set-locale-environment nil frame) |
| 1825 | (tty-run-terminal-initialization frame) | ||
| 1846 | (setq success t)) | 1826 | (setq success t)) |
| 1847 | (unless success | 1827 | (unless success |
| 1848 | (delete-frame frame))) | 1828 | (delete-frame frame))) |
| 1849 | frame)) | 1829 | frame)) |
| 1850 | 1830 | ||
| 1831 | (defun tty-run-terminal-initialization (frame) | ||
| 1832 | "Run the special initialization code for the terminal type of FRAME." | ||
| 1833 | ;; Load library for our terminal type. | ||
| 1834 | ;; User init file can set term-file-prefix to nil to prevent this. | ||
| 1835 | (with-selected-frame frame | ||
| 1836 | (unless (null term-file-prefix) | ||
| 1837 | (let ((term (frame-parameter frame 'tty-type)) | ||
| 1838 | hyphend term-init-func) | ||
| 1839 | (while (and term | ||
| 1840 | (not (fboundp | ||
| 1841 | (setq term-init-func (intern (concat "terminal-init-" term))))) | ||
| 1842 | (not (load (concat term-file-prefix term) t t))) | ||
| 1843 | ;; Strip off last hyphen and what follows, then try again | ||
| 1844 | (setq term | ||
| 1845 | (if (setq hyphend (string-match "[-_][^-_]+$" term)) | ||
| 1846 | (substring term 0 hyphend) | ||
| 1847 | nil))) | ||
| 1848 | (when (and term (fboundp term-init-func)) | ||
| 1849 | ;; The terminal file has been loaded, now call the terminal | ||
| 1850 | ;; specific initialization function. | ||
| 1851 | (funcall term-init-func)))))) | ||
| 1851 | 1852 | ||
| 1852 | ;; Called from C function init_display to initialize faces of the | 1853 | ;; Called from C function init_display to initialize faces of the |
| 1853 | ;; dumped terminal frame on startup. | 1854 | ;; dumped terminal frame on startup. |
diff --git a/lisp/startup.el b/lisp/startup.el index 86f9bae30a3..145bbcbc86e 100644 --- a/lisp/startup.el +++ b/lisp/startup.el | |||
| @@ -979,28 +979,8 @@ opening the first frame (e.g. open a connection to an X server).") | |||
| 979 | ;; Load library for our terminal type. | 979 | ;; Load library for our terminal type. |
| 980 | ;; User init file can set term-file-prefix to nil to prevent this. | 980 | ;; User init file can set term-file-prefix to nil to prevent this. |
| 981 | (unless (or noninteractive | 981 | (unless (or noninteractive |
| 982 | initial-window-system | 982 | initial-window-system) |
| 983 | (null term-file-prefix)) | 983 | (tty-run-terminal-initialization (selected-frame))) |
| 984 | (let ((term (getenv "TERM")) | ||
| 985 | hyphend | ||
| 986 | term-init-func) | ||
| 987 | (while (and term | ||
| 988 | (not (fboundp | ||
| 989 | (setq term-init-func (intern (concat "terminal-init-" term))))) | ||
| 990 | (not (load (concat term-file-prefix term) t t))) | ||
| 991 | ;; Strip off last hyphen and what follows, then try again | ||
| 992 | (setq term | ||
| 993 | (if (setq hyphend (string-match "[-_][^-_]+$" term)) | ||
| 994 | (substring term 0 hyphend) | ||
| 995 | nil)) | ||
| 996 | (setq term-init-func nil)) | ||
| 997 | (when term | ||
| 998 | ;; The terminal file has been loaded, now call the terminal | ||
| 999 | ;; specific initialization function. | ||
| 1000 | (unless term-init-func | ||
| 1001 | (setq term-init-func (intern (concat "terminal-init-" term))) | ||
| 1002 | (when (fboundp term-init-func) | ||
| 1003 | (funcall term-init-func)))))) | ||
| 1004 | 984 | ||
| 1005 | ;; Update the out-of-memory error message based on user's key bindings | 985 | ;; Update the out-of-memory error message based on user's key bindings |
| 1006 | ;; for save-some-buffers. | 986 | ;; for save-some-buffers. |