Michael Olson <address@hidden> writes:
Try adding the following to your .emacs.
(defun emacs-wiki-example-tag (beg end highlight-p)
Hmm, this deletes all starting whitespace, which breaks
nicely-indented code segments.
What about this?
(defun emacs-wiki-example-tag (beg end highlight-p)
(if highlight-p
(progn
(remove-text-properties
beg end '(face nil font-lock-multiline nil
invisible nil intangible nil display nil
mouse-face nil keymap nil help-echo nil))
(goto-char end))
;; Figure out how much whitespace precedes the example tag
(let (offset)
(goto-char beg)
(when (looking-back (concat "^[" emacs-wiki-regexp-blank "]+"))
(setq offset (concat "^" (match-string 0)))
(replace-match "")
(setq beg (point)))
(save-restriction
(narrow-to-region (point) end)
(insert "<pre class=\"example\">")
(when offset
(while (re-search-forward offset nil t)
(replace-match "")
(forward-line)))
(emacs-wiki-escape-html-specials end)
(goto-char (point-max))
(insert "</pre>"))
(add-text-properties beg (point) '(rear-nonsticky (read-only)
read-only t)))))
Mind you, the prefix whitespace needs to be exactly the same right now... =)