Using the Capslock key on a US/English keyboard to generate special characters

I much prefer the US keyboard over any other keyboard because it is the best layout for programming. Once in a while I do however need some non English characters.

The below is an example on how to use a .Xmodmap to take away the Caps-Lock key and use it for something useful. The below example gives you German "Umlaute" and some other characters. E.g Caps-Lock and "a" give ä. Feel free to adapt it to your language needs. This will work for most European languages.
! Save this file as .Xmodmap in your home directory. Most Linux
! distributions will automattically read it. If not then add
! xmodmap $HOME/.Xmodmap 
! to a script that is started after X11 comes up.
clear lock
!the next line is normally not needed
!add Mod3 = Mode_switch
!keysym Caps_Lock = Mode_switch
!!or
keycode 66 = Mode_switch
! now the key definitions, use xev to look up the keycode
! number if needed. The first 2 columns after the equal sign
! are the normal functions of the keys. The last two columns are
! used when Mode_switch is pressed or Mode_switch + Shift is
! pressed.
! see also /usr/X11R6/lib/X11/xkb/symbols
! and in recent linux systems /usr/X11R6/share/X11/xkb/symbols
keycode 30 = u U udiaeresis Udiaeresis
keycode 32 = o O odiaeresis Odiaeresis
!keycode 38 = a A aacute agrave
keycode 38 = a A adiaeresis Adiaeresis 
keycode 39 = s S ssharp 
keycode 26 = e E eacute egrave
keycode 13 = 4 dollar EuroSign 
! some spanish characters:
keycode 57 = n N ntilde Ntilde
keycode 10 = 1 exclam exclamdown 
keycode 61 = slash question questiondown 
! end
!
! common latin symbols:
!egrave eacute agrave aacute ccedilla igrave iacute ntilde ograve oacute exclamdown Agrave Aacute Egrave Eacute Acircumflex Ecircumflex Igrave Iacute Ntilde Ccedilla dollar EuroSign sterling section
!
!keycode 233 = XF86Back
!keycode 234 = XF86Forward
keycode 233 = F20
keycode 234 = F19
© Guido Socher