Create a new mode in Emacs

懵懂的女人 提交于 2019-12-04 13:03:55

Here is what you need to put into packet-mode.el:

(defvar packet-mode-font-lock-keywords
  '(("\\<packet\\>" . font-lock-keyword-face)))
(define-derived-mode packet-mode c++-mode "Packet"
  "A major mode to edit GNU ld script files."
  (font-lock-add-keywords nil packet-mode-font-lock-keywords))
(add-to-list 'auto-mode-alist '("\\.packet\\'" . packet-mode))
(provide 'packet-mode)

Place packet-mode.el into a directory in your load-path and (optionally) byte compile it.

Now, add (require 'packet-mode) into your .emacs.el.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!