Friday, May 30, 2008

Emacs Tip #23: set-goal-column

M-x set-goal-column  (C-x C-n)

Emacs generally tries to maintain the same horizontal position for the
cursor as you move up and down in the buffer. However, you may want
to have it "remember" a particular position when perusing a data file
of some sort - perhaps when a certain column has particular interest.

C-x C-n does just that. It sets the current horizontal position as
the goal column. You can move around the buffer however you want, but
as soon as you use C-n or C-p, you're moved back to the goal column.

To unset, just use the universal prefix:

C-u C-x C-n

Tuesday, May 20, 2008

Emacs Tip #22: blink-cursor-mode

I couldn't care less about whether or not the cursor blinks. (note proper use of that phrase, rare in this culture)

However, some people really like it, need it, and some people don't like it at all. A recent thread in comp.emacs brought this to light.

So, if you'd like your cursor to blink (or not), add the line:

(blink-cursor-mode 1) ;; or pass in -1 to turn it off

to your .emacs. By default the cursor will blink.

You can also have the cursor stretch to cover the full width of the glyph (character) under it. e.g. it'd be as wide as the tab character (should there be one in your buffer):

(setq x-stretch-cursor t)

For more documentation on cursor display, read the manual.

Monday, May 12, 2008

Emacs Tip #21: pabbrev (predictive abbreviation expansion)

pabbrev is a yet another package for abbreviation expansion in Emacs. Unlike dabbrev, this one analyzes the contents of the buffers during idle time, and shows potential expansions based on word frequency. This package also shows potential expansions as you are typing. For example if you were typing 'pred', this is what you would see:


A TAB at any time will expand the word to the shown choice. If you do not like what was chosen, you can press TAB again and get a list of possible choices from which to chose.

To use it, download the source, and add this to your .emacs:

(require 'pabbrev "/path/to/package/pabbrev.el")

Documentation can be found in the source file. (I copied the example from the code itself.)

Monday, May 5, 2008

Emacs Tip #20: Exiting Emacs

I almost never use this tip, but some might find it handy:

    C-x C-c
That is the key-binding to exit emacs, it runs save-buffers-kill-emacs, and the documentation for exiting emacs can be read here: Exiting - GNU Emacs Manual