我想自己做一个编辑模式,但是百度不到多少资料
于是我去翻了一下js-mode
的源码,有点力不从心
;;;###autoload
(define-derived-mode js-mode prog-mode "JavaScript"
"Major mode for editing JavaScript."
:group 'js
(setq-local indent-line-function #'js-indent-line)
(setq-local beginning-of-defun-function #'js-beginning-of-defun)
(setq-local end-of-defun-function #'js-end-of-defun)
(setq-local open-paren-in-column-0-is-defun-start nil)
(setq-local font-lock-defaults
(list js--font-lock-keywords nil nil nil nil
'(font-lock-syntactic-face-function
. js-font-lock-syntactic-face-function)))
(setq-local syntax-propertize-function #'js-syntax-propertize)
(setq-local prettify-symbols-alist js--prettify-symbols-alist)
(setq-local parse-sexp-ignore-comments t)
(setq-local parse-sexp-lookup-properties t)
(setq-local which-func-imenu-joiner-function #'js--which-func-joiner)
;; Comments
(setq-local comment-start "// ")
(setq-local comment-end "")
(setq-local fill-paragraph-function #'js-c-fill-paragraph)
(setq-local normal-auto-fill-function #'js-do-auto-fill)
;; Parse cache
(add-hook 'before-change-functions #'js--flush-caches t t)
这里我想问点相关链接或教程,主要是对自定义编辑模式的
- 导入
- 怎么设置auto-load,导入这个模式
- 怎么根据文件名后缀,导入这个模式
- 怎么手动导入
- 关键字
- 怎么设置关键字
- 怎么标记关键字
- 其他
定义模式只有define-derived-mode
这个东西可以用吗,新建一个文件来配置,然后导入可以吗
新增
- define-derived-mode
- 需要的关键字有哪些
- 这些关键字功能是什么