Emacs on Ubuntu

Install Emacs

Install emacs if not currently available.

~$ sudo apt-get install emacs-snapshot-gtk 

Launch Emacs

Either launch emacs by typing emacs in a terminal window or from the menu via Applications > Programming > Emacs Snapshot. Emacs Snapshot (GTK) will always launch a new windows and Emacs Snapshot (client) will load into an existing emacs instance if it is acting as a server (more on that later.)

~$ emacs

Configure Emacs

Emacs is configured via the .emacs file in a users home directory. Open this file in an editor and then optionally add some of the basic configurations outlined below.

~$ nano ~/.emacs

Disable Bell Function

Disables the sometimes annoying system beep which sounds at the top and bottom of a file.

Semi-colons act as comments within the .emacs file.

;; disable bell function
(setq ring-bell-function 'ignore)

Disable Toolbar

Emacs is all about the keyboard so learn the key combinations and forget the mouse.

;; disable toolbar
(tool-bar-mode -1)

Disable Scrollbar

Use the Page Up and Page Down keys for scrolling.

;; disable scrollbar
(toggle-scroll-bar -1)

Disable Splash Screen

The splash screen contains helpful links to new users but disable it once you don't need it.

;; disable splash screen
(custom-set-variables '(inhibit-startup-screen t))

Current Buffer Name in Title Bar

Add this display the current buffer name in the application title bar.

;; current buffer name in title bar
(setq frame-title-format "%b")

Emacs Server

As noted before, new files can be launched into an existing emacs instance if desired. This is done by loading the emacs server. After this is started, launching a file with the Emacs Snapshop (client) will now try to find an existing emacs instance. Files launched with Emacs Snapshot (GTK) will still open in a new application window.

;; start emacs server
(server-start)

Custom Effects

With these changes, emacs will now look like this on launch:

Notice the lack of toolbar, scrollbar and launch page. The *scratch* buffer name appears in the title bar as well although this screenshot does not show it.

Set Default Font

The default font is easily set in the latest versions of emacs-snapshot-gdk. Click Options > Set Default Font... from the menu and choose a font. I choose DejaVu Sans Mono, Book style, 8 point size for the above screenshot.

The font selection will be added as a configuration to the .emacs file and will look like this:

(custom-set-faces
 '(default ((t (:inherit nil :stipple nil :background "white" :foreground "black" 
			 :inverse-video nil :box nil :strike-through nil 
			 :overline nil :underline nil :slant normal :weight normal 
			 :height 79 :width normal :foundry "unknown" 
			 :family "DejaVu Sans Mono")))))