我为配置文件编写了一个简单的主要模式。我想在保存时检查语法。如何确保my-check-syntax
被添加到after-save-hook
if 它位于my-config-mode
.
(defun my-check-syntax ()
;; code: print a message to show whether syntax is correct
)
(define-derived-mode my-config-mode nil "my-config"
(setq-local font-lock-defaults '(my-config-font-lock-keywords))
;; (add-hook 'after-save-hook #'my-check-syntax)
)
(add-to-list 'auto-mode-alist '("\\.myconfigure\\'" . my-config-mode))