mediawiki.el
is an
Emacs mode for editing pages on MediaWiki wikis, such as Wikipedia,
which combines an already existent set of syntax highlighting and
indentation rules for MediaWiki’s syntax with automatic loading and
saving of pages via the MediaWiki API. I’ve integrated it with Conkeror,
so once I’ve done M-x mediawiki-site
to login, I can just visit a page
and hit C-M-e
to edit it. The entirely standard C-x C-s
will prompt
for an edit summary and save the page.
My settings for the mode:
;; MediaWiki editing
(load "mwlogins.el")
(autoload 'mediawiki-open "mediawiki")
(autoload 'mediawiki-site "mediawiki")
(add-hook 'mediawiki-mode-hook 'variable-pitch-mode)
;(add-hook 'mediawiki-mode-hook 'longlines-mode)
(add-hook 'mediawiki-mode-hook (lambda ()
(make-local-variable 'outline-regexp)
(setq outline-regexp "=+")
(outline-minor-mode 1)
(hide-body)))
And the Conkeror config:
// Emacs mediawiki.el support - this is just for the English Wikipedia
// at present; could be extended to auto-detect the wiki we want and
// call the Emacs command mediawiki-site
interactive("mediawiki_open", "Edit pages using Emacs' mediawiki.el",
function mediawiki_open(I) {
var page = I.buffer.display_uri_string.substring(6 + I.buffer.display_uri_string.lastIndexOf("/wiki/"));
shell_command_blind("emacsclient -e \'(mediawiki-open \"" + page + "\")\'");
});
define_key(wikipedia_keymap, "C-M-e", "mediawiki_open");
It’s been ages since I wrote any JavaScript; it was the first language I learnt, back in the day when it wasn’t a standard first language to learn at all.