comparison lisp/faces.el @ 83359:8f0c7632f259

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
author Karoly Lorentey <lorentey@elte.hu>
date Wed, 07 Sep 2005 02:29:18 +0000
parents 07db5d4dfae1
children 94f174e5569d
comparison
equal deleted inserted replaced
83358:07db5d4dfae1 83359:8f0c7632f259
1814 (unwind-protect 1814 (unwind-protect
1815 (with-selected-frame frame 1815 (with-selected-frame frame
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.
1854 1855
1855 (defun tty-set-up-initial-frame-faces () 1856 (defun tty-set-up-initial-frame-faces ()