obsolete/dict-c5-mode.el
changeset 335 8732c7c894af
parent 334 95ccf76a6c7f
equal deleted inserted replaced
334:95ccf76a6c7f 335:8732c7c894af
    13 ;;; Commentary:
    13 ;;; Commentary:
    14 ;;
    14 ;;
    15 ;; Very pure release.
    15 ;; Very pure release.
    16 
    16 
    17 ;;; Code:
    17 ;;; Code:
    18 
       
    19 (defvar dict-c5-mode-map (make-sparse-keymap))
       
    20 ;; (define-key dict-c5-mode-map (kbd "RET") 'my-xxx)
       
    21 
    18 
    22 (defvar dict-c5-font-lock-keywords
    19 (defvar dict-c5-font-lock-keywords
    23   '(
    20   '(
    24     ("^\\(_\\{5,\\}\\)\n\n\\(\\w.*\\)$"
    21     ("^\\(_\\{5,\\}\\)\n\n\\(\\w.*\\)$"
    25      (1 font-lock-function-name-face) (2 font-lock-keyword-face))
    22      (1 font-lock-function-name-face) (2 font-lock-keyword-face))
    47       )
    44       )
    48     t)
    45     t)
    49    (t nil)
    46    (t nil)
    50    ))
    47    ))
    51 
    48 
       
    49 (defun dict-c5-new-entry ()
       
    50   "Insert new entry template."
       
    51   (interactive)
       
    52   (if (re-search-forward "^_____" nil t)
       
    53       (beginning-of-line)
       
    54     (goto-char (point-max)))
       
    55   (while (eq (char-before) ?\n)
       
    56     (delete-backward-char 1))
       
    57   (insert-char ?\n)
       
    58   (insert-char ?_ 5)
       
    59   (insert-char ?\n 3)
       
    60   (backward-char))
       
    61 
       
    62 (defvar dict-c5-mode-map (make-sparse-keymap))
       
    63 (define-key dict-c5-mode-map [C-return] 'dict-c5-new-entry)
       
    64 
    52 ;;;###autoload
    65 ;;;###autoload
    53 (define-derived-mode dict-c5-mode fundamental-mode "Dict-c5"
    66 (define-derived-mode dict-c5-mode fundamental-mode "Dict-c5"
    54   "Derived mode for editing C5 dictd source file."
    67   "Derived mode for editing C5 dictd source file."
    55   (add-to-list 'auto-mode-alist (cons "\\.dict-c5$" 'dict-c5-mode))
    68   (add-to-list 'auto-mode-alist (cons "\\.dict-c5$" 'dict-c5-mode))
    56   (setq font-lock-defaults
    69   (setq font-lock-defaults