Editing ZWikis with Emacs
Emacs ZWiki Mode
This document introduces
zwiki-mode-plus.el, an Emacs mode for editing Wiki
pages, residing on a Zope-based ZWiki. I developed
it because I cannot envisage editing structured text without using
filladapt.el to handle the indentation. Using Netscape's text-editing
widget is purgatory.
There is another ZWiki mode for Emacs written by Simon Michael, the
author of ZWiki itself. This version has two main advantages:
- It offers to create new ZWiki pages if they do not already exist. It
does this via xmlrpc.
- It does not lose undo information when a page is saved.
xmlrpc.el code might be of more general use.
Currently, the ZWiki Python code is not very friendly to external
programs that want to create pages via xmlrpc, so an external method
has to be installed on the server. Hopefully, future versions of ZWiki
will allow more direct access and this external method will no longer
What You Do
- Get hold of four files:
Put the files somewhere in the Emacs
load-path. You will also need to
have w3 installed. It is
standard with XEmacs distributions.
- Add the following to a file in the Extensions directory and add an
external method for
create_zwiki_page in the same directory
as the ZWiki pages or somewhere above it in the acquisition
def page_exists(self, page):
if page in self.REQUEST.PARENTS.objectIds():
def create_zwiki_page(self, page, text="\n"):
self.create(text=text, page=page, REQUEST=self.REQUEST)
## Avoid redirection to HTML page
- Put something like the following in your
;; For editing Zope ZWikis
;; To treat certain files automatically as ZWiki pages:
(cons (concat "<YOUR FTP HOST>:"
(autoload 'zwiki-mode "zwiki-mode-plus"
"Major mode for editing a zwiki page via ftp." t)
(autoload 'zwiki-edit-via-ftp "zwiki-mode-plus"
"Find the FTP file corresponding to the HTTP URL" t)
;; ZWiki is so good I am going to give it a global binding:
(global-set-key '[(control c) z] 'zwiki-edit-via-ftp)
My typical mode of operation is then to visit a ZWiki site in a web
browser. When I see a page I want to edit, I type
control-c z in Emacs
and paste in the HTTP URL. From then on, I just edit ZWiki pages via ftp
in Emacs and they automatically get treated as ZWiki pages.
Occasionally, I type
control-c control-b in a ZWiki page to see how the
page displays in a browser. New ZWiki pages are created for me when I
ffap with a cursor over a ZWikiName. If you do not use
you can call the command
Simple Use Without Page Creation
If you do not need the page creating functions, you can use
zwiki-mode-plus.el on its own. In that case, you will not need the
xml-parse.el, and you will not need to install
the external method. In addition, if you do not use
zope-browse-via-http, to switch between web browsing and ftp editing
of the same file, you will not need the
w3 package and the