summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.multi-tty8
-rw-r--r--lisp/faces.el47
-rw-r--r--lisp/startup.el24
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.)
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
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."
(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.
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).")
;; 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.