Commit cd85984a authored by Karoly Lorentey's avatar Karoly Lorentey
Browse files

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
parent e40b3340
......@@ -386,6 +386,14 @@ is probably not very interesting for anyone else.)
THINGS TO DO
------------
** Dan Nicolaescu writes:
> The terminal initialization code still has some issues.
> This can be seen when using emacsclient -t on a 256 color xterm. The
> terminal frame is only created with 8 color.
> The reason is that terminal-init-xterm calls
> xterm-register-default-colors which calls (display-color-cells (selected-frame))
> and probably `selected-frame' is not completely setup at that time.
** emacsclient --no-wait and --eval is currently broken.
** xt-mouse.el needs to be adapted for multi-tty. It currently
......
......@@ -1816,38 +1816,39 @@ created."
(tty-handle-reverse-video frame (frame-parameters frame))
(frame-set-background-mode frame)
(face-set-after-frame-default frame)
;; Load library for our terminal type.
;; User init file can set term-file-prefix to nil to prevent this.
(unless (null term-file-prefix)
(let ((term (cdr (assq 'tty-type parameters)))
hyphend
term-init-func)
(while (and term
(not (fboundp
(setq term-init-func (intern (concat "terminal-init-" 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))
(substring term 0 hyphend)
nil))
(setq term-init-func nil))
(when term
;; The terminal file has been loaded, now call the terminal
;; specific initialization function.
(unless term-init-func
(setq term-init-func (intern (concat "terminal-init-" term)))
(when (fboundp term-init-func)
(funcall term-init-func))))))
;; Make sure the kill and yank functions do not touch the X clipboard.
(modify-frame-parameters frame '((interprogram-cut-function . nil)))
(modify-frame-parameters frame '((interprogram-paste-function . nil)))
(set-locale-environment nil frame)
(tty-run-terminal-initialization frame)
(setq success t))
(unless success
(delete-frame frame)))
frame))
(defun tty-run-terminal-initialization (frame)
"Run the special initialization code for the terminal type of FRAME."
;; Load library for our terminal type.
;; User init file can set term-file-prefix to nil to prevent this.
(with-selected-frame frame
(unless (null term-file-prefix)
(let ((term (frame-parameter frame 'tty-type))
hyphend term-init-func)
(while (and term
(not (fboundp
(setq term-init-func (intern (concat "terminal-init-" 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))
(substring term 0 hyphend)
nil)))
(when (and term (fboundp term-init-func))
;; The terminal file has been loaded, now call the terminal
;; specific initialization function.
(funcall term-init-func))))))
;; Called from C function init_display to initialize faces of the
;; dumped terminal frame on startup.
......
......@@ -979,28 +979,8 @@ opening the first frame (e.g. open a connection to an X server).")
;; Load library for our terminal type.
;; User init file can set term-file-prefix to nil to prevent this.
(unless (or noninteractive
initial-window-system
(null term-file-prefix))
(let ((term (getenv "TERM"))
hyphend
term-init-func)
(while (and term
(not (fboundp
(setq term-init-func (intern (concat "terminal-init-" 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))
(substring term 0 hyphend)
nil))
(setq term-init-func nil))
(when term
;; The terminal file has been loaded, now call the terminal
;; specific initialization function.
(unless term-init-func
(setq term-init-func (intern (concat "terminal-init-" term)))
(when (fboundp term-init-func)
(funcall term-init-func))))))
initial-window-system)
(tty-run-terminal-initialization (selected-frame)))
;; Update the out-of-memory error message based on user's key bindings
;; for save-some-buffers.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment