Installing and using Ergoemacs (for intermediate Emacs users)

Xah Lee’s Ergoemacs is five different kinds of awesome.

This page will explain how to get started with Ergoemacs.

These instructions are mostly geared towards the intermediate Emacs user. Newbies and experts can pick up a few useful tips.

Windows or Linux?

The first question to answer is, are you installing on Windows or Linux?

Here’s the download page.

If you’re on Windows, you can just download and run the .exe installation file. Everything’s taken care of.

I HIGHLY recomend you use Ergoemacs if you’re on Windows, rather than the standard distribution or even EmacsW32. Ergoemacs provides a lot of extra functionality for Windows users that comes in very, very handy. Unless you’re an expert, you won’t know how to replace all that. So go with Xah’s distro.

If you’re on Linux, then you need the latest Emacs 23.2 installed. I’m on Ubuntu, so I just open up Synaptic Package Manager and select the canonical Emacs GTK 23.2 option. GTK means it has a graphical interface; the other option is Emacs nox, which means no X windows support. Go with GTK, it’s prettier.

I imagine the install process is similar to Linux if you’re on a Mac, but I don’t have a Mac so I can’t address that.

Once your Emacs is installed, you need to add Ergoemacs. Download it and follow the instructions in the readme files. They’re easy.

Next I’ll explain how to deal with all the crap that Xah doesn’t tell you.

Where’d my keys go?

The first thing you want to do once you’ve got Ergoemacs installed is figure out how to get your old commands back. Because your keyboard will have suddenly stopped working, and any time you press your familiar keys, bad things will happen.

Here’s how you disable Ergoemacs –

M-a ergoemacs-mode RET

Unfortunately you will still be stuck in CUA mode, which means that C-c, C-v, C-x, etc won’t work like they should.

To fix this, you need to disable CUA mode. Here’s how –

M-x cua-mode RET

As long as you have a nice ergonomic keyboard, I don’t recommend learning the Ergoemacs keybinds. As an intermediate user, you’re already used to the default Emacs ones, and there are lots of good reasons to stick with those. The main reason is that using the default keys will make it easier to continue getting better at Emacs, since all the help files on the Internet are written for those keys. I’ll show you how to permanently disable the keybind changes further down on this page.

Check out your nifty new features

Now everything will be working normally. Have a look around. Your menu bar is way cooler!

You’ve now got a bunch of new features. Here’s a partial list:

  • A bunch of programming language modes, only useful for programmers
  • Improved mathematics, LaTex and (human) language support
  • yasnippet
  • AutoComplete
  • DiredPlus
  • BookmarkPlus
  • Tab bar GUI
  • A twitter mode
  • Tons of Windows features if you’re using Windows
  • Better spellchecking
  • Desktop and minibuffer history persist across closures and crashes
  • Miscellaneous other improvements

Start tinkering

Now let’s get under the hood and fix a few remaining annoyances, to maximize our Ergoemacs experience.

Killing xmsi

If you’re a sloppy typist like me, xmsi will immediately annoy you. It’s bound to Shift-Space, which I hit frequently while typing plain text.

This package allows you to insert mathematical characters like Greek letters. I don’t need it. You can disable it with the following command –

M-x xmsi-mode RET

Dired recursive load fix

I’m not sure if this will affect everyone, but I found after installing that dired mode no longer worked.

You can invoke dired mode with the following command –

C-x d

This gave a minibuffer error message complaining of a recursive load. Here’s a description of the issue:

Re: The old tramp recursive load
I had a nasty version of this after upgrading my Aquamacs to the current
version, 2.2: all attempts to use Dired failed with the “recursive load” error.
Upgrading to Emacs 24 wasn’t really an option for me, since the current
Aquamacs is wrapped around Emacs 23.3.

However, the following seems to be a fix in the meantime: load the Tramp file
explicitly in .emacs. In my case (getting the path from the error message in
*Messages*):

(load-file “/Applications/Aquamacs.app/Contents/Resources/lisp/net/tramp.elc”)

So, the fix is to find the path to your tramp.elc in the error message, and add the following to your .emacs file:

