# HG changeset patch # User Oleksandr Gavenko # Date 1458593835 -7200 # Node ID d5d1d3e6d11e499955b90367d2662c38e35238e6 # Parent 04caf7b9657c74843db7a1caef8ecdeef42b463c gadict-setup-fontlock diff -r 04caf7b9657c -r d5d1d3e6d11e contrib/gadict.el --- a/contrib/gadict.el Mon Mar 21 22:55:43 2016 +0200 +++ b/contrib/gadict.el Mon Mar 21 22:57:15 2016 +0200 @@ -27,6 +27,13 @@ ("^ +\\(?:v1\\|v2\\|v3\\|s\\|pl\\|male\\|female\\)$" . font-lock-doc-face) ("^\\(?:n\\|v\\|phr\\.v\\|adj\\|adv\\|pron\\|prep\\|num\\|conj\\|int\\)$" . font-lock-type-face) )) +(defun gadict-setup-fontlock () + (setq font-lock-defaults + '(gadict-font-lock-keywords + t nil nil nil + (font-lock-multiline . t) )) + (add-hook 'font-lock-extend-region-functions 'gadict-font-lock-extend-region t) ) + (defun gadict-setup-comment () (set (make-local-variable 'comment-start) "#") (set (make-local-variable 'comment-continue) nil) @@ -86,17 +93,12 @@ ;;;###autoload (define-derived-mode gadict-mode fundamental-mode "gadict" "Derived mode for editing gadict dictionary source files." - (setq font-lock-defaults - '(gadict-font-lock-keywords - t nil nil nil - (font-lock-multiline . t) - )) + (gadict-setup-fontlock) (gadict-setup-keymap) (gadict-setup-syntax) (gadict-setup-paragraph) (gadict-setup-page) - (gadict-setup-comment) - (add-hook 'font-lock-extend-region-functions 'gadict-font-lock-extend-region t) ) + (gadict-setup-comment) ) (provide 'gadict)