dict-mode.el
changeset 849 c34dc5f47510
parent 848 8125f4d8b6d4
child 850 38ca922a6d11
equal deleted inserted replaced
848:8125f4d8b6d4 849:c34dc5f47510
    25         ("^\\(_\\{5,\\}\\)\n\n\\(\\w[^\n]*\\)$"
    25         ("^\\(_\\{5,\\}\\)\n\n\\(\\w[^\n]*\\)$"
    26          (1 font-lock-function-name-face) (2 font-lock-keyword-face))
    26          (1 font-lock-function-name-face) (2 font-lock-keyword-face))
    27         ("\\[[^]]+]" . font-lock-type-face)
    27         ("\\[[^]]+]" . font-lock-type-face)
    28         ))
    28         ))
    29 
    29 
       
    30 (defun dict-c5-font-lock-extend-region ()
       
    31   ""
       
    32   (let (beg end)
       
    33     ;; font-lock-beg font-lock-end
       
    34     (save-excursion
       
    35       ;; (message "%d, %d:%d" point font-lock-beg font-lock-end)
       
    36       (goto-char font-lock-beg)
       
    37       (beginning-of-line)
       
    38       (when (eq (char-after (point)) ?_)
       
    39         (forward-line 3)
       
    40         (setq font-lock-end (point)))
       
    41       (goto-char font-lock-beg)
       
    42       (forward-line -2)
       
    43       (when (eq (char-after (point)) ?_)
       
    44         (setq font-lock-beg (point)))
       
    45       )))
       
    46 
       
    47 
    30 ;;;###autoload
    48 ;;;###autoload
    31 (define-derived-mode dict-c5-mode fundamental-mode "Dict-c5"
    49 (define-derived-mode dict-c5-mode fundamental-mode "Dict-c5"
    32   "Derived mode for editing C5 dictd source file."
    50   "Derived mode for editing C5 dictd source file."
    33   (add-to-list 'auto-mode-alist (cons "\\.dict-c5$" 'dict-c5-mode))
    51   (add-to-list 'auto-mode-alist (cons "\\.dict-c5$" 'dict-c5-mode))
    34   (setq font-lock-defaults
    52   (setq font-lock-defaults
    37           (font-lock-multiline . t)
    55           (font-lock-multiline . t)
    38           ))
    56           ))
    39   (use-local-map dict-c5-mode-map)
    57   (use-local-map dict-c5-mode-map)
    40   (modify-syntax-entry ?' ".")
    58   (modify-syntax-entry ?' ".")
    41   (modify-syntax-entry ?\" ".")
    59   (modify-syntax-entry ?\" ".")
       
    60   (add-hook 'font-lock-extend-region-functions 'dict-c5-font-lock-extend-region t)
    42   )
    61   )
    43 
    62 
    44 ;;; dict-mode.el ends here
    63 ;;; dict-mode.el ends here