2008-11-09 72 views

回答

1

在启动Emacs之前设置一个对应于单色终端的“TERM”变量。例如,如果你是在一个xterm,使用:

TERM=xterm-mono emacs -nw 

如果“控制台”你的意思是在文本模式下的Linux控制台,您可以尝试使用“VT100”(或“VT320”)来代替。

1

我用这个,效果很好,因为我用的是multi-tty东西从Emacs的CVS(未来23):

 
(defun mrc-xwin-look (frame) 
    "Setup to use if running in an X window" 
    (color-theme-deep-blue)) 

(defun mrc-terminal-look (frame) 
    "Setup to use if running in a terminal" 
    (color-theme-charcoal-black)) 

(defun mrc-setup-frame (frame) 
    (set-variable 'color-theme-is-global nil) 
    (select-frame frame) 
    (cond 
    ((window-system) 
    (mrc-xwin-look frame) 
    (tool-bar-mode -1) 
    (mrc-maximize-frame)) 
    (t (mrc-terminal-look frame)))) 

(add-hook 'after-make-frame-functions 'mrc-setup-frame) 

(add-hook 'after-init-hook 
     (lambda() 
     (mrc-setup-frame (selected-frame)))) 

它选择不同的颜色主题取决于框架是否在控制台中运行或一个X窗口。 (我不想失去语法高亮显示在控制台。)

顺便说一句,最大限度地发挥这个样子的:

 
(defun mrc-maximize-frame() 
    "Toggle frame maximized state" 
    ;; from http://paste.lisp.org/display/54627/raw 
    (interactive) 
    (cond 
    ((eq 'x (window-system)) 
    (progn 
     (x-send-client-message nil 0 nil "_NET_WM_STATE" 32 
       '(2 "_NET_WM_STATE_MAXIMIZED_HORZ" 0)) 
     (x-send-client-message nil 0 nil "_NET_WM_STATE" 32 
       '(2 "_NET_WM_STATE_MAXIMIZED_VERT" 0)))) 
    (t 
    (message "Window system %s is not supported by maximize" 
     (symbol-name (window-system)))))) 
13

比那些家伙略短,变window-systemsomething如果你在一个窗口系统的时候,和nil如果你在终端的时候,所以如果想装入颜色主题darkblue2我将有:

(if window-system 
    (progn 
     (load "color-theme") 
     (color-theme-darkblue2))) 

,它只会使用终端中的默认颜色。当然,你可以明显地加载一个长期友好的主题,在其他部分,如果你想:

(load "color-theme") 
(if window-system 
    (color-theme-darkblue2) 
    (some-term-theme))) 
0

另一种简单的一个我用:

(when window-system 
    (load-theme '<myThemeName>)) 

因此,这将加载主题中的所有窗口系统不是零的情况,这基本上是任何类型的GUI。