Alex Rivera | Logout

How can I set a default font (Inconsolata) in my .emacs.el in Ubuntu?

Asked 2010-10-18T10:42:05.213
14

I tried following the advice gathered from Google searches but I am not able to get it to work. My ~/.emacs.el file contains the following:

;; Set color scheme
(require 'color-theme)
(load-file "/home/manoj/Dropbox/conf/themes/color-theme-chocolate-rain.el")
(color-theme-chocolate-rain)

;; Set font
;; (set-default-font "-unknown-Inconsolata-normal-normal-normal-*-12-*-*-*-m-0-iso10646-1")

;; Insert four spaces on tab
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)
(setq indent-line-function 'insert-tab)

I've commented out the font configuration line as it doesn't work. I'm using GNU Emacs 23.1.50.1 (i486-pc-linux-gnu, GTK+ Version 2.18.0) of 2009-09-27 on palmer, modified by Debian on Ubuntu Karmic.

Edit
Report

1 Answer

26

Judging from the emacs version, it appears you've installed emacs-snapshot (good).

So this should work:

sudo apt-get install ttf-inconsolata

Then put in your ~/.emacs file something like

(set-frame-font "Inconsolata-12")

(The 12 refers to the font size, and can be changed.)

answered 2010-10-18T11:12:04.137

Your Answer