Download spanish.el into your "site-lisp" Emacs sub-directory. Read comments at the top of the file for instructions on how to add lines to your Emacs start up file to make spanish-minor-mode accessible from within Emacs. (This will result in Control-Meta-S being bound to the function spanish-minor-mode which toggles the Spanish accent toggling functions on and off in any editing buffer).
Standard Emacs already has facilities for editing accented characters, in particular -
However, there are a few difficulties with iso-accents-mode -
spanish.el attempts to deal with these problems. To a first approximation, for each Spanish accented character there is a unique corresponding non-accented character. The exceptions are º and ª which are used as suffixes for ordinal numbers.
spanish-minor-mode binds the F2 function key to a function that toggles the character immediately before the cursor between accented and unaccented. F3 deals with º and ª.
For example, to type -
¿ Como estás ?
you will need to type -
? F2 (space) C o m o (space) e s t a F2 s ?
If you don't like using F2 and F3, perhaps because they are too far to reach comfortably, you can easily edit spanish.el to bind alternative keys. The best alternatives might be "[" and "]" as these don't require use of Shift or any other modifier, and they don't occur much in normal prose. Replace the reference to [F2] with "[" (that is, Emacs requires square brackets for function key names and quotes around character names), and similarly [F3] to "]". If in this case you do need to type "[" or "]", use Emacs' Control-Q quoting function, i.e. Control-Q ] will insert a "]" even if the "]" key has been bound to another function.
Entonces, ¡ buena suerte y que se divierta escribiendo
a máquina !
See also translateSpanish.user.js which is a GreaseMonkey script to translate selected text on a web page from Spanish to English. It assumes that accented characters are encoded in the character set, which means that it works on es.wikipedia.org, but it doesn't work on the sentence given above (which was encoded using entities).