Trac Wiki Page Editing Mode for Emacs
trac-wiki.el is a emacs lisp code to create/edit wiki pages via XML-RPC. It provides not only comfortable editing on emacs but also some original functions for editing like diff, merging, highlighting, completion.
Features
- Multiple project access.
- Retrieve page from remote site and edit it with highlighting.
- Commit page with version check.
- Diff / Ediff between editing text and original.
- Revert local edit.
- Merge with most recent version if it is modified by other user.
- Show history of page (but not so informative).
- Preview page in emacs with w3m (textual).
- Preview page with external browser with CSS.
- Search words in trac site for all pages and view result.
- Completion for macro name and wiki page name in buffer.
Patch to add save-buffers-kill-emacs support to trac-wiki
The following patch prevents you from losing work when hitting C-x C-c, by telling trac-wiki mode to prompt you when emacs is killed. Just paste it into your trac-wiki.el at the end, right before the line with (provide 'trac-wiki) .
(defun trac-wiki-modified-buffers ()
"Return a list of all modified trac-wiki buffers."
(let (trac-wiki-modified-buffer-list)
(dolist (buf (buffer-list) trac-wiki-modified-buffer-list)
(if (and (buffer-modified-p buf)
(equal "TracWiki" (cdr (assq 'mode-name (buffer-local-variables buf)))))
(setq trac-wiki-modified-buffer-list
(cons
buf
trac-wiki-modified-buffer-list))))))
(defun trac-wiki-commit-all-modified-buffers ()
"Iterate over modified trac-wiki buffers and prompt to commit each one"
(interactive)
(dolist (buf (trac-wiki-modified-buffers))
(switch-to-buffer buf)
(if (yes-or-no-p (format "Commit changes to buffer %s ? " (buffer-name buf)))
(call-interactively 'trac-wiki-commit))
))
;;Make save-buffers-kill-emacs run this function
(add-hook 'kill-emacs-query-functions (lambda () (trac-wiki-commit-all-modified-buffers) t))
Patch to trac-wiki.el to reflect changes in xml-rpc.el
At some point xml-rpc.el changed the way it handles datetime. trac-wiki.el needs the patch below applied to use this new format.
diff -E -b -u trac-wiki.el.1 trac-wiki.el --- trac-wiki.el.1 2007-11-15 03:50:18.000000000 +1300 +++ trac-wiki.el 2011-02-14 23:08:27.000000000 +1300 @@ -1921,24 +1921,8 @@ (defun trac-wiki-convert-to-readable-time-string (str) "Parse STR as ISO format time and return encoded time value." - (if (not (string-match (concat "\\`" - "\\([0-9][0-9][0-9][0-9]\\)" - "\\([0-9][0-9]\\)" - "\\([0-9][0-9]\\)" - "T" - "\\([0-9][0-9]?\\)" - ":" - "\\([0-9][0-9]?\\)" - ":" - "\\([0-9][0-9]?\\)" - "\\([-+][0-9][0-9][0-9][0-9]\\)?" - "\\'") - str)) - (error "Invalid time format: %s" str) - (apply 'format "%s-%s-%s %s:%s:%s%s" - (append (mapcar (lambda (n) - (or (match-string n str) "")) - '(1 2 3 4 5 6 7)))))) + (xml-rpc-datetime-to-string str) +)

