Add shortcut to deploy to HG repos.
;;; dict-mode.el --- major mode for dict dictionary source files
;; Copyright (C) 2011 by Oleksandr Gavenko <gavenkoa@gmail.com>
;; You can do anything with this file without any warranty.
;; Author: Oleksandr Gavenko <gavenkoa@gmail.com>
;; Maintainer: Oleksandr Gavenko <gavenkoa@gmail.com>
;; Created: 2011-09-04
;; Version: 0.1
;; Keywords: dict, dictionary
;;; Commentary:
;;
;; Very pure release.
;;; Code:
(defvar dict-c5-font-lock-keywords
'(
("^\\(_\\{5,\\}\\)\n\n\\(\\w.*\\)$"
(1 font-lock-function-name-face) (2 font-lock-keyword-face))
("\\[[^]\n]+]" . font-lock-type-face)
))
(eval-when-compile
(defvar font-lock-beg)
(defvar font-lock-end))
(defun dict-c5-font-lock-extend-region ()
"Look for '_____' expression and extend `font-lock-beg' and `font-lock-end'."
;; (message "%d:%d, %d lines" font-lock-beg font-lock-end (count-lines font-lock-beg font-lock-end))
(cond
((and
(< (count-lines font-lock-beg font-lock-end) 5)
(not (and (<= (point-max) font-lock-end) (<= font-lock-beg (point-min)) )))
(save-excursion
(goto-char font-lock-beg)
(forward-line -2)
(setq font-lock-beg (point))
(goto-char font-lock-end)
(forward-line 3)
(setq font-lock-end (point))
)
t)
(t nil)
))
(defun dict-c5-new-entry ()
"Insert new entry template."
(interactive)
(if (re-search-forward "^_____" nil t)
(beginning-of-line)
(goto-char (point-max)))
(while (eq (char-before) ?\n)
(delete-backward-char 1))
(insert-char ?\n)
(insert-char ?_ 5)
(insert-char ?\n 3)
(backward-char))
(defvar dict-c5-mode-map (make-sparse-keymap))
(define-key dict-c5-mode-map [C-return] 'dict-c5-new-entry)
;;;###autoload
(define-derived-mode dict-c5-mode fundamental-mode "Dict-c5"
"Derived mode for editing C5 dictd source file."
(add-to-list 'auto-mode-alist (cons "\\.dict-c5$" 'dict-c5-mode))
(setq font-lock-defaults
'(dict-c5-font-lock-keywords
t nil nil nil
(font-lock-multiline . t)
))
(use-local-map dict-c5-mode-map)
(modify-syntax-entry ?' ".")
(modify-syntax-entry ?\" ".")
(make-local-variable 'paragraph-separate)
(setq paragraph-separate "\\([ \t\f]*\\|_\\{5,\\}\\)$")
(make-local-variable 'paragraph-start)
(setq paragraph-start paragraph-separate)
(add-hook 'font-lock-extend-region-functions 'dict-c5-font-lock-extend-region t)
)
;;; dict-mode.el ends here