Saturday, August 25, 2012

Customize emacs

I've switched to Xmonad as a window manager.  Previous entries covered the xmonad install and xterm configuration.  I'll now configure emacs with a black background and grey text, since green is already used by xterm and I like a soft text color but want my emacs windows easily differentiable from the xterm windows.  I turn off the menu bar, the tool bar, and the scroll bar since I limit my use of the mouse and these widgets just waste space.  I also turn off the emacs startup screen.  The /home/USER/.emacs file contains the user specific configurations.  Mine is pasted below.
(set-background-color "black")
(set-foreground-color "grey")
(setq inhibit-startup-message t)
(menu-bar-mode -1) 
(tool-bar-mode -1)
(scroll-bar-mode -1)
   Each of these commands - except for the startup message - can be tested in the emacs window by typing m-x then the command.  For example m-x set-foreground-color then return will prompt you for the new color setting.  The commands with true/false and on/off options will not prompt you but simply toggle between the settings.
   The screenshot below shows an emacs frame on the left (with two windows open), a chrome browser window on the top right and an xterm on the bottom right.  The top emacs window is the filesize tutorial using the boost filesystem, and shows the C/C++ syntax highlighting in this color scheme.  The bottom emacs window is my .emacs file and shows the Lisp syntax highlighting in this color scheme.
   If you ever need to access the emacs menu bar you can pop it up using ctrl-mouse3.  http://emacswiki.org/ and http://www.masteringemacs.org/ are my main sources for emacs knowledge.

No comments:

Post a Comment