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
(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.
;; 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.