Wikipedia:Wikipedia-mode.el

Wikimedia-mode.el is obsolete!
wikimedia-mode.el is apparently no longer maintained and most of the code here has been incorporated into mediawiki-el. (More info on the emacs wiki)

Original Article
This article describes the installation of wikipedia-mode, an Emacs major mode for editing articles in Wikipedia and other wikis running MediaWiki software offline, and of the auxiliary mode longlines-mode. These modes tweak Emacs's behavior in several ways to make it easier to edit MediaWiki articles. In particular, wikipedia-mode provides syntax highlighting for MediaWiki markup.

For other methods of using Emacs with Wikipedia, see Text editor support.

Installing wikipedia-mode
To install wikipedia-mode, save wikipedia-mode.el to a convenient directory, preferably one in your Emacs. (To see which directories are in your, type C-h v load-path while in Emacs.)

Next, open your Emacs initialization file. (This is usually a file called  in your home directory; to find out what it is, type C-h v user-init-file. If this is a new Windows Emacs installation, you need to choose a home directory. See Where do I put my .emacs file?) Add the following lines:

If you did not save  in a   directory, replace   with the full pathname. On Windows, remember to use forward slashes ("/") rather than back slashes ("\") to indicate the directory. For example, It is often convenient to associate wikipedia-mode with certain filenames, so that Emacs will enter wikipedia-mode automatically whenever such files are opened. In order to associate filenames ending in " " with wikipedia-mode, add the following to your initialization file: To use this mode automatically with the Firefox ViewSource extension, add: To use this mode automatically with the Firefox ItsAllText extension, add: Still further customizations can be added; suppose one wants Emacs to spellcheck files opened up in wikipedia-mode using the FlySpell program? One could add some elisp like this:

Installing longlines-mode
MediaWiki articles don't use line breaks, which means that paragraphs are not separated into lines by return characters. By default, Emacs sees such documents as a bunch of super-long lines. There are several solutions to this problem: you can use  to fold long lines on the screen (if they are truncated) or you can use   to "word wrap" text using "soft" newlines.

If you decide to use the first approach you are likely need to download a third-party package &mdash; screen-lines.el &mdash; which redefines movement commands to work in terms of screen lines, as opposed to text lines (that is if you use  it moves cursor vertically down to the next line on the screen, whereas traditionally it moves cursor to the next text line).

The second approach requires  which is included in recent versions of Emacs. If your version does not include it you need to do the following:

Download longlines.el to your  and add these lines to your Emacs initialization file (typically   or  ):

Usage
You can enter wikipedia-mode at any time by typing M-x wikipedia-mode. While in wikipedia-mode, you can view a description of the mode by typing, which runs the command.

There are two ways to use wikipedia-mode.
 * 1) Copy articles between Emacs and your web browser's text box.
 * 2) With one of the plugins for Mozilla and Mozilla Firefox web browsers that allows you to edit text boxes with external editor.

If you mostly edit MediaWiki articles using one of those plugins, it might be worthwhile to associate the editing sessions with wikipedia-mode. Add one of the following lines to your .emacs file:
 * For ViewSourceWith:
 * For It's All Text!:
 * For MozEx:

Macros
Some useful macros:

/Add Spaces Inside Headers

Licensing
The packages wikipedia-mode.el and longlines.el are released under the GNU General Public License.