;;; Use raw text to fetch this code, see EmacsForMoinMoin for tutorial and discussion.

;;; Download link: http://moinmo.in/EmacsForMoinMoin/MoinMoinMode?action=raw

;;; moinmoin-mode.el --- a major mode to edit MoinMoin wiki pages

;; Written by ASK, distributed under GPL

;; Filename: moinmoin-mode.el ;; Keywords: moinmoin, wiki ;; Description: a major mode to edit MoinMoin wiki pages ;; Compatibility: GNU Emacs 22.0.50.1 (probably others) ;; Last modified: 2006-04-15

;; This file is NOT part of GNU Emacs.

(require 'screen-lines) ; uses screen-lines.el by Yuji Minejima, tested with 0.55

;;; Definition of font faces (defgroup moinmoin nil

(defface moinmoin-h5 '((t (:foreground "tan3" :slant italic)))

(defface moinmoin-h4 '((t (:inherit moinmoin-h5 :slant normal :foreground "tan4")))

(defface moinmoin-h3 '((t (:inherit moinmoin-h4 :weight bold)))

(defface moinmoin-h2 '((t (:inherit moinmoin-h3 :height 1.2)))

(defface moinmoin-h1 '((t (:inherit moinmoin-h2 :height 1.4)))

(defface moinmoin-smiley '((t (:foreground "green4" :weight bold)))

(defface moinmoin-table-separator '((t (:foreground "salmon" :weight bold)))

(defface moinmoin-table-pi '((t (:foreground "plum3")))

(defface moinmoin-anchor '((t (:foreground "tan3" :height 0.8)))

(defface moinmoin-anchor-ref-id '((t (:foreground "blue2" :height 0.8 :underline t)))

(defface moinmoin-anchor-ref-title '((t (:foreground "blue4" :underline t)))

(defface moinmoin-macro-name '((t (:foreground "plum3")))

(defface moinmoin-macro-parameters '((t (:foreground "plum4")))

(defface moinmoin-item '((t (:foreground "brown" :weight bold)))

(defface moinmoin-item-2 '((t (:foreground "brown")))

(defface moinmoin-blockquote-indent '((t (:background "aquamarine1")))

(defface moinmoin-blockquote-text '((t (:foreground "aquamarine4")))

(defface moinmoin-code '((t (:foreground "purple4")))

(defface moinmoin-code-braces '((t (:foreground "plum3")))

(defface moinmoin-pi '((t (:foreground "plum3" :weight bold)))

(defface moinmoin-comment '((t (:foreground "maroon3")))

(defface moinmoin-rule '((t (:foreground "tomato2" :weight bold)))

(defface moinmoin-ss '((t (:foreground "grey" ))) ;; try also :height 0.1

(defface moinmoin-tt '((t (:foreground "cyan4")))

(defface moinmoin-entity '((t (:foreground "grey")))

(defface moinmoin-email '((t (:foreground "blue2")))

(defface moinmoin-url '((t (:foreground "blue2" :height 0.8)))

(defface moinmoin-url-title '((t (:foreground "blue4" :underline t)))

(defface moinmoin-wiki-link '((t (:foreground "blue4" :weight bold)))

(defface moinmoin-inter-wiki-link '((t (:foreground "blue3" :weight bold)))

(defface moinmoin-bold '((t (:weight bold)))

(defface moinmoin-italic '((t (:slant italic)))

(defface moinmoin-underline '((t (:underline t)))

(defface moinmoin-stroke '((t (:strike-through t)))

(defface moinmoin-subscript '((t (:height 0.8)))

(defface moinmoin-superscript '((t (:height 0.8)))

;;; Font lock setup (defconst moinmoin-url-prefix

(defconst moinmoin-url-punctuation

(defconst moinmoin-pi-re

(defconst moinmoin-smiley-re

(defun moinmoin-formatted-code-matcher (bound)

This is supposed to be bug-to-bug compatible with moinmoin-1.5.2"

(defun moinmoin-bracketed-url-matcher (bound)

(defun moinmoin-setup-font-lock ()

;;; Automagic typing helpers (defun moinmoin-insert-quote ()

(defun moinmoin-insert-dash ()

----' and -' stays unchanged --' is converted to –' ---' is converted to —' `)--' is not changed' <-' is converted to ←'"


" t t))

(defun moinmoin-insert-lparen ()

(defun moinmoin-insert-greater-than ()

(defun moinmoin-insert-item ()

If current line starts with item prefix insert newline and the same prefix in front of the rest of line. If it is table then finish the line and add the new one"

;;; Header manipulation helpers (defun moinmoin-is-header ()

If yes the title is in \\1"

(defun moinmoin-increase-header-level ()

(defun moinmoin-decrease-header-level ()

Warns if point in a top-level header or not in a header"

(defun moinmoin-change-header-level (increment)

(defun moinmoin-change-header-levels-in-region (increment start end)

(defun moinmoin-insert-equal (increment)

With active region increase or decrease level of all headers in region. On an empty line starts new header. On a header line increase or decrease level. Otherwise just insert `='"

;;; Anchor insertion and navigation (defun moinmoin-list-anchors ()

(defvar moinmoin-anchor-history "Minibuffer history of anchors") (defun moinmoin-completing-read-anchor (prompt &optional require-match)

(defun moinmoin-insert-number-sign (&optional no-title)

If no argument given also insert the title of the section which contains the anchor."

(defun moinmoin-insert-anchor ()

(defun moinmoin-anchor-read-or-ask (&optional prompt)

(defun moinmoin-goto-anchor (&optional anchor)

If ANCHOR is nil (e.g., if called interactively) read reference to it from the current line or ask user. So if there is an anchor on the current line but you want to jump to something different go to the beginning of the line first."

(defun moinmoin-get-anchored-header (anchor)

(defun moinmoin-insert-anchored-header (&optional to-kill-ring)

;;; Setup (define-derived-mode moinmoin-mode outline-mode "MoinMoin"

(add-to-list 'auto-mode-alist '("\\.wiki$" . moinmoin-mode))

(provide 'moinmoin-mode)

MoinMoin: EmacsForMoinMoin/MoinMoinMode (last edited 2013-05-13 16:06:25 by ArniF)