Getting Started‎ > ‎

Emacs arc-mode

Emacs, a creation of Richard Stallman, has a long and illustrious history. Despite its age, it remains the editor of choice for many top programmers. The reasons for this include its versatility and customizability. If you haven't tried it out, or used it for any length of time, you should give it a spin. The thing about Emacs is that at first glance it looks like an ordinary old program, with funny command shortcuts and other idiosyncrasies. It's only when you start customizing it that you realize how powerful it is, and how you can make it look beautiful and behave any way you want. It is said that the answer to the question "Can Emacs do this?" is more often than not, "Yes."

On Ubuntu systems, Emacs can be installed via the command line:

$ sudo apt-get install emacs
Emacs can be customized to run in arc-mode (for Arc, and not the built in arc-mode for archives). Download the arc.el file attached below (or another version in Anarki/Extras if you prefer that), place it in the directory of your choosing (usually ~/.emacs.d/), then add the following lines to your ~/.emacs file:

;; load arc.el and auto run arc-mode when file is of .arc extension 
(load-file "~/.emacs.d/arc.el") 
(add-to-list 'auto-mode-alist '("\\.arc$" . arc-mode))  

You can play around with the settings in arc.el to obtain your indentation preferences.

Ubuntu usually doesn't provide the latest versions for most applications, so if you find you like Emacs and want the latest bleeding edge version over what your distro provides, you can add the following ppa source to Software Sources::Other Sources (under System Settings): oneiric main (assuming you are on Ubuntu Oneric)

If you are on other distros like Arch Linux, application versions are usually very current and the following should get you the latest version of Emacs:

$ sudo pacman -S emacs

If you want to further customize your color settings, frame size, and open two shell buffers, (one for Ruby and one for Arc - to stretch the example), every time you run Emacs, insert the following code* into your ~/.emacs file:

;; set emacs window size and font settings
(setq default-frame-alist
      '((width . 130) (height . 45)
        (font . "-*-Courier-normal-r-*-*-14-*-*-*-c-*-iso8859-1")))

;; add Marmalade and MELPA repos; gives you more package options to choose from
(require 'package)
(add-to-list 'package-archives
             '("marmalade" . "") t)
(add-to-list 'package-archives
             '("melpa" . "") t)

;; start shells
(let ((default-directory "/path/to/ruby code/"))
  (shell "*shell-ruby*"))
(let ((default-directory "/path/to/arc code/"))
  (shell "*shell-arc*"))

;; Set default theme
(load-theme 'zenburn t)
* Tested in Emacs 24.x only.

Then restart Emacs, select the Options menu, then the Manage Emacs Packages menu item, and install zenburn-theme and solarized-theme, two superb color themes ported to Emacs. After installation, select the Options menu, Customize Emacs, Custom Themes menu item, from which you should see the solarized-dark, solarized-light and zenburn themes. Try them out to see if you like them.

And if you do, replace the (load-theme 'zenburn t) command with 'solarized-dark or 'solarized-light if you prefer either of these options. Even if you don't like the color choices, you'll be amazed at how it transforms your plain old black-on-white look of the default Emacs settings. And remember, we are just scratching at the surface. So tweak it, and enjoy the aesthetics and productivity of Emacs. :)
Kinley Dorji,
Mar 9, 2012, 3:52 AM