Ideal Line Length

Did You Know That?

Scientific research has shown the ideal line length is approximately 60 characters. If its longer that 60, the eye has to scan an uncomfortable distance or even crank your neck. Narrow pages are much easier to read.

This explains why newspaper columns and magazine articles are set to such narrow widths.

The next time you build your website, keep the width down around the ideal figure.

. . .

Using CSS To Centre Content

Cleaner Code

If you've used tables in your html page design and moved to CSS, the shift away from tables and using CSS is a little different.

If you want to centre a page in CSS. First create centred liquid layouts:

body { text-align: center; }

#content {
margin-left: auto;
margin-right: auto;
width: 500px;
text-align: left;

First we center the body, then we set the left and right margins to auto so they adjust to the width of the browser. This creates text that's centred. To correct that we set the text to left align.

. . .

Emacs Sort Lines

Get In Order

Sorting lines in Emacs is pretty simple. Press Ctrl-spc to set the mark on the first line. Navigate down to the last line you want sorted. The selected range should be highlighted.

Press M-x key and the focus will jump to the minibuffer, then type sort-lines:

M-x sort-lines

Emacs will take of the rest. Your selection will instantly be sorted.

. . .

Caps_Lock As Ctrl Key In Windows 7


To make that redundant, least used and greatly loathed key on the keyboard, the Caps Lock key, do something more useful, you need to make it become a Ctrl key.

In Linux its an easy task. I run Ubuntu 9.10 with the Gnome desktop, and a drunk monkey can do it.

In Windows 7, its not so easy. You can hack the registry but, then if you mess with it, Windows may go on strike. A simpler way is to use AutoHotkey, an open source program to remap they keyboard keys to something other than the default.

Download and install AutoHotkey, when started it opens its config file. Add the following to map Caps Lock to Ctrl so you have two Ctrl keys. I have this setting in Ubuntu.


The config file is named autohotkey.ahk. Save the file, then restart AutoHotkey.

Automagically your redundant Caps_Lock key is useful.

. . .

Ubuntu Swap Caps Lock & Control Keys

Ubuntu Gnome

If your running Ubuntu with the Gnome desktop is simple to swap Caps Lock and Control keys. Do this:

Click System > Preferences > Keyboard > Layouts > Layout Options > Ctrl key position

Here you can select:

Swap Ctrl and CapsLock


Make CapsLock an additional Ctrl

I selected the latter as I never use Caps Lock. I find it a pain, when I sometimes hit it and find I type text in UPPERCASE.

So I went with an additional Ctrl key.

. . .

Emacs Swap Caps Lock & Control Keys

.xmodmap File

If you use Emacs to do your editing you may find the left control key [Ctrl] is placed badly for regular fast usage. You can switch the control key with the Caps Lock key quite easily in Linux. You need to create a .xmodmap in your home directory. Add the following lines:

! Swap Caps_Lock and Ctrl_L
remove Lock = Caps_Lock
remove Control = Control_L
keysym Control_L = Caps_Lock
keysym Caps_Lock = Contrl_L
add Lock = Caps_Lock
add Control = Control_L

Save the file as .xmodmap and log out your account or restart the x server.

. . .

Ubuntu Launching Apps

From The Keyboard

You launch applications by clicking icons on the desktop, in Nautilus file manager, or from the Start Menu. There is another way to launch apps, from your keyboard.

For example, if your typing in a text editor and you need to open browser to search an item, you can launch Chrome or Firefox from the keyboard. Here how:

Press Alt-F2 and a dialogue box opens asking which application to run. Enter the name of the application and it will start.

You need to know the name of the program as some have longer names than your used to.

If you do Alt-F2 and type Chrome, the system responds with:

Could not open location /home/stray/chrome, as it can't find the program.

The Chrome browser is actually named google-chrome.

Type Alt-F2 and enter google-chrome and the Chrome browser opens. To open Emacs 23 just type emacs. For Gedit text editor enter gedit and for a Terminal type gnome-terminal.

As you type the system guesses which program your looking for and attempts to complete the program name for you. As you keep typing it will change what it thinks you want.

