Font & old emacs

Jul 11, 2011
Tested on: CentOS release 5.6 (Final)

The newer version of emacs (23.x) has a nice option in menu to change the default font. But the older emacs (21.4.1) does not have these options. The older (& stable) versions of emacs are generally shipped with centos. Here are steps for changing the default fonts in emacs 21.4.1

Option 1 (for current sessions only)
  1. Open emacs.
  2. Left-click on mouse while holding 'Shift' key on keyboard. A Font-menu will pop-up.
  3. Play around with the menu & set required font.

Option 2 (for all future sessions)
We have to find the available system fonts and apply them to ~/.emacs file.
  1. Open terminal & execute following command: xfontsel
  2. Left-click on 'fmly' & others to select a value. You will be able to see how the font looks like in the same window. When you are satisfied with the font selected press 'Select' button. It will copy the font name with details to clipboard. Following are some of the examples of the fonts: -*-courier-medium-r-*-*-17-*-*-*-*-*-iso8859-* -*-lucidatypewriter-medium-*-*-*-14-*-*-*-*-90-iso8859-* -*-luxi mono-medium-r-*-*-17-*-*-*-*-*-ascii-*
  3. Open ~/.emacs file in any text editor and add following at the end of the file: (set-default-font "-*-*-*-*-*-*-*-*-*-*-*-*-*-*") Replace -*-*-*-*-*-*-*-*-*-*-*-*-*-* by your selected font name (like one of the examples shown above) Save ~/.emacs & re-launch emacs. You should be able to see the difference.
  4. There might be some delay before text is displayed in emacs. Add following to top of the ~/.emacs file for a workaround: (modify-frame-parameters nil '((wait-for-wm . nil)))