Version 4 (modified by hippiehacker, 6 years ago) (diff)

Changes to xml-rpc.el reflected in patch...

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.


  • 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

(defun trac-wiki-commit-all-modified-buffers ()
  "Iterate over modified trac-wiki buffers and prompt to commit each one"
  (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.

  • trac-wiki.el

     diff -E -b -u trac-wiki.el.1 trac-wiki.el
    old new  
    19221922(defun trac-wiki-convert-to-readable-time-string (str)
    19231923  "Parse STR as ISO format time and return encoded time value."
    1924   (if (not (string-match (concat "\\`"
    1925                                 "\\([0-9][0-9][0-9][0-9]\\)"
    1926                                 "\\([0-9][0-9]\\)"
    1927                                 "\\([0-9][0-9]\\)"
    1928                                 "T"
    1929                                 "\\([0-9][0-9]?\\)"
    1930                                 ":"
    1931                                 "\\([0-9][0-9]?\\)"
    1932                                 ":"
    1933                                 "\\([0-9][0-9]?\\)"
    1934                                 "\\([-+][0-9][0-9][0-9][0-9]\\)?"
    1935                                 "\\'")
    1936                         str))
    1937       (error "Invalid time format: %s" str)
    1938     (apply 'format "%s-%s-%s %s:%s:%s%s"
    1939           (append (mapcar (lambda (n)
    1940                             (or (match-string n str) ""))
    1941                           '(1 2 3 4 5 6 7))))))
     1924  (xml-rpc-datetime-to-string str)