Emacs Undo

Roll It Back

I find undo a real help when I'm typing fast, editing and trying different things. Often I make simple mistakes and move on or retype an error. Hitting undo is such a fast way to go back.

There are a number of keys that "undo" your last "do". I use Ctrl-/.

Its fast, easily accessible and so convenient.

A feature of undo you may not know about is "undoing" your "undo".

If you keep pressing Ctrl-/ it will get to the end of your present undo cycle and start to cycle back to your very first action. This is great. You can test different text or code see how it looks and if you feel it sucks, just cycle through undo till it recalls its original state.

A key combo I use with undo is Ctrl-g, the keyboard quit command. If you cycle through undo and find its cycling back too far, hit Ctrl-g, then hit Ctrl-/. Undo will start to cycle forward. If you hit Ctrl-g, then hit Ctrl-/ again, undo will stop and cycle in the opposite direction.

Mess around with it, and see for yourself how powerful it is. Its a great tool.


Emacs Tips - Tab To Complete

Finish It

You may or may not know, when your in the mini-buffer, you can use Tab to finish your input.

Emacs will try to guess what your after and offer a few suggestions. If your trying to load a file from your home dir, you can do:

Ctrl-x Ctrl-f Start-of-Filename Tab

As long as the file name is unique, Emacs will open it for you. If its not unique, Emacs will open a buffer and display your options. Then you can either type more characters to identify the file you want, or mouse select it (boo hiss - don't use the mouse). If you can stick to the keyboard, you'll be way faster and more productive.

Give it a try.


Emacs Loading Elisp .el Files

Load 'Em Up

You will find a ton of customized Emacs Elisp files on the Net.

Getting Emacs to recognise and load these files is simple. Create a directory in your home dir. Call it whatever you like, but something relevant such as "elisp" is good.

After creating the directory we need to let Emacs know where it is and what its called.

Open your .emacs config file. This is normally located in your home directory. It may be hidden.

You can open and edit it in Emacs:

Ctrl-x Ctrl-f

Hit enter to get a list or type .emacs

Edit your .emacs file and add the path to your new directory:

; Tell Emacs where elisp .el files reside and load
(add-to-list 'load-path "~/elisp")

Add this near the start of your .emacs file before you start loading .el files.

Emacs now knows where the files reside. Start dumping your .el files in that directory.

When you want to use a new .el file, edit .emacs and add the name of the .el file. If I download "fancy.el", I tell Emacs to load it at startup:

(require 'fancy)

Don't add the .el extension, just the name of the file.


Emacs Delete To Start Of Line

Kill To Start

Emacs does not have a kill-to-start-of-line key-combo or built-in function.

There are a number of ways round this very minor problem.

1. Use Ctrl-a Ctrl-k

Ctrl-a moves to start of current line.
Ctrl-k kills to end of current line.

2. Use Ctrl-0 (zero) Ctrl-k

Ctrl-0 sends to point to zero char on the line.
Ctrl-k kills to end of current line.

3. Define a function, then bind it to unused keys.

(defun kill-start-of-line ()
"kill from point to start of line"
(kill-line 0)

Bind it to Ctrl-; right next to Ctrl-k.

(define-set-key (kbd "C-;") 'kill-start-of-line)

When you press Ctrl-; emacs deletes from cursor position to start of current line.


Google Chrome

It Shines

I have been using Google's Chrome browser for more than a year and I am most impressed. I used Firefox for several years, till I switched to Chrome when it hit the download servers.

Its extremely fast, stable and the interface is slick 'n' easy to use.

To date, I have not had Chrome lock up or crash on me, though one of the tabs went into a loop and hogged CPU cycles for a while, before I closed that tab.

Chrome seems to improve with each release.

One thing I disliked about Chrome, was the lack of an ad-blocker. That has now been fixed. For a while, I ran Chrome with a host file filtering ad sites. A plug-in is available to do the job.

Chrome works well with Google Mail.

Recent stats suggest Chrome has 5% market share, beating Apple's Safari into 4th spot.

I use Chrome on both Linux and Windows.

If you haven't tried it yet, give it a shot. You might like it.