Skip to content

Instantly share code, notes, and snippets.

@jiyoo
Created September 23, 2013 19:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jiyoo/6676050 to your computer and use it in GitHub Desktop.
Save jiyoo/6676050 to your computer and use it in GitHub Desktop.
word boundary font lock test
;;; Example 4
'(wxyz xy xy-xy end)
'(aabb ab ab-ab end)
(progn
(font-lock-add-keywords
nil
`(("\\bxy\\b"
(0 'success t))
("\\<ab\\>"
(0 'success t))
"end")
'set)
(font-lock-fontify-buffer)
(global-set-key (kbd "<f9>") 'describe-text-properties)
(global-set-key (kbd "<f10>")
(lambda () (interactive)
(describe-variable 'font-lock-keywords))))
;; value of font-lock-keywords in emacs-lisp-mode buffer:
'(t
(("\\bxy\\b"
(0 'success t))
("\\<ab\\>"
(0 'success t))
"end")
("\\bxy\\b"
(0 'success t))
("\\<ab\\>"
(0 'success t))
("end"
(0 font-lock-keyword-face))
("^\\s("
(0
(if
(memq
(get-text-property
(match-beginning 0)
'face)
'(font-lock-string-face font-lock-doc-face font-lock-comment-face))
(list 'face font-lock-warning-face 'help-echo "Looks like a toplevel defun: escape the parenthesis"))
prepend)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment