Jump to content

Mediawiki.el basic usage

From nichework

This page is the basic-usage guide for mediawiki.el. It was written with mediawiki.el itself.

Installing

mediawiki.el needs Emacs 28.1 or later.

  • From MELPA: M-x package-install RET mediawiki RET
  • From source (Emacs 30+):
(use-package mediawiki
  :vc (:url "https://github.com/hexmode/mediawiki-el" :rev :latest))

Choosing a site

M-x customize-group RET mediawiki RET     ; set up mediawiki-site-alist
M-x mediawiki-site RET Nichework RET      ; log in and open the main page

Fill in the password field or leave it empty and keep the password in auth-source (~/.authinfo.gpg). OAuth 2.0 is preferred; see OAUTH-SETUP.org in the source tree.

Reading and saving pages

Key Command Does
M-x mediawiki-open mediawiki-open open a page for editing
C-x C-s mediawiki-save save the page back to the wiki (asks for an edit summary)
C-x C-w mediawiki-save-as save under a different page name
C-c C-c mediawiki-save-and-bury save and bury the buffer
M-g mediawiki-reload discard local edits and reload the page
M-x mediawiki-browse mediawiki-browse open the page in a browser

Editing markup

Key Inserts
C-c C-f C-b bold text
C-c C-f C-i italics
C-c C-f C-l a wiki link
C-c C-f C-e a section header
C-c C-f C-u a user link
C-c C-w your signature
M-RET a numbered list item
C-\ a bulleted list item

There is also a MediaWiki menu with the same commands.

Writing offline in a local file

Any buffer visiting a .wiki or .mediawiki file opens in mediawiki-file-mode, which is mediawiki-mode with the save keys pointed at the file:

C-x C-f ~/drafts/some_topic.wiki RET
;; write the wikitext
C-x C-s          ; save-buffer, saves the local file
C-x C-w          ; write-file, save under another name
C-c C-c          ; save and close the window

Then paste the buffer into the wiki's web editor. For other file extensions, M-x mediawiki-file-mode gives the same keys in the current buffer.

M-x mediawiki-draft opens a scratch buffer instead; M-x mediawiki-draft-buffer files it in mediawiki-draft-data-file (by default ~/Wiki/discussions/draft.wiki), which M-x mediawiki-draft-view-draft visits.

History, diffs and discussions

  • M-x mediawiki-history - browse a page's revision history; v views a revision, d diffs it against its parent, D against the latest, b opens it in a browser.
  • M-x mediawiki-watchlist - browse your watchlist.
  • M-x mediawiki-user-contributions - a user's contributions.
  • M-x mediawiki-discussion-tools - browse a discussion page and reply with r.
  • C-c C-r in a page buffer replies to the comment at point.

Links