;; fix tramp recursive load error when calling dired
(load-file “/path-to-your-tramp.elc/tramp.elc”)

De-customizing Org-mode

Org-mode gets updated a lot more than Emacs itself. Consequently, you may have been using a previous version. If so, some of your customizations are probably no longer necessary, because they’ve been rolled into the official version.

Go through and disable unnecessary Org-mode customizations by commenting them out in your .emacs file.

You can always reenable them if you notice missing functionality.

Editing .emacs to save your keys automatically

We don’t want to manually disable the keybinds every time Ergoemcacs starts. So let’s make the changes permanent in our .emacs file.

Here are the all the lines I had to add to my .emacs file to get everything to behave properly:

;; fixing tramp recursive load causing dired load failure
(load-file “/usr/share/emacs/23.2/lisp/net/tramp.elc”)

;; fixing annoying xmsi trigger key
(xmsi-mode 0)

;; disabling keybinds of ergoemacs and cua mode
(ergoemacs-mode 0)
(cua-mode 0)

When you’re done, hit M-x eval-buffer in your .emacs file to cause the new settings to take effect.

Congrats, now you’re ready to rock ‘n roll with Ergoemacs! Enjoy all your nifty new features.

And later, once you’ve gotten comfortable, who knows? Maybe you’ll get tired of cramped fingers and slow editing speeds, and decide to switch to the ultimate ergonomic keyboard layout. But that’s a battle for another day.

UPDATE:

Ergoemacs turns off all autosaving by default. This is a HUGE problem, and caused me to lose data after a power outage. Grrr.

Specifically, it still recovers your desktop state, but it doesn’t autosave your files.

Here’s the offending code, in ~/.emacs.d/ergoemacs_1.9.3.1/ergoemacs/init_settings.el

;; No backup or auto-save
(setq backup-by-copying t)
(setq make-backup-files nil)
(setq auto-save-default nil)

Here’s an explanation of a backup scheme Xah suggests, which is more for programmers than for writers like me. I’m happy to have the autosave files mixed in with my other files.

Here’s how to fix this stupid problem. Add the following lines to your .emacs file:

;; Restore backup and autosave disabled by ergoemacs
(setq make-backup-files t)
(setq auto-save-default t)

You’ll need to then restart Emacs for the settings to take effect across all open buffers.

UPDATE II:

Xah Lee responds here!

UPDATE III:

For Windows, you want a slightly different backup scheme, since Windows isn’t smart enough to automatically ignore Emacs backup files, and they therefore clog things up.

So here’s what I use:

;; windows backup scheme
(setq backup-by-copying t)
;; make backup to a designated dir, mirroring the full path

(defun my-backup-file-name (fpath)
“Return a new file path of a given file path.
If the new path’s directories does not exist, create them.”
(let (backup-root bpath)
(setq backup-root “~/Dropbox/org-mode/win-backups“)
(setq bpath (concat backup-root fpath “~”))
(make-directory (file-name-directory bpath) bpath)
bpath
)
)

(setq make-backup-file-name-function ‘my-backup-file-name)

Explanation of the code is on Xah’s site here.

I also like to have a faster way to delete scratch files, so I use this line in my .emacs:

;; faster scratch file deletion – defining the function
(defun delete-this-buffer-and-file ()
“Removes file connected to current buffer and kills buffer.”
(interactive)
(let ((filename (buffer-file-name))
(buffer (current-buffer))
(name (buffer-name)))
(if (not (and filename (file-exists-p filename)))
(error “Buffer ‘%s’ is not visiting a file!” name)
(when (yes-or-no-p “Are you sure you want to remove this file? “)
(delete-file filename)
(kill-buffer buffer)
(message “File ‘%s’ successfully removed” filename)))))

;; bound function to C-c k
(global-set-key (kbd “C-c k”) ‘delete-this-buffer-and-file)

As the comment above mentions, you can then delete an empty scratch file with C-c k.

UPDATE V:

This page explains how to set your Emacs default directory, so that C-x C-f normally opens the location of all your org files without any navigating.

Leave a Comment

Your email address will not be published. Required fields are marked *