September 17, 2008

emacs + dokuwiki

I hacked the dokuwiki-mode written by Jörg Volbers. Main changes are translation of messages from German to English, and also fix work with pages, that has names with utf-8 symbols. New version is available from my site.
This package allows to edit dokuwiki pages directly from Emacs. To do this, you need to install dokuwiki.el, simple-wiki.el & curl, and add following lines to your .emacs.
(global-unset-key [(control v)])
(require 'dokuwiki)
(setq dokuwiki-username "name"
dokuwiki-password "password"
dokuwiki-base-url "server")
and after pressing C-v C-d you'll be asked for page name and after retrieving you'll able to edit page in Emacs

10 comments:

Anonymous said...

Would you point out where you found your version of simple-wiki.el? Thanks!

Alex Ott said...

somewhere in internet, by searching for simple-wiki.el
P.S. although, may be i found link on the dokuwiki authors page - i don't remember

Anonymous said...

Thanks - I found a recent copy; now I get "char-to-string: Wrong type argument: arrayp, nil" when I ^v ^d. Hmm.

Alex Ott said...

strange - do you properly set name of server, name of user, etc? I have following settings
(global-unset-key [(control v)])
(require 'dokuwiki)
(setq dokuwiki-username "xxxx"
dokuwiki-password "xxxx"
dokuwiki-base-url "xxxxx")

Anonymous said...

The one thing I am not doing is setting the password. I would rather have it prompt me each time, a la tramp and the old ange-ftp. I suppose that "nil" could be the unset password...

Anonymous said...

Even with a password specified, I get a problem. I had a URI of the form "mywiki.foo.com/blah/blam"; when I change it to be just "mywiki.foo.com" I get a prompt for "Page name" in the mini-buffer, but no matter what I type, I always get a "NEW" and empty buffer.

What are proper forms for a name here? I've tried things like, "projects:bar" and "projects/bar", but same empty page result.

Alex Ott said...

when entering the name of the page, use tab to complete name of the page. If the page in the some namespace (has : char in the name), that you need to enter first the part of name together with :, and press enter, and then it will asked for page name again, but will suggest names from the given namespace.
For example (real example), i want to edit page 'pcl:examples'. i press C-v d, it asks me for name, and i enter 'pcl:' and press enter key. Then it going to the server, and collects names of the pages belonging to pcl: namespace, and asking me again for page name, in second case i enter complete name - 'pcl:examples' and press enter again

Anonymous said...

Interesting; I'm in edebug, and looked at the URL that was created for curl. It took my wiki and appended "/doku.php". I tried that with both curl from the regular shell and from a browser, and my wiki doesn't do that (404). Hmm. What version of dokuwiki did you base your mode upon?

Alex Ott said...

DokuWiki Release 2007-06-26

Anonymous said...

Hmm. I have a newer version, but I have also gotten past the doku.php problem (we have multiply wikis, so I needed to better qualify the URL). Now dokuwiki.el is choking when it parses a string that looks like:

foo%3Abar

At line 365, the value of "string" is as above, and when char-to-string chokes, the value of "x" is:

%3A

Still staring at this, but if it is "obvious" to you, I'm happy to try something out.

Thanks!