Windows Keyboard Shortcuts FAQ

Perm url with updates: http://xahlee.org/mswin/windows_keyboard_shortcuts_faq.html

Windows Keyboard Shortcuts FAQ

Xah Lee, 2009-12-16, 2010-07-31

This page is some frequently asked questions about defining, disabling keyboard shortcuts in Microsoft Windows. For the standard shortcuts, see: Microsoft Windows Keyboard Shortcuts.

How to disable the Sleep key on the keyboard?

Go to the Control Panel, click on Classic View, then Power Options. There's a setting you can set.

How to disable the Caps Lock key, or the Windows key?

There's no built-in way to do that with Windows Vista. You need a keyboard remapping software. The following are some solutions:

See also: Why You Should Not Swap Caps Lock With Control.

Is there a way to set a hotkey to launch a app?

In the Taskbar, you can turn on the Quick Launch toolbar. (right click on a empty area in Taskbar, then Properties, Toolbars tab.) When Quick Launch toolbar is on, you can drag any shortcut files to it. Also, each shortcut file also automatically creates keyboard shortcut for it, that's Win+1, Win+2, ..., corresponding to the order of the shortcuts in the Quick Launch bar. You can drag them around to change their order.

When you press Win+n or click a button in the the Quick Launch, it will always launch a new instance of the app, not just switch to it. (except apps designed to run only one single instance. e.g. Skype, Outlook, Outlook Express, Windows Mail, Windows Live Mail, Second Life , ... etc.)

See also: Windows Start Menu, Desktop, Quick Launch, File Locations.

Is there a way to have a hotkey to switch to a app? That is, launch it if it is not running, otherwise just switch to it.

Yes. Create a icon shortcut of the apps you want to launch. Then, right click on it and select Properties. Click in the box in the “Shortcut key” field, then type a shortcut you want. The shortcut must be one of “Ctrl+Shift+‹key›”, “Ctrl+Alt+‹key›”, “Ctrl+Shift+Alt+‹key›”.

Alternatively, you can use the keyboard macro software such as AutoHotkey. See AutoHotkey Example Scripts for a example of how to do this.

How to set a key to switch language input system?

Go to Control Panel, click on “Regional and Language Options”, then “Keyboards and Languages” tab, then click on “Change keyboards...” button, then the “Advanced Key Settings” tab.

How to change to Dvorak keyboard layout?

Go to Control Panel, click on “Regional and Language Options”, then “Keyboards and Languages” tab, then click on “Change keyboards...” button.

How to disable Ctrl+Shift+S for popping up HP Support Info?

All you have to do is find the alias to the executable, get its properties panel, Shortcut tab, then disable the key there. See: Disable Ctrl+Alt+S of HP Support Information.

When i press “Ctrl+Alt+Shift+3”, the MediaSmart DVD starts. How to disable this shortcut?

All you have to do is find the file shortcut that points to the program, open its properties panel, Shortcut tab, then disable the key there.

How to setup my own shortcuts?

You need to have a keyboard macro software. See: How To Create Your Own Keybinding In Microsoft Windows.

Is there a central place to manage all keyboard shortcuts that Windows uses?

No. For example, “Win+1”, “Win+2” etc keys are used to launch apps and is set in TaskBar's on Quick Launch bar. Switching keyboard language and layout shortcuts is set under the “Regional and Language Options” in Control Panel. Sticky keys are set in the “Ease of access Center” control panel. Disabling the Sleep key or Power on/off key are set in Power Options under Control Panel, etc.


Emacs Idolization: Have You Read the Emacs Manual From Cover to Cover?

Perm url with updates: http://xahlee.org/emacs/emacs_manual_cover_to_cover.html

Emacs Idolization: Have You Read the Emacs Manual From Cover to Cover?

Xah Lee, 2010-07-29

Thien-Thi Nguyen wrote:

Why does the search start with Google (and continue with other downstream, non-terminating, whirlpool-shaped, out of date, referenda)? Why not go to the source?  The Emacs Lisp manual, the Emacs Lisp code, the Emacs customization facility, the Emacs *scratch* buffer, the Emacs!

Elena wrote:

Surprisingly enough - or not? - it seems few users do read the manuals... I'm guilty of this too (and Emacs' manuals will be my reading on my next vacations).

I always thought of doing this, but it never happened. Not the emacs manual, nor the elisp manual. Over the past 12 years of using emacs daily, i have read perhaps 1/3 of the emacs manual and 1/2 elisp manual, counted in a accumulative way. The few times i tried to read emacs manual systematically in the past years, usually didn't last for more than 2 hours.

However, i have read cover to cover, word for word, systematically in a continued setting, several programing lang or software manuals. Some of these software are quite more deeper than emacs. Here they are from my recollection.

(Note: emacs manual for emacs 22 is 589 pages in printed form, and elisp manual for emacs 21 is 900 pages.)

Microsoft Word Manual

Microsoft Word manual i think i've read most of it in about 1992. Though, i can't remember i actually read the manual or just become expert by using and scanning the doc when needed. (i stopped using Microsoft Word about 1998.)

HP-28S Advanced Scientific Calculator

HP-28S Advanced Scientific Calculator manual. (2 books) I read cover to cover, twice, in about 1991. In fact this is how i learned programing, my first computer language, and the first i mastered.