You can find the names of the programs you regularly use by right-clicking on the application icon and selecting properties. Its listed after Command.

Its a fast way to launch programs and applications.

. . .

Ubuntu Desktop Icons

Gone Gone

The new install of Ubuntu 9.10 comes with no desktop icons. The desktop is a clean empty space. Nice. But its useful to have a file manager and browser icon for fast access.

The Chrome browser icon you can drag from the start menu. Getting the Home directory icon on the desktop takes a little more work. Here how to do it.

Click Applications > Accessories > Terminal.

This opens a Gnome Terminal. Type into the Terminal gconf-editor and a window opens.

Click apps > nautilus > desktop

On the right side the program window displays a list of items on the desktop and whether they are visible or not. Home_icon_visible is unchecked. Click it to put a check mark and change its value.

You can do the same for trash_can, computer_icon, network_icon and mounted volumes.

. . .

Install Google Chrome On Ubuntu

Chrome On Linux

Installing Google Chrome on Ubunutu or Debian Linux is pretty easy. Go to:

Scroll down to the Linux section and select the right package for your hardware (32-bit or 64-bit). Click on the package to start the download.

On next page agree to the Terms of Service by clicking on: Accept and download. After completion click the .deb file to start package install. Click on Install Package and give password.

Installation should complete.

Launch Chromium to test your new browser.

. . .

Remove Unwanted Fonts - Ubuntu

Purge Those Fonts

I wanted to remove unwanted fonts from new Ubuntu 9.10 installation. I googled and found a couple of articles.

This article suggested the following:

sudo apt-get remove ttf-kochi-mincho ttf-kochi-gothic ttf-arabeyes ttf-arphic-ukai ttf-arphic-uming ttf-baekmuk ttf-bengali-fonts ttf-devanagari-fonts ttf-gentium ttf-gujarati-fonts ttf-indic-fonts ttf-kannada-fonts ttf-kochi-gothic ttf-lao ttf-malayalam-fonts ttf-mgopen ttf-oriya-fonts ttf-punjabi-fonts ttf-tamil-fonts ttf-telugu-fonts ttf-thai-tlwg ttf-unfonts-core ttf-indic-fonts-core ttf-wqy-zenhei

I ran it with some success. There were still a few odd fonts left.

Another article offered other suggestions.

"Use synaptic. Do a search in synaptic for "ttf-" and you'll get a list of all fonts. Mark to uninstall the fonts you don't want and click apply." Credit to fragos:

Hopefully that removes all the unused, unwanted fonts on Ubuntu.

Ubuntu 9.10 Enhance

The List

1. Install Emacs

2. Install Chromium Browser

3. Install MS Web Fonts

4. Install MPlayer Media Player

5. Install Rar/Unrar

6. Install Flash plugin to Chromium

7. Add Emacs Config .emacs

8. Add XTerm Config .Xdefaults

9. Change Theme & Desktop

10. Change System Default Fonts

Falko Timme has a couple of nice HowTo's for setting up Ubunto 9.10 as a complete desktop system.

The Perfect Desktop - Ubuntu 9.10 (Karmic Koala)

The Perfect Desktop - Ubuntu Studio 9.10

Add Fonts In Ubuntu

Manually Adding Fonts

If you have a set of fonts you wish to add, it can be done manually. Its a fairly simple process.

1. Open a Gnome-Terminal as root
$ sudo gnome-terminal (give password)

2. Change to system fonts directory
# cd /usr/share/fonts/truetype

3. Create new directory to hold your new fonts
# mkdir ttf-newfonts

4. Change to new directory
# cd ttf-newfonts

5. Copy fonts from your home directory to system fonts directory
# cp ~/fonts/* .

6. Change ownership to root
# chown root.root *.ttf

7. Run fc-cache to update system
# fc-cache -fsv

On completion system will display results.

MS True Type Core Web Fonts

Adding The Fonts In Ubuntu & Debian

To add Microsoft True Type Core Web Fonts, do:

sudo apt-get update

sudo apt-get install ttf-mscorefonts-installer

This auto installs the Web Fonts.

The fonts should be available right after install.

XTerm & Inconsolata Font

