add emacs keyword highlight plugins
This commit is contained in:
parent
20e4e90921
commit
2246213a74
|
@ -0,0 +1,16 @@
|
|||
;;; ADD ME TO YOUR .emacs.d/init.el
|
||||
|
||||
(defun font-lock-user-keywords (mode &optional keywords)
|
||||
"Add user highlighting on KEYWORDS to given MODE.
|
||||
See `font-lock-add-keywords' and `font-lock-defaults'."
|
||||
(unless mode
|
||||
(error "mode should be non-nil "))
|
||||
(font-lock-remove-keywords mode (get mode 'font-lock-user-keywords))
|
||||
(font-lock-add-keywords mode keywords)
|
||||
(put mode 'font-lock-user-keywords keywords))
|
||||
|
||||
(font-lock-user-keywords
|
||||
'c-mode
|
||||
'(("pic_try" . font-lock-keyword-face)
|
||||
("pic_catch" . font-lock-keyword-face)
|
||||
("pic_for_each" . font-lock-keyword-face)))
|
|
@ -0,0 +1,29 @@
|
|||
;;; ADD ME TO YOUR .emacs.d/init.el
|
||||
|
||||
(defun scheme-add-keywords (face-name keyword-rules)
|
||||
(let* ((keyword-list (mapcar #'(lambda (x)
|
||||
(symbol-name (cdr x)))
|
||||
keyword-rules))
|
||||
(keyword-regexp (concat "(\\("
|
||||
(regexp-opt keyword-list)
|
||||
"\\)[ \n]")))
|
||||
(font-lock-add-keywords 'scheme-mode
|
||||
`((,keyword-regexp 1 ',face-name))))
|
||||
(mapc #'(lambda (x)
|
||||
(put (cdr x)
|
||||
'scheme-indent-function
|
||||
(car x)))
|
||||
keyword-rules))
|
||||
|
||||
(scheme-add-keywords
|
||||
'font-lock-keyword-face
|
||||
'((1 . when)
|
||||
(1 . unless)
|
||||
(1 . define-library)
|
||||
(0 . import)
|
||||
(0 . export)
|
||||
(1 . letrec*)
|
||||
(1 . define-values)
|
||||
(1 . define-record-type)
|
||||
(1 . parameterize)
|
||||
(0 . values)))
|
Loading…
Reference in New Issue