mediawiki.el – Emacs mode for editting MediaWiki pages

Jan 5, 2009

I seem to be spending an inordinate amount of time editting MediaWiki wikis, so I’ve had some time to put together a better MediaWiki mode for emacs. In the process, I wrote some code that many people (myself included) seem to think Emacs needs. HTTP POSTing in native elisp is too hard right now, so a http-post-simple.el was written. The original mediawiki.el required this library, but it wasn’t included. I refactored the dependency away and now I have some form parsing functions in elisp that I can contribute back to the Emacs core. Anyway, if you use Emacs and edit MediaWiki pages, check out mediawiki.el and let me know what you think. I’m especially interested in bug reports from anyone.

Posted by | Categories: Uncategorized | Tagged: |

6 Responses so far | Have Your Say!

  1. danlyke
    January 6th, 2009 at 11:14 pm #

    Pardon my emacs ignorance, but…

    GNU Emacs 22.2.1 (i486-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of 2008-09-05 on vernadsky, modified by Ubuntu

    I copied mediawiki.el to /home/danlyke/.elisp

    Changed my ~/.emacs to have:

    (add-to-list 'load-path "/home/danlyke/.elisp/")
    (require 'mediawiki)

    (Takes a while to startup now, I need to figure out how to speed that up) (No, this isn’t lisp)

    Edited the customize stuff:

    MediaWiki Site Default: Flutterby.net
    mediawiki-site-alist: '(("Flutterby.net" "http://www.flutterby.net/wiki/index.php" "danlyke" "password"))

    Note, “password” contains punctuation that might be confusing things, I didn’t know how to escape it properly. But no quotes, single or double. Anyway, save that.o

    Type in:

    m-x mediawiki-edit
    http://www.flutterby.net/wiki/index.php?title=2008-11-24_Kitchen_Drawers

    (for example, I’ve also tried http://www.flutterby.net/2008-11-24_Kitchen_Drawers )

    Get “if: Wrong type argument: stringp, nil”

    Any clues?

    And this looks super useful!

  2. hexmode
    January 6th, 2009 at 11:44 pm #

    Thanks for giving it a test.

    I set up an account on your wiki so I could verify this works, but after setting the site parameters, mediawiki-site-alist should contain a fifth empty string — this is the “first page” that mediawiki.el will automatically dump you into after invoking

    M-x mediawiki-site RET

    (TODO: make it more robust when parsing the alist.)

    And since you didn’t mention it, you do need to invoke mediawiki-site. (TODO: automatically use the default site or, if there is only one site in the alist, use that site. I know, “default” implies this. Oh well.)

    After that, the command you should be using is

    M-x mediawiki-open RET 2008-11-24 Kitchen Drawers RET

    Note that you need to use -open not -edit and you should only type the page name, not the full url. (Underscores are optional, but MediaWiki is case sensitive.)

  3. danlyke
    January 7th, 2009 at 2:45 am #

    Not sure I understand, when I look in my ~/.emacs, I see:

    (custom-set-variables
    ;; custom-set-variables was added by Custom.
    ;; If you edit it by hand, you could mess it up, so be careful.
    ;; Your init file should contain only one such instance.
    ;; If there is more than one, they won't work right.
    '(mediawiki-site-alist (quote (("Flutterby" "http://www.flutterby.net/wiki/index.php" "DanLyke" "password"))))
    '(mediawiki-site-default "Flutterby"))

    When I do a M-x mediawiki-site RET Flutterby I get

    mediawiki-site-extract: Symbol's function definition is void: nil-blank-string

    Working off your “fifth empty string” note, I get the same if I do:

    '(mediawiki-site-alist (quote (("Flutterby" "http://www.flutterby.net/wiki/index.php" "DanLyke" "password" "MainPage"))))

    or replace “MainPage” with “”

    Thanks, and sorry I’m such an Emacs newbie, I hate that I’ve been using it for ten years and only have a few extra canned lines that I’ve stolen from various places in my .emacs file.

  4. danlyke
    January 7th, 2009 at 3:59 am #

    Doh. Also, replace “MainPage” with “Main_Page”.

    And is there some other library I may be missing?

  5. hexmode
    January 7th, 2009 at 4:48 am #

    No problem. It looks like the function nil-blank-string is only in CVS emacs, not Emacs22. Further, there is a bug you found in the default customizaation that I had for the site-alist. I’ll fix these and upload a new version momentarily

  6. hexmode
    January 7th, 2009 at 5:02 am #

    Doh! the function was part of em-unix.el (a part of eshell) in CVS emacs. Fixed it by eliminating the call. Please download again: http://www.emacswiki.org/cgi-bin/emacs/mediawiki.el

Leave a Feedback

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>