可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
Say I have my Emacs window split into multiple tiles, e.g.:
--------------------------- | | | | | | --------------------------- | | | | ---------------------------
When I switch between tiles (aka windows in Emacs) to edit my files (e.g. using C-x o), I can see on which tile I am by visually locating the cursor (point) on the screen and checking the difference in shading in the status bar of each tile:
However, locating the cursor on a large screen is not easy AND the difference in shading on the status bar where the cursor is is almost negligible:
This is what a status bar looks like when the corresponding window is selected:
This is what it looks like when the corresponding window is not selected (notice the green is a bit dimmer)
The above is with the color theme zenburn on GNU Emacs 23.3.1.
My question is: Is there a way to have Emacs more clearly indicate which window/tile/buffer is the one that has the focus?
回答1:
Absolutely!
You can change the modeline to highlight the active bar using the following in your .emacs (change colors and style to suit your preferences of course).
(set-face-attribute 'mode-line nil :foreground "gray80" :background "gray25" :box '(:line-width 1 :style released-button)) (set-face-attribute 'mode-line-inactive nil :foreground "gray30" :background MY_BG_COLOR :box '(:line-width 1 :style released-button))
Since it seems you are using the Zenburn color theme, you can also fix it within there. Just open the file within your color-theme library named zenburn.el (or it might be color-theme-zenburn.el) and search for the following lines:
`(mode-line ((,class (:foreground ,zenburn-green+1 :background ,zenburn-bg-1 :box (:line-width -1 :style released-button))))) `(mode-line-buffer-id ((,class (:foreground ,zenburn-yellow :weight bold)))) `(mode-line-inactive ((,class (:foreground ,zenburn-green-1 :background ,zenburn-bg-05 :box (:line-width -1 :style released-button)))))
and change the values of the background and foreground colors as you see fit.
回答2:
For a quicker solution, you can use the Smart Mode Line plugin for Emacs: a color-coded, fixed width mode line. Works great with the Zenburn theme (I'm using both right now).
It's available in the ELPA, by the way.