From d0f06a37e44a9bd495246f680ce525ed7a8a3084 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Mon, 3 Feb 2014 00:01:21 -0500 Subject: Highlight in-text citekeys --- bog.el | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/bog.el b/bog.el index 316eff6..135ea94 100644 --- a/bog.el +++ b/bog.el @@ -345,6 +345,23 @@ The citekey is split by groups in `bog-citekey-format' and joined by (let ((query (bog-citekey-groups-with-delim citekey "+"))) (format bog-web-search-url query))) + +;;; Font-lock + +(defface bog-citekey-face + '((((class color) (background dark)) + (:bold t)) + (((class color) (background light)) + (:bold t))) + "Face used to highlight text that matches `bog-citekey-format'.") + +(defun bog-non-heading-citekey-p (limit) + (and (re-search-forward bog-citekey-format limit t) + (not (org-at-heading-p)))) + +(font-lock-add-keywords 'org-mode + '((bog-non-heading-citekey-p . 'bog-citekey-face))) + (provide 'bog) ;; bog.el ends here -- cgit v1.2.3