Inconsolata 11

In Ubuntu or Debian, do:

sudo apt-get update

sudo apt-get install ttf-inconsolata

Select Y when asked to continue. The install should run to completion.

Using The Font In XTerm

To launch an XTerm with Inconsolata 11 font, do:

xterm -fa inconsolata-11

The XTerm will now use the font for the current session.

Wordpress Page Links

Link Jump

To create a link to another post on the same page or another location in the same post do this:

<a href="#a">link words </a>

This is the link itself.

<a name="a">the place to land</a>

This is the anchor the link points to.

Thats it.

Emacs Dot Old File

Emacs Config

Here's .emacs config file:

;; Emacs Init File ------------------------------
;; 2009-09-03

;; Eliminate delay for set-default-font
;; --------------------------------------
(modify-frame-parameters nil '((wait-for-wm . nil)))

;; 10 Ways to Improve Productivity With Emacs
;; ------------------------------------------

;; Item 1: Swap Caps-Lock and Control
;; !
;; ! Swap Caps_Lock and Control_F
;; !
;; remove Lock = Caps_Lock
;; remove Control = Control_L
;; keysym Control_L = Caps_Lock
;; keysym Caps_Lock = Control_L
;; add Lock = Caps_Lock
;; add Control = Control_L

;; Item 2: Invoke M-x without the Alt key
;; To enable Ctrl-x Ctrl-m sequence add following to .emacs

;; (global-set-key "\C-x\C-m" 'execute-extended-command)
;; (global-set-key "\C-c\C-m" 'execute-extended-command)

;; Item 3: Prefer backward-kill-word over Backspace
;; ------------------------------------------------
(global-set-key "\C-w" 'backward-kill-word)
(global-set-key "\C-x\C-k" 'kill-region)
(global-set-key "\C-c\C-k" 'kill-region)

;; Item 4: Use incremental search for Navigation
;; ---------------------------------------------
;; Ctrl-s Forward search
;; Ctrl-r Backward search

;; Item 5: Use Temp Buffers
;; ------------------------
;; Ctrl-b
;; Name them anything like asdlkj
;; Save them with Ctrl-x Ctrl-w
;; You'll be asked for a filename

;; Item 6: Master the buffer and window commands
;; ---------------------------------------------
;; Important commands to master are:
;; Ctrl-x 2 split-window-vertically
;; Ctrl-x 3 split-window-horizontally
;; Ctrl-x + balance windows
;; Ctrl-x o other-window
;; Ctrl-x 1 delete-other-windows
;; Ctrl-x 0 delete-this-windows
;; Ctrl-x Ctrl-b list-buffers

;; Item 7: Lose the UI
;; -------------------
(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
(if (fboundp 'menu-bar-mode) (menu-bar-mode -1))

;; Item 8: Learn the most important help functions
;; -----------------------------------------------
;; M-x describe-bindings
;; M-x apropos-command 'some word'

;; Item 9: Master Emacs's regular
;; ------------------------------
;; Learn Regular Expressions

;; Item 10: Master fine-grained text manipulation

;; Set Ctrl-h as backward delete
;; -----------------------------
;; Taken from

;; Translate C-h to DEL
(keyboard-translate ?\C-h ?\C-?)
;; Define M-h to help --- please don't add an extra ' after help!
(global-set-key "\M-h" 'help)

;; Taken from
; Disable startup message
(setq inhibit-startup-message t)

; Disable file backup
(setq make-backup-files nil)

; Disable file saves
(setq auto-save-list-file-name nil)

; Disable auto-save
(setq auto-save-default nil)

; Enable search highlight
(setq search-highlight t)

; Enable replace highlight
(setq query-replace-highlight t)

; Enable mouse highlight
(setq mouse-sel-retain-highlight t)

; Set region background color
(set-face-background 'region "orangered")

; Set region foreground color
(set-face-foreground 'region "white")

; Set background color
(set-background-color "white")

; Set default font to Misc 9x15
(set-default-font "-Misc-Fixed-Medium-R-Normal--15-140-75-75-C-90-ISO8859-1")

; Experiment with fonts
; I copied this from somewhere.
; The fonts look okay but they are not anti-aliased.
; Font preference
;(add-to-list 'default-frame-alist
;'(font . "-bitstream-bitstream vera sans mono-medium-r-normal-*-14-*-100-100-*-*-iso8859-*"))

; Following taken from:

; Disable scroll jump
(setq scroll-step 1)

; Enable line number in mode line
(line-number-mode 1)

; Enable column number in mode line
(column-number-mode 1)

; Set cursor color to blue
(set-cursor-color "blue")

; Disable blinking cursor
(blink-cursor-mode nil)

; Disable beep. Flash on error
(setq-default visible-bell t)

; Highlight selected text - Ctrl-Space
(transient-mark-mode t)

; Spaces instead tabs
(setq-default indent-tabs-mode nil)

; Delete selected/highlighted text
(delete-selection-mode t)

; Re-Map M-<> to Ctrl-x e
(global-set-key (kbd "C-x e") 'end-of-buffer)

; Enable highlight bracket pairs
(show-paren-mode t)

Wordpress Backup


I've been running a Wordpress blog around six months now. I had a problem a few nights back that prevented me logging into Wordpress.

As a Wordpress newbie, I followed the Wordpress guide for backing up the MySQL database. I saved the xxxxxx.sql backup file to disk. As a precaution, I also copied all the blog entries and photos I found, along with the blog text.

I was running Wordpress 2.6, and decided to upgrade to the latest 2.85 version. After installing 2.85, I followed Wordpress upgrade guide which described the procedure for restoring a backed up database. It didn't work. Ideally the restore would have run as the guide described.

I put these notes together for guidance the next time I need to upgrade, backup, restore. Hopefully these may help some poor soul who's having Wordpress dB problems.

Backing Up Wordpress MySQL Database

The back up process is a 2 or 3 stage process. All text and links are stored in a MySQL database, and you must back it up or lose all your blog entries. All the text, everything you write, along with the links, are stored in a MySQL database.

Stage 1 - Copy MySQL database
Stage 2 - Copy Wordpress folder/files
Stage 3 - Restore MySQL database
Stage 4 - Restore Wordpress folder/files

It goes something like this:

1. Back up MySQL database using phpMyAdmin
2. Copy backed up xxxxxx.sql database file to safe location
3. Copy Wordpress folder to safe location
4. Install new version of Wordpress (if needed)
5. Restore MySQL using phpMyAdmin
6. Copy wp-config file (to new install)
7. Copy uploads folder (to new install)
8. Copy themes folder (to new install)
9. Copy plug-ins folder (to new install)

To start the back up process you need to find MyPHP-Admin and launch it. The links to start it will be buried somewhere with your MySQL stuff. You'll have to go to your hosting control panel and dig around in the MySQL section for a link or button to start it.

Here's the official Wordpress backup page. With phpMyAdmin running, follow these instructions and complete the MySQL backup.

Wordpress have a more detailed Upgrade page. Its useful and worth a read.

Next, find the directory where your Wordpress files are located on disk and copy all the files located there. They're in a folder called Wordpress. Copy this folder to your computer's hard disk. This holds all the images and some config details about your blog. The most important are:

wp-config.php file
wp-content folder
wp-content/themes folder

wp-config.php contains data the MySQL database. Namely which database contains our data, the username and password to accesss the database. We need to copy this data from the old MySQL config file to the newly installed one.

To avoid confusion I renamed my old config file wp-config-2.6 and copied the new one to wp-config-2.85, so I had an original copy in case I made any errors.

Open the original-2.6 config file in Emacs, Notepad or similar text editor, and open the new wp-config.php file side by side. The most important lines we need to copy are:

/** The name of the database for WordPress */
define('DB_NAME', 'Database_Name_Here');

/** MySQL database username */
define('DB_USER', 'Your_Name_Here');

/** MySQL database password */
define('DB_PASSWORD', 'Your_Password_Here');

/** MySQL hostname */
define('DB_HOST', 'MYSQLHOST');

Copy the data across to the new config file and save it.

Copy wp-content/uploads folder (contains your images)

Copy wp-content/themes folder (contains your themes)

Copy wp-content/plug-ins folder (contains your plug-ins)

Surf across to your blog and see if it works. If you hit problems the Wordpress support forums is a good starting place.

I found a Wordpress page to Back Up Your Wordpress Site. Its worth a read.

Telecomm Terms

Brief Overview

3G explained
* connects your phone to the Internet at broadband speeds
* enables rapid web browsing and downloading emails with large attachments
* fast enough for video streaming and video calls
* talk while data transfers take place, unlike older EDGE and GPRS technology
* works at up to 384kbps, increasing to as much as 10Mbps in the future

3G is short for “third generation”. It’s actually a technology called WCDMA (Wideband Code Division Multiple Access) which provides very fast data transfers to and from mobile phone handsets, allowing you to connect to the internet from your mobile phone at broadband speeds.

So with a 3G-enabled phone you can browse the web, send and receive emails with large attachments, synchronise your phone with your PC calendar or company intranet, and download ringtones and games very quickly. WCDMA is even fast enough for video streaming and making video calls.

Unlike older technologies such as EDGE (sometimes called 2.5G) and GPRS you can do all this at the same time as talking, and since you are only charged for the data you transfer – not the time you spend online – you can keep your phone connected to the internet to receive emails as soon as they come in.

GSM (Global System for Mobile Communications)
* Provides basic data services
* Provides voice service through digital network
* SIM card (Subscriber Identity Module card) stores phone number, connection information, and may store an address book.
* This allows a user to switch devices without needing to contact the service provider.

Note: BlackBerry’s can not send / receive email, PIN’s, or browse the internet with only GSM (GPRS is required).

GPRS (General Packet Radio Service)
* Extends the GSM network
* Allows for advanced data services
* Use device as Modem
* Use device as web-browser
* Data transmission is significantly faster than GSM (up to 54 kbps)

Note: 'gprs' (without the capital letters) aka 'Sleeping gprs' on a blackberry indicates that service exsist; but your device cannot register on it. Try recycling the handset or the radio.

GPRS in brief

lets you browse the internet, instant message and download programs or files
keep your connection active all the time
have your personal or work emails sent to your phone as they arrive
play online games
get personalised news, sports, finance or entertainment updates

What is GPRS? GPRS is a technology that allows you to transfer data between your phone and other networked devices. Transferring data with GPRS is significantly faster than using Circuit Switched Data (CSD or GSM data), but not as fast as EDGE or 3G

Data transfer is typically around 53.6-80 kilobits per second (kbps) depending on your phone’s GPRS class, compared with 14.4 kbps for GSM. This means faster internet browsing, instant messaging and downloading. For even faster data transfer, look for a GPRS phone with EGPRS (Enhanced GPRS or EDGE) which operates up to 236.8 kbps or 3G/WCDMA, which can transfer at up to 384 kbps.

Unlike voice calls and dial-up Internet connections, with a GPRS mobile phone you pay for how much you transfer, not for how long you're connected. You can keep your phone GPRS connection active all the time if you like, which is handy if you need to know as soon as office email arrives, for instance.

CDMA (Code Division Multiple Access)
* Technology is patented by Qualcomm
* As such all CDMA BlackBerry’s use Qualcomm processors and network technology.
* More expensive to build then GSM / GPRS devices
* Processor is slower than on the GSM / GPRS devices
* BlackBerry’s use CDMA 1x
* Provides maximum data rates up to 300 kbps
* Only a small fraction (50 – 60 kbps) of this is available today

Mobitex (Two-way packet-switch network)
* Originally designed for text pagers
* Used by the BlackBerry 95x, 85x
* Network coverage is limited to metropolitan areas
* Radio uses very little power, allowing batteries to remain charged for several weeks
* Mobitex devices are being phased out by Research in Motion

EDGE (Enhanced Data for Global Evolution)
* An extension to the GSM / GPRS networks
* More than three times faster than GPRS
* Average download speed of 100 – 130 kbps
* Burst speeds up to 200 kbps

Not included:
* TDMA (Time Division Multiple Access)
* FDMA (Frequency Division Multiple Access)

EDGE in brief

a fast, easy way for phones to connect to the internet and transfer data
can be used to browse the Web or check emails
fast downloads of music, games and videos
works abroad on most networks
stay connected permanently – pay only when you use it

What is EDGE?

EDGE (Enhanced Data for Global Evolution) is a way for phones to connect to the internet and send and receive data very quickly, using the mobile phone network. It can work on all digital (2G) networks, and since it offers data speeds which may be close to speeds offered by 3G networks, EDGE is sometimes known as a 2.5G technology.

An EDGE-enabled phone can stay connected to the Internet all the time – so your phone's email program can check for new messages every few minutes, for example. The connection is fast, so you can easily surf the web without waiting long for pages to load, and you pay only for the amount of data transferred, not the time your phone is online.

If you need to make or take a call, your EDGE connection is automatically suspended while you talk.

WAP in brief

use a WAP browser to access the web from your phone
WAP sites are small and simple and can be downloaded quickly
get train schedules or traffic updates from your phone
catch up on the latest news when you’re on the move
use your WAP browser to shop or bank online

What is WAP?
A WAP (Wireless Access Protocol) browser allows you to access web pages that were written specifically for mobile internet users.
With a WAP browser, you can do many of the same things you can do with your PC-based web browser. You can check news or sport updates, get train schedules, or search for addresses or phone numbers, all when you’re on the move.

While it may not look like the web you’re used to, pages download quickly, making it easier to access the information you need even if you’re away from your computer.

WAP pages are written in Wireless Markup Language, or WML, which was designed with mobile users in mind. Pages written in WML take into account the small screen, limited colours and slower connection speeds of mobile devices.

Setting Environment Variables In Windows

For Emacs

Emacs requires a couple of environment variables to help it work properly. Emacs likes to have HOME DISPLAY PATH set.

To set these in Windows, do this:

Start > Control Panel > System and Security > System > Advanced System Settings > Environment Variables > New

Variable name: HOME
Variable value: C:\Users\YourName\Documents

Start > Control Panel > System and Security > System > Advanced System Settings > Environment Variables > New

Variable name: DISPLAY
Variable value: localhost:0

Start > Control Panel > System and Security > System > Advanced System Settings > Environment Variables > New

Variable name: PATH
Variable value: C:\Program Files\emacs-23.1\bin;

Click OK to save and close.

If the PATH variable is already set, add your path value at the beginning.

Emacs Spaces Not Tabs

Why You Should Use Spaces Not Tabs

Tabs are not handled the same way by all text editors. The length of a tab varies. If you use tabs, you often end with some spaces and some tabs. If somebody opens your file in different text editor to the one you used, the tabs may be displayed in a different size. The indentation will differ and will result in confusion.

So, stick to spaces and forget the tabs.

How Many Spaces?

Use 4 spaces, its just right. 2 spaces is too few. 8 is too many.

2 spaces are harder to see. 8 spaces can cause the code to run off the screen.

Most text editors can convert tabs to spaces. Set the indentation to 4 spaces.

Emacs Spaces Not Tabs

To setup Emacs to insert 4 spaces when you hit the tab key, add this to your .emacs file:

(setq-default indent-tabs-mode nil);
(setq default-tab-width 4);

Save the .emacs file and re-start Emacs to for changes to take effect.

Emacs Commands

Useful Commands

List of useful Emacs Commands

Key Abbreviation

C-x denotes pressing the 'Ctrl' key and 'x' key together.

M-x denotes pressing the 'Alt' key and 'x' key together.

C-x h denotes pressing the 'Ctrl' key and 'x' key together, then pressing the 'h' key on its own.

Starting & Stopping

Emacs - start emacs
C-x C-c - exit emacs (Why would you do that?)

Movement Actions

C-f - forward one character
C-b - back one character

C-n - next line
C-p - previous line

C-a - start of line
C-e - end of line

M-f - forward a word
M-b - backward a word

M-a - start of sentence
M-e - end of sentence

M-} - start of paragraph
M-{ - end of paragraph

M-< - start of buffer
M-> - end of buffer

C-v - down one screen/page
M-v - up one screen/page

C-l - clear screen

File/Buffer Actions

C-x C-f - open file
C-x s - save buffer

C-x C-s - save file
C-x C-w - save as file (save to new name)

C-x C-c - exit Emacs (You never need this!)
C-z - suspend Emacs
C-g - abort current action

C-x C-f - open another file in the session

C-x C-v - open alternative file
C-x i - insert file into current buffer

C-x b [Return] - opens default buffer
C-x b [OldFile] - opens buffer [OldFile]

C-x b [NewFile] - creates new buffer [NewFile]
C-x C-b - opens buffer list

C-x z - repeat command 1 x time
C-x z z - repeat command 2 x times
C-x z z z z - repeat command 4 x times
Each additional "z" repeats the command once more

Delete/Edit Actions

Backspc - delete character left

C-d - delete character right
C-h - delete character left (I modified emacs)

M-d - delete word right
M-backspc - delete word left (I dont use this. see below)

C-k - delete to end of line (hold deleted in kill-buffer)
M-k - delete to end of sentence

C-y - paste last deleted text item
(retrieve kill-buffer content)
M-y - paste next deleted text item
(cycles thru kill ring buffer)

C-w - cut the currently selected text, and copy
M-w - copy highlighted text without cutting

C-x h - highlight whole file
C-space - begin highlight text

C-o - insert new line
C-x C-o - delete consecutive blank lines

Search/Replace Actions

C-s - forward incremental search
C-r - backward incremental search
C-s [Return] C-w - forward word search

M-% - query replace (interactive)
M-% spc (or y) - replace and show next instance
M-% del (or n) - skip and show next instance
M-% . - replace this instance and quit
M-% , - replace and pause (spc or y to continue)
M-% ! - replace all don't ask
M-% ^ - back to previous instance
M-% [Return] - exit query-replace (q also quits)

C-n [command] - repeat command n times
M-n [command] - repeat command n times

C-u [command] - repeat command 4 times
C-u C-u [command] - repeat command 16 times

Paragraph/Region Actions
C-@ - mark start or end of region
C-spc - mark start or end of region

C-y - paste region or deleted text
M-y - paste earlier deletion

C-t - transpose chars
M-t - transpose words
C-x C-t - transpose lines

M-c - capitalize word
M-u - upcase word
M-l - downcase word

Ctrl-w normally cuts current selected text but I modified it to kill-to-start-of-line. Its the opposite of Ctrl-k, kill-to-end-of-line. Now if I'm editing in the middle of text and its wrong I can kill-to-start-of-line and re-do. Or I can kill-to-end-of-line and re-do.

Another change I implemented was to remap Ctrl-h. This no longer calls help but deletes the character to the left. Similar to the command line edits in bash shell.


C-x u - Undo
C-x / - Undo

Window Control

C-x o - jump to other buffer (thats 'o' not zero)
C-x 1 - close other buffers

C-x 2 - split buffer horizontally
C-x 3 - split buffer vertically

C-x C-b - display all buffers
C-x b - move to another buffer


C-h ? - get more info on help
C-c ? - like apropos (prompted for text. All symbols with text displayed in a buffer).


C-h b - display the keybindings in effect (C-h brings up help)
C-c C-p - display earlier command (repeated C-c C-p cycle through earlier commands)

C-c C-r - prompted in minibuffer for text. (most recent command with text displayed)
C-c a - display argument list in minibuffer (prompted for function name. Defaults to nearest symbol).

Shell Actions
M-x shell - start shell session
M-x eshell - start emacs shell session
M-! - execute shell command

Spell Check Actions
M-$ - spell check word

Recursive Editing Levels

M-x top-level [Return] - exit recursive editing
; If you get stuck in recursive editing levels, do above

M-x set-buffer-file-coding-system unix - change DOS file to Unix
; Will convert file unix from dos or windows format
; Note: You need to save the file.
; Ctrl-s - to save file in new unix format

M-% replace-string Ctrl-q Ctrl-m [Return] [Return]
; Delete ^M end-of-line chars

M-x - describe key
; Example Alt-x 'describe-key' M->
; M-> runs the command end-of-buffer