(See: HP-28S Advanced Scientific Calculator and Xah Lee's Computing Experience Bio. )

The Mathematica Book

Mathematica manual (aka the Mathematica Book amazon ). I've read it 3 times in separate years, systematically, from cover to cover. This all happened in 1990s. Note that Mathematica the language, the subject it deals with, is inherently a order of magnitude more complex than emacs. The Mathematica book is 1381 pages, 3 kilograms. Heavy enough to hit someone to cause concussion.

This 4th edition published in 1999, is the last printed edition. They no longer print it nor come with the software. Note how commercial orgs have adopted changes with the changing industry.

The Perl Book

The Perl Book. I've read basically cover to cover in about 1998, 1999. (yes, i own the printed book. The printed book aka The Camel Book is edited version of Perl's man pages. Actually i've read all major perl books from 1997 to ~2000. (See: Pathetically Elational Regex Language (PERL))

The Unicode Standard, Version 3.0

Read the whole printed version of the “The Unicode Standard, Version 3.0” amazon , in ~2000, word for word. (1072 pages; though half of it is character table.) (See also: Unicode Related Tutorials and Essays.)

PHP manual

The PHP manual (online). Roughly read reasonably all of it in about a week, in 2005. (scanned in detail on parts that do not require detailed understanding at first.)

MySQL manual

MySQL manual, online. Read it at the same time i read PHP manual from cover to cover, in 2005. Took me about week or two. I've been working with SQL or variants daily in a day job during 1998 to 2002, but haven't touched it for 2 years. So this reading is to brush up my SQL, as well as first time comprehensive reading of MySQL documentation in particular.

Habit of Reading Manuals

Reading manuals systematically is kinda a habit, developed from early 1990s as part of a method to study English, and also somewhat a old-fashioned and stubburn mindset of wanting to learn everything from ground up, thoroughly, and from the original source. Reading manuals, is also how i learned most of my proprograming. Just about any software, language, OS, i used from about 1991 to about early 2000s, i tried to read their manuals systematically from cover to cover, not missing a word. This mentality and its severity, waned gradually over the past 20 years. Today, i do not take the pain to systematically read manuals of any new software i have to learn. (if it exists at all; or isn't some haphazard wiki, or random notes by coder joe (such as Python's docs. See: Python Documentation Problems).)

