This wiki mode has been inspired by MeatBall:HumaneInterface. It will be a very very simple wiki mode (see WikiModeDiscussion) for single files. These files can be very large of course.
“Pages” will be delimited using a special regexp, such as “^\f$”. The first piece of text following the page delimiter and matching another regexp will be the title, for example “^\\(.*\\)$” which will make the first line after the page separator the title.
All textual occurences of the title will be linked to the relevant page. (Whitespace will be normalized.)
This will be like an outline-mode with wiki-capabilities. Thus, this mode will be a minor-mode, much like outline-minor-mode or wiki-mode. It will be useful for LaTeX, EmacsLisp, etc.
OK, here some mini-defun which could get this started. As a counterpart, we’d need a defun which looks at the text surrounding point and tries to match it against a heading returned by outline-headings. That would be the outline-wiki-jump defun then…
(defun outline-headings ()
"Returns a ALIST of all outline headings in the current buffer.
Entries look like (HEADING POS LEVEL) where
HEADING is a string,
POS is the position of that heading line and
LEVEL is the outline-level of that heading."
(let ((regexp (concat outline-regexp
"\\s-*\\(.*\\)\\s-*"
outline-heading-end-regexp))
headings)
(save-excursion
(goto-char (point-min))
(when (looking-at regexp) ;; We are bobp
(push (list (match-string 1) (point) (outline-level)) headings))
(while (outline-next-heading)
(when (looking-at regexp)
(push (list (match-string 1) (point) (outline-level)) headings))))
(nreverse headings)))