(other manuals i've read quite a lot for example: vast unix man pages, Apache 1.x, Sun Microsystem's Solaris 8 (3 volumes) (~1999), Scheme R4RS (~1998), Java (~1999 to ~2006), Microsoft's JScript (~2005), Python (~2005), Mac OS X Server official doc from Apple, ... (See: Examples Of Quality Documentation In The Computing Industry) )

Is Emacs Godsend?

Elena wrote:

Emacs is too much a complex (not difficult) and powerful software to be used by intuition alone, unlike many softwares we are used to.

This is simply not true.

For example, from personal experience, Blender, Second Life both are more complex than emacs, both for learning it, as well in terms of effort or complexity of their implementation, as well as inherent complexity by the nature of these software's purpose.

Second Life i've been using for about 3 years now. (See: A Photographic Tour of Life in Second Life.)

Blender i started to learn this year... but quite too complex and difficult to get started.

I'd say, Blender or Second Life, each, are a order magnitude more complex and rich than emacs. Either considered from simple use aspect, or in-depth use aspect such as coding in their scripting languages to use them fully. (akin to coding emacs lisp. See: Second Life 3D Build Tutorial, LSL Scripting Tutorial.)

Also, depending on what you mean by use... for example, if you take the perspective of emacs lisp as a language, then, compared to programing Java, C, C++, all are quite richer than elisp and takes longer to explore before reaching diminishing returns. If you take the perspective of emacs as programing framework for creating applications such as file manager, ftp client, irc client, mp3 manager, etc, then, compared to proper software frameworks such as Mac OS and Windows, both are a order far more complex, of bottomless learning depth, as well far more powerful.

Emacs Cult and Idolization

Am writing this because i want to dispel the cult phenomenon surrounding emacs. On the net we often hear some magical qualities about emacs, but i think if you look at it seriously, usually much of it are not meaningful.

Since this issue kept cropping up in my mind over the past ~5 years, in argument with many old-time emacs users, i thought about the question: whether there is claim we can make that gives the air of superiority or god-like quality of emacs, yet is meaningful by verification and can be justified.

I think to that question we need to be concrete and specific. If a claim is made concrete, then its veracity can be more easily judged. For examples, the following i think can be claimed:

  • Emacs is the most suitable tool for text manipulation tasks that are complex and not-well-defined and requires interactive human watch. (See: Why Emacs is Still so Useful Today.)
  • Emacs is most flexible, customizable, user extensible text editor.
  • Emacs is the most well known and widely used editor that has a embedded programing language for text editing.
  • The Emacs system with Emacs Lisp is probably the most versatile computer language for text processing. (See: Text Processing: Elisp vs Perl.)

The above claims are still not so precise, but are items i think can be reasonably justified. Or can be made more precise, so that the sum of them can make sense, and conclude that emacs is quite powerful and versatile.

On the other hand, the following i think are in the category of myths:

  • ? Emacs manual would rank among the top 100 best in today's software.
  • ? Emacs's keyboard system is among the better designed, in its efficiency, or extensibility, or consistency, or ergonomics.
  • ? Emacs keyboard shortcuts and the way they are mapped to emacs's text manipulation commands, is a very efficient system. (e.g. ratio of number of commands to call over arbitrary text manipulation tasks)
  • ? Emacs is among the top one thousand major software today, with respect to of importance to society, or number of users, or software quality.
  • ? Emacs and system is among the top one thousand software with respect to the software's power, or versatility, or usefulness.
  • ? Emacs's implementation considered as a software project today is among the top one thousand software in terms of complexity, size, or achievement.


There are a lot such myths going around different communities. In perl community, it's filled to the brim about how perl is everything and great. In the Common Lisp community, you hear fantastic things about lisp being the god of all programing languages, while they almost never mention emacs lisp as a language, and if they do, it's all sneer and spits and attacks to no ends. In the Scheme community, likewise you hear how it is the most beautiful, the most elegant, and the most powerful, of all, with its call-cc and tail recursion and whatnot. ( See: Scheme & Failure and Language, Purity, Cult, and Deception ) In unix community, which is usually hated by lispers of any faction, you hear how unix is the most versatile, the greatness of its “Unix philosophy” and “KISS” principles. (See: The Nature of the Unix Philosophy.) Likewise, there's also commercially generated myths, e.g. Java, about how it solves all cross-platform problems, and how OOP solves the world's programing problems, etc. (See: What are OOP's Jargons and Complexities)

All these spur from communities that developed certain cult following. Ultimately, it's more harmful than good. Damaging to the general public, as well as damaging to the community itself, long term.

What i'd like to say, is that, yes i love emacs and you love emacs. However, when praising, be concrete and specific on what you like about it, and avoid idolization. Because, idolization cultivates cult-like mindset, and when the community is cult-like, it becomes a closed community, and impedes evolution and progress.

CSS Margin vs Padding

Perm url with updates: http://xahlee.org/js/css_margin_vs_padding.html

CSS Margin vs Padding

Xah Lee, 2010-03-15, 2010-07-30

This page explains what's the difference between css's “margin” and “padding”.

In css, you can draw border around a block, like this:

p {border:solid thin red}

Once you draw a border, the difference between margin and padding becomes clear.

css padding vs margin

Padding is the area insider the border, margin is the area outside the border. The border here is the black line between yellow and red.

Testing Template

Here's a template you can play with.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>test CSS margin vs padding</title>
<style type="text/css">
div.wrapper {background-color:green}
p {border:solid thin red; background-color:yellow;

<div class="wrapper">
<p>test one</p>
<p>test two</p>


You can download this template at: css_margin_vs_padding_sample_template.html.gz.

emacs org mode tree manipulation keys

Perm url with updates: http://xahlee.org/emacs/blog.html

Outline mode (org-mode) is nice, but i never took the time to learn the details. Have been using it simply by just knowing the star header syntax and Tab or Shift Tab to show/hide headings. Today, i took the time and learned the basics keyboard shortcuts for creating and moving branches. Fantastic. Added to Writing Outline with Emacs (org mode tutorial).


How to Enable HTTP Server gzip Compression

Perm url with updates: http://xahlee.org/js/http_gzip_compression.html

How to Enable HTTP Server gzip Compression

Xah Lee, 2010-07-26

This page shows you how to add compression to Apache webserver, so that your site will be faster.

What's Compression for Web Server

When a web server respond to a page, it can first compress the page content, then send that to the browser, then the browser de-compress it then renders it in its window.

gzip compression typically will compress text so the new file is between 10% to 20% of the original. So, for html, css, php, js, etc files, it saves a lot bandwidth, which means faster for users especially those with slow connection.

The downside is that each time the server compresses a file, it have to use some CPU resource to do it. So, although the traffic output is reduced, the cpu usage increases. However, some advanced setup will pre-compress all your files, not per request.

Overall, compression is good because ultimately what matters most is for users. Less content size means faster load, and your user will be happier.

When enabling compression, typically you enable it for text files only. Because image files are already compressed, and compress again using gzip may increase the file size.

How to Check If a Web Server Has Compression Enabled?

When a browser request a page, it may send the following header to the server:

Accept-Encoding: compress, gzip

This means the browser can accept response that's compressed using the “compress” or “gzip” compression methods. When server receives this header, and if the server is configured to send compressed files, then it'll send the result compressed using one of the method. And, in the server's response header, it will contain a line like this:

Content-Encoding: gzip

to indicate the output is a compressed by gzip method.

So, to check if a server is sending compressed output, you can look for the header the server sent.

One easy way to see the response header is by using Firefox's Web Developer Toolbar, “Information ‣ View Response Headers”. Check if it sends the header “Content-Encoding:”.

Another Firefox add-ons you can use is Live HTTP Headers.

Otherwise, you can online based tools. e.g.: http://www.gidnetwork.com/tools/gzip-test.php and rexswain.com. (for the latter, you need to manually enter a accep-encoding in the request first)

How to Enable Compression in Apache?

There are 2 Apache modues that do compression: mod_gzip and apache.org mod_deflate.

Apache 1.3 uses mod_gzip. Apache 2.0 uses mod_deflate. (note: Apache 1.3 is no longer supported.)

With mod_deflate, add the following line in your “.htaccess” file:

AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css

You can add more file types to the line. For example, you might want to add the following

AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript

Shared Hosting and 1and1.com

If you are using 1and1 shared hosting, they don't support compression as of 2010-07.


If you are understand PHP, you can use it to compress the file before it sends to browser, because PHP can compress your file and send HTTP headers. See: Source.


emacs glasses-mode

Perm url with updates: http://xahlee.org/emacs/blog.html

Learned a tip today. There's glasses-mode, a minor mode, bundled in at least emacs 22.2. It will display “camelCase” words like this “camel-Case”. Note: it only display it that way, the text is actually not changed. (via gnu.emacs.help post by Tim X)

This tip is added to: Emacs Advanced Tips.


Second Life Debug Settings

Perm url with updates: http://xahlee.org/sl/sl_debug_settings.html

Second Life Debug Settings

Get your Xah Particle Maker today!

Xah Lee, 2010-07-28

To turn on debug settings, first turn on Advanced Menu by “Alt+Ctrl+d”, then it's in the menu “Debug Settings...”. In Emerald, press “Alt+Ctrl+Shift+s”.

Here are some of the ones i find useful:

CameraMouseWheelZoom (does not seem to work)

Full List

Open the file

c:/Program Files (x86)/SecondLifeViewer2/app_settings/settings.xml

the settings are documented there in a xml file.

Each entry looks like this:

  <string>Time before automatically setting AFK (away from keyboard) mode (seconds, 0=never). 
  Valid values are: 0, 120, 300, 600, 1800</string>

Note that the official doc at secondlife.com Debug Settings misses some 200 ones. The xml file is much better.

Emerald Viewer

Emerald Viewer adds the following, but may contain more settings not in the official viewer and does not start with “Emerald.”. You can also see Emerald's full list at:

c:/Program Files (x86)/Emerald Viewer/app_settings/settings.xml
Want to dash through walls?
Try Xah Tele-Dasher!


List of 3D Modeling Software

Perm url with updates: http://xahlee.org/blender/3d_modelers.html

List of 3D Modeling Software

Xah Lee, 2010-01-06, 2010-07-27

This page is a list of 3D modeling software for various purposes. I don't have experience in using most of them. For those i do have used, the comment will be more elaborate.

Note: 3D modeling software are quite complex and diverse. For examples:

  • Software designed for engineering, architecture, CAD, is almost useless for creating commercial animations that's mostly free-form shapes, and vice versa. Similarly, those from gaming community has its own purposes, features, requirements.
  • Also, the underlying modeling approach is very different. Most popular are mesh/polygon based. (they represent a object by its surface) Then there are solid based, that represent objects with a thickness as in real life. And there are ones focused on spline/nurb free-form curve based. There are ones based on sculpting and painting directly to the surface.
  • Even within a field, the interface is very diverse and totally different.

Architecture, Engineering

Illustration, Art

Most Popular


  • POV-Ray Free. Building a model based on mixing simple primitives like boxes, spheres, cones. Primarily for programers. Input is a script. Not GUI. No interactive feedback of modeling process.

Gaming Oriented

Second Life

Second Life is a Virtual world. It is not much of a 3D molder, but more as a 3D virtual world environment where you can quickly build basic concepts of architecture or a 3D object, quickly, and immediately explore it inworld such as walk-thru or fly thru.

Second Life is not useful as a modeling tool for engineering, CAD, or creating pro quality animations. (you can, of course, make video recoding of the screen). Can't export to standard 3d formats.

To get a quick sense of what building is like in Second Life, see: Second Life 3D-Construction Tutorial

For video of building in Second Life, see: second life building

The Second Life is completely built by its users. For more screenshots and videos, see A Photographic Tour of Life in Second Life.


  • Wings 3d (free) Used mostly for gaming. Notable is that it's written in the Erlang language.
  • Milkshape (free)



Google Earth Geography 101

Perm url with updates: http://xahlee.org/dinju/terdi.html

Google Earth Geography 101

Xah Lee, 2006-11-24, 2010-07-25

If you don't have already, you should download Google Earth. It's free.

Google earth is a virtual globe, that you can rotate and navigate about to any location on earth. Then, typically, for each city, there are hundreds of photos, videos, articles, statistics, that you can view.

10 years ago, i have the wish that there's some web database that you can search for any city in the world and immediately see many photos of the place. It is a reality today with Google Earth and Google Map (and to lesser degree other competitors).

The Tech of Google Earth

One way to judge the technology level of a civilization is to look at their maps. For us, Google Earth is a fair Representative. Also, if we can choose only one single software to represent the state of art in software, i'd say Google Earth is a good candidate. The major technologies underlies it directly or indirectly includes: massive scale networking, satellite communication system (GPS), photography tech (optics), 3D (modeling/rendering/graphics) tech, database tech, sundry other software tech (font, UI), ... among others.

To have something like Google Earth (GE), indirectly represents a large part of all human technology. For example, GE relies on photos taken from satellite as well as planes and cars. And actually, a satellite system, of many satellites, and GPS. This by itself involves sending autonomous machines to fly in a orbit around earth. And that involves just about all sciences and engineering of this century. Also, GE contains database of volcanoes, sea floor maps, etc. Take the sea floor example. It requires submarines, and other advanced understanding such as sonar for sound.

google earth

Earth from Google Earth.


Navigation can be done by keyboard or mouse.

For the Lazy

  • Zoom = mouse wheel. Double click to auto-zoom-in.
  • Rotate earth = hold left button then move mouse. Release button while still moving mouse (“throw”) to start automatic moving.
  • Align North = hold right button then move mouse left/right.
  • Smart Tilt+Zoom = hold right button then move mouse up/down.

By Keyboard

  • Zoom = PageUp/PageDown.
  • Rotate earth = Arrow keys.
  • Align North = Hold down Shift keys then press left/right Arrow Keys.
  • Tilt = Hold down Shift keys then press up/down Arrow Keys.

Holding down Alt before doing the above will make the steps smaller.

For Control Freaks

  • Align North = hold middle button then move mouse left/right.
  • Tilt = hold middle button then move mouse up/down.

If you tilted over the horizon and started to see the sky and can't get back to earth, you can “reset” the view by just holding right button than move mouse up until you see the earth.

  • Holding Ctrl and press up/down arrow will tilt your camera.
  • Holding Ctrl and press left/right arrow will rotate your camera. (around a axis from earth center to your camera)


The following are some distances in numbers, so that, you get a sense of how far.

Google Earth for History, Literature, Arts

Google Earth is not just for education or understanding geography. It has many uses, by educators/learners, for directions, for sight seeing travel planning, for hike planning, ... but i use it much for understanding culture, literature, arts. Here's some example of what i use it for.

One most obvious is for annotation of travelogs. e.g. Las Vegas Travelog, Monterey Bay Aquarium, Reno 2006.

I also use it for annotation of photography of architectures. When showing a gallery of beautiful buildings, it is nice to be able to get a sense of the location. All those elaborate churches, ancient temples, castles... where are they? See: Beautiful Architectures.

I also use it for annotation in literature. For example, in reading Gulliver's Travels, it mentions tens of actual places (often in allusion to historical events as satire). To understand it well, you really have to know where these places are. So, in annotations, i put Google Earth links to the location, for myself and my readers. See: Gulliver's Travels.

Another examples of heavy use Google Earth in literature, is when i read The Thousand-and-Second Tale of Scheherazade by Edgar Allan Poe. It mentioned many locations of natural wonder or man-made wonder. See: The Thousand-and-Second Tale of Scheherazade.

When reading history, literature, for example, when you read about Trojan War of Greek mythology, about a war over the most beautiful woman, at the city Troy, do you want to know where is Troy? And, nearby is the island Lesbos, famous because the word lesbian is derived from it.

When i watch movies, usually i go read about the movie before or after having watched it, as a hobby of learning. For example, the movie District 9. The story is about a alien spaceship that appeared in Johannesburg, South Africa. The movie is also shot there. The movie features lots of black people and local scenes. From a cultural perspective, the movie gives you a glimpse of what a large city in south africa is like.

For a whole collection of my Google Earth files, see: Google Earth Files at XahLee.org.

Emacs Lisp: Writing a google-earth Function

Perm url with updates: http://xahlee.org/emacs/google-earth.html

Emacs Lisp: Writing a google-earth Function

Xah Lee, 2006-12, …, 2011-10-21

This page shows a example of writing a emacs lisp command that creates a Google Earth KML file of a given location, and creates a link to the file. If you don't know elisp, first take a look at Emacs Lisp Basics.

If you don't know what Google Earth is, see: Google Earth.

The Problem


Write a command “make-google-earth”. If my cursor is on a line like this:

Las Vegas,-115.1730,36.1027

After calling “make-google-earth”, the line will become:

<a href="../kml/las_vegas.kml" title="Las Vegas">⊕</a>

And a Google Earth KML file 〔Las_Vegas.kml〕 will be automatically created, linked by the above.


I often write travelogs on my website. If i traveled to Las Vegas, then my Las Vegas travelog page will have a link to Google Earth location of Las Vegas. The raw html looks like this:

<a href="../kml/las_vegas.kml" title="Las Vegas">⊕</a>

with proper Cascading Style Sheet (CSS), like this:

a[href$=".kml"], a[href$=".kmz"]
no-repeat left center;
background-position:left center !important}

It looks like this in a web browser:

If you move cursor to the link, it will show the title. Clicking on it will open the KML file and launch Google Earth to that location.

Also, i want emacs to automatically create the KML file for me. The KML file content would be like this:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<name>Las Vegas</name>
See: http://xahlee.org/Periodic_dosage_dir/las_vegas/20031020_vegas.html

In the <description> tag, contains the URL of my web page that links to this KML file. So that in Google Earth, user can easily get back to my travelog page.

In summary, given a location name and its earth coordinates, i want emacs automatically create a KML file, and a link to the KML file. We proceed to write this function.


First, we write a documentation for the function so that we know precisely what we want.

(defun make-google-earth ()
"Create a KML file and replace the current line as a link to it.

The current line must have data of this format:

Las Vegas,-115.1730,36.1027

The line will be replaced like this:
<a href=\"../kml/las_vegas.kml\" title=\"Las Vegas\">⊕</a>

The KML file will be created in this dir:
;; )

Here are the major steps we need to do.

  • Grab the current line, parse it, and get the main data of “title”, “coordinate-x”, “coordinate-y”. Set them to variables.
  • Write a function that creates KML file.
  • Write a function that remove current line then insert the link to the newly created KML file.

To grab the current line and set it to variables, we can easily do like this:

  (setq p1 (line-beginning-position))
  (setq p2 (line-end-position))

  (setq dataText (buffer-substring-no-properties p1 p2 ))
  (setq dataTextTempList (split-string dataText ","))
  (setq title (pop dataTextTempList))
  (setq coord-x (pop dataTextTempList))
  (setq coord-y (pop dataTextTempList))

Once we got the data, we can delete the line, like this:

(delete-region p1 p2)

For inserting the link, we can write it like this:

(defun insert-google-earth-link (&optional title filePath)
  "Insert a HTML markup for link to a local Goole Earth file.
 TITLE is the title attribute in the anchor link.
 FILE-PATH is the path to the KML file.
Here's a sample inserted text:
<a href=\"../kml/las_vegas.kmz\" title=\"Las Vegas\">⊕</a>"
  (when (not title) (setq title "�") )
  (when (not filePath) (setq filePath "�") )
  (insert "<a href=\"" filePath "\" title=\"" title "\">⊕</a>\n")

To create a KML file, we can call “find-file”, then just insert a template text. Like this:

(find-file kmlFilePath)
(insert-kml title coord-x coord-y sourceFilePath)

The “insert-kml” can be written like this:

(defun insert-kml (&optional title longitude-lattitude sourceFilePath)
  "Insert a simple Google Earth KML markup template.
 TITLE is the name to use for the <name> tag.
longitude-lattitude is a vector [longitude lattitude]. They must be real numbers.
 SOURCEFILEPATH is the file that links to this kml file,
used in the <description> tag."
  (let (coord-x coord-y)
    (when (not title) (setq title "�"))
    (if longitude-lattitude
          (setq coord-x (elt longitude-lattitude 0))
          (setq coord-y (elt longitude-lattitude 1))
        (setq coord-x 0)
        (setq coord-y 0) ) )
    (insert "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<kml xmlns=\"http://www.opengis.net/kml/2.2\">
<name>" title "</name>

See: http://xahlee.org/"
(when sourceFilePath (file-relative-name sourceFilePath "~/web/xahlee_org/" ))
<Point><coordinates>" (number-to-string coord-x) "," (number-to-string coord-y) "</coordinates></Point>

Complete Code

Here's the final “make-google-earth” code:

(defun make-google-earth ()
"Create a KML file and replace the current line as a link to it.

The current line must have data of this format:

Las Vegas,-115.1730,36.1027

The line will be replaced to like this:
<a href=\"../kml/las_vegas.kml\" title=\"Las Vegas\">⊕</a>

The KML file will be created at:
(let (
      title coord-x coord-y
      dataText dataTextTempList
      kmlFilePath kmlDirRoot 
      sourceFilePath doit-p
      p1 p2
  (setq p1 (line-beginning-position))
  (setq p2 (line-end-position))
  (setq dataText (buffer-substring-no-properties p1 p2 ))

  (setq kmlDirRoot "~/web/xahlee_org/kml/")
  (setq dataTextTempList (split-string dataText ","))
  (setq title (pop dataTextTempList))
  (setq coord-x (replace-regexp-in-string "°" "" (pop dataTextTempList)))
  (setq coord-y (replace-regexp-in-string "°" "" (pop dataTextTempList)))
  (setq sourceFilePath buffer-file-name)
  (setq kmlFilePath (concat (file-relative-name kmlDirRoot ) (replace-regexp-in-string " " "_" title) ".kml"))

  (setq doit-p t)
  (when (file-exists-p kmlFilePath)
    (setq doit-p nil)
    (setq doit-p (y-or-n-p (format "File exist at %s\nDo you want to replace it?" kmlFilePath)))

  (when doit-p
    (delete-region p1 p2)
    (insert-google-map-link title (vector (string-to-number coord-x) (string-to-number coord-y)))
    (insert-google-earth-link title kmlFilePath)
    (find-file kmlFilePath)
    (insert-kml title (vector (string-to-number coord-x) (string-to-number coord-y)) sourceFilePath)
    (search-backward "<description>") (forward-char 14)

So now, we have a elisp function, that we can assign to a keystroke. Upon a press of button, it saves us a few hundreds of tedious error-prone keystrokes and file managing process.

Emacs is fantastic.

For KML files i created on my site with this function, see: Google Earth Files at XahLee.org.


Dancing in Second Life

Perm url with updates: http://xahlee.org/sl/dansu.html

Dancing in Second Life

Xah Lee, 2007, 2010-07-25

Dancing to the tune of Ninja Rap by Vanilla Ice. Movie made on 2010-07-25, by me.

Dancing to the tune of Bel-Air. 2010-07-25

Dancing to the tune of Robot Rock by Daft Punk. 2010-07-25

Second Life provides great value of dance education. There are thousands “gestures” (meaning, pre-made animations by players) that features all styles of dancing. From pop dance to tango to Pole Dancing.

It's valuable technology because when you see dance movements by computer generated characters, you tend to get a better understand of the body movements, in the same way black and white photography gets you to focus on the form of the scene. You can view the scene in any angle in real time, and it can repeat forever.

The following are old screenshots, made in 2007. The graphics and avatar shape have improved much since.

dnc 41

Dancing at a Blues Bar. The music is hot, and the girls are wild.

This bar is called House of Tunes, located at Whitlock 204,169,110. It features streaming live music.

Dancing in Second Life is a major activity, perhaps after shopping and sex. The majority of participants are women, as in real life.

dnc 15

Here's some excerpts from wikipedia on dancing:

Dance generally refers to human movement used as a form of expression, social interaction or presented in a spiritual or performance setting.

Dance is also used to describe methods of non-verbal communication (see body language) between humans or animals (bee dance, patterns of behaviour such as a mating dance), motion in inanimate objects (the leaves danced in the wind), and certain musical forms or genres.

dnc 30 dnc 33
Want to dash through walls?
Try Xah Tele-Dasher!

How To Avoid The Emacs Pinky Problem

Perm url with updates: http://xahlee.org/emacs/emacs_pinky.html

How To Avoid The Emacs Pinky Problem

Xah Lee, 2006, ..., 2010-07-24, 2010-08-28

Emacs makes frequent use of the control key. On a conventional keyboard, the Control Key is at the lower left corner of the keyboard, usually not very large and is pressed by the pinky finger. For those who use emacs all day, this will result in repetitive strain injury. This page lists some tips on avoiding this pinky problem.

I've been using computer since 1991, at least 8 hours a day on average every singe day. I was a QWERTY touch-typist with 80 wpm and worked as a secretary for about 2 years, then in ~1994 i switched to Dvorak. I started to use emacs everyday since 1998. I am a keyboard and key macro nerd, and have used tens of keyboard macro or keymap type of utilities on the Mac, unixes, and Windows, always looking for the most ergonomic and efficient way to operate the keyboard and computer. (see: All About Keyboards, Keyboard Layouts, Shortcuts, Macros) This page summarize my experiences applied to emacs.

The best way to avoid the pinky problem is actually to use a good keyboard. Let us start with some tips on choosing a good keyboard.

Tips For Selecting A Computer Keyboard

Here are some keyboard hardware advices:

• Buy a keyboard such that the Alt and Control keys are large.

• Buy a keyboard where Alt and Control are also available on the right side.

• The Alt and Control key's positions on the left and right sides should have the same distance to your left and right thumbs (while your hands are rested in standard touch-type position). Specifically: the distance from the left Alt to the F key should be the same as the right Alt to the J key.


Apple keyboard

The Apple keyboard as of 2006. Note the ridiculous distance of the right side's modifier keys. It is not possible, to use the right thumb to press the alt key while the index finger remains on the J.

Many keyboards don't have full set of modifier keys on the right side, and when they do, they are positioned far to the right, making them not much usable for touch typing. For example, the keyboards made by Apple Computer, their right-side Command/Alt/Ctrl keys are inferior citizens. They are placed far more to the right, making the right set of modifier keys difficult or impossible to reach with the thumb. It makes these keys essentially decorative in nature. (See: Apple Keyboards Review.)


ms n4000 keyboard

The Microsoft Natural Ergonomic Keyboard 4000. The keys are split and oriented for each hand. The Ctrl and Alt are very large and symmetrically positioned with respect to each hand's thumb. (See: A Review of The Microsoft Natural Ergonomic Keyboard 4000.)

Avoid Laptop Keyboards

Laptop computer keyboards are the worst beast. It is the quickest way to get RSI. The keys are packed into a neat little rectangular space and flat. Control key and other modifiers become tiny squares. Many dedicated keys such as Home, PageDown, Arrows, are reshaped into squares to fit into the rectangular array. Losing their distinct positions that can be easily located by touch. Dedicated keypad for numbers is gone. Time saving Function keys, great for macros, become a thin strip and require 2 key presses with a Fn modifier key, also requires visual-contact to hit correctly.

It is neat alright, but anything in perfectly geometric shape is a sign that it is the worst with respect to ergonomics and comfort. In the environment of nature, which our body evolved to cope with, there's almost never any straight lines, squares, or perfect circles.

laptop keyboard

Laptop keyboard. Source Sure way to ruin hands. Avoid prolonged typing on laptop keyboards.

Although i sit in front of the computer daily for more than 8 hours a day for the past 20 years, but i never developed any symptoms of RSI except one incidence around 2004. During 2004 and 2005, for 2 years, i was using a laptop always. I noticed RSI symptoms. My hand started to feel weird even when not typing. Not exactly pain yet, but definitely something's not right and serious. (I've already read extensively about RSI)

So i went and bought a external USB keyboard, and actually bought a split ergonomic one. I always hated split keyboards, in particular because emacs's C-x on Dvorak is at the B position of QWERTY, and the B key on split keyboard is on the left side, but i always used the right hand to do the x and left hand on Ctrl in C-x. Also, the number 6 key is supposed to be pressed by the right hand by traditional touch typing, but the 6 on split keyboard is on the left side too.

Despite this initial difficulty, i adopted the split ergonomic keyboard, even after 15 years of using a traditional PC keyboard. Now, i won't go back to the non-split keyboard. Typing on non-split keyboard feels discomfort even just for a few minutes.

How To Press The Control Key

Use Your Palm or Semi-Fist

Do not use your pinky to press the Control key.

For most PC keyboards, it is very easy to press the control key using your palm. Just open your hand somewhat and push down with the meat at the chopping edge of your hand. Alternatively, you can roll your wrist a bit, curl in your fingers into a semi-fist, then sit your fist on the control key.

Use Both Hands

Do not use a just one hand to type a Control+‹key› combo.

Use one hand to press Control, use the other hand to press the combination key. This is the same principle for pressing the Shift key in touch-typing.

When the key you want to press is on the left side of the keyboard, use the right side of Control key. For example, to press 【Ctrl+a】, hold down the right Control with your right palm edge, and use your left hand to press “a”. Make this into a habit. Using a single hand to press 【Ctrl+‹key›】 combo means your hand are shaped into spider legs, thus putting stress on it when done repeatedly.

This is also why it is important to chose a keyboard with Control keys positioned on both sides of the keyboard symmetrically.

Software Ways To Avoid the Pinky Problem

A good keyboard and good typing habit is good. But suppose you are stuck with a laptop keyboard. A laptop computer usually don't have control key on both sides of the keyboard. Its control key is very small, and it cannot be pressed by palm. Here are some suggestions for this situation.

Swap Control and Alt

Try swapping the Control and Alt keys.

Emacs's shortcuts are developed for Lisp Machine's keyboards of the 1980s. They have Control key near the space bar, and the Meta key further away from the space bar. So, Control key is the primary modifier key. However, today's keyboards have Alt instead of Meta, and the Control key is placed at the far corner. Emacs did not change its shortcuts. It simply mapped the Meta to Alt. That is why today, most frequently used keyboard shortcuts have the more difficult to press Control key instead of the Alt. For more detail on this and other aspects of emacs's shortcuts, see: Why Emacs's Keyboard Shortcuts Are Painful.

Swapping the Alt and Control key will make Emacs's keyboard shortcuts easier to use.

The other advantage of swapping Alt and Control, is that on Windows and Linuxes, most direct shortcuts involve the Ctrl key. By swapping, shortcuts are made easier too, because now Control is right under your thumb. See: How To Swap Caps Lock, Alt, Control Keys On Windows.

Swap Caps Lock and Control

Another commonly suggested solution is to remap the the Caps Lock and Control key by swapping them. This is not a optimal solution, because the Control key is still pressed by the pinky, and somewhat displaces your hand on home position. Also, there is now only one Control key, making the left pinky doing double work. (modifier keys comes in pairs for good reasons. Try pick out a Shift key and type for a week) However, if you are stuck on a lousy keyboard such as laptops, and unable to swap Ctrl and Alt, then making the Caps Lock key as Control might be a practical solution. (For detail, see: Why You Should Not Swap Caps Lock With Control)

See: How To Swap Caps Lock, Alt, Control Keys On Windows.

Use a Ergonomic Shortcut Layout

If you are adventurous, the best solution is to use a ergonomically designed shortcut layout for emacs. (See: A Ergonomic Keyboard Shortcut Layout For Emacs.)

Use Sticky Keys

On Windows, Mac, Linux, you can setup your OS so that Ctrl+‹key› can be pressed by pressing the Ctrl key then release it, then pressy the ‹key› key. On Windows, go to Control Panel, “Ease of Access Center”, then the Keyboard section. On Mac, go to System Preferences, Universal Access, Keyboard tab. For Linux, see: emacswiki.org StickyModifiers.

Dvorak Keyboard Layout

Perhaps a more important ergonomic improvement one can make is by using the Dvorak keyboard layout.

dvorak keyboard layout

I've been using Dvorak keyboard since 1994. It works beautifully with emacs. It makes typing more comfortable. (i use emacs since 1997).

For more info about Dvorak layout, see: The Dvorak Keyboard Layout.

Relax Your Hand When Not Actually Typing

When in a active type session such as coding or writing, perhaps more than 50% of the time your hand is actually not punching the keyboard. You constantly take a pause to read or think. This pause can be 1 second to 10 seconds or more. However, for many people, their hands are still tensed up during these times, ready to type. This is one major cause of RSI.

Remind yourself to check your hands when you are not actually in action of typing or using the mouse. See if your hand is not completely relaxed.

It's a good habit to develop to even remove your hand from the keyboard or mouse when you are not actively typing, even if the duration is just few seconds.

Hand Toys

Here's some fun toys i use that give my hand something to do, to take them away from the same muscle usage for typing or mousing.

So when i'm reading or thinking, it's a habit to pick these toys up and play with it unconsciously.

Squeeze Ball

Get a squeeze ball. amazon There are several types of squeeze ball. Some are spongy and light weight, requires little effort to squeeze, and spring back into shape immediately. Another type feels like clay. You have to squeeze hard with the whole hand for it to deform, and they deform slowly. I like them both very much.

Rubber Band

Get a rubber band. amazon Wrap them around all 5 fingers, then try to open the fingers. This is kinda reverse exercise to squeeze balls. With the right size of rubber band, you can easily expand your fingers once every second.

Pen Twirling

You might try to pickup Pen Spinning. Though, am not sure this is good for you. Learning the tricks can be addictive, and the constant pen dropping can be quite annoying to those around you. (In East Asia, majority of highschool students do some form of pen twirling. When walking into the class, you hear the sound of pen droppings all over.) Personally, pen twirling has become a unconscious habit for me since age 13.


It is universal advice that you should have 10 minutes of break every 2 hours. The exact schedule varies. I always take breaks. Some use a clock, but i tend to do it spontaneously. Every 2 hours or so, i'd get up and walk for 10 minutes or do some juggling during break. Been a juggler since age 17. amazon

chinese baoding exercise ball2

Chinese hand exercise iron balls

When talking a walk, i usually carry Chinese hand exercise iron balls It makes me looks like a Asian sage. (don't buy those with decorative inlaid brass wire on the ball surface. They look pretty, but if you dropped or chipped the ball, the metal wire may stick out. Get pure marble or metal ball. Also, most of them chime. I prefer them not, especially if you work in the office.)

  • “Chinese Exercise Ball (Stone)” amazon
  • “Chinese Exercise Ball (Metal)” amazon
Was this page useful? If so, please do donate $3, thank you donors!