summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2014-02-03 00:01:21 -0500
committerKyle Meyer <kyle@kyleam.com>2014-02-03 00:50:18 -0500
commitd0f06a37e44a9bd495246f680ce525ed7a8a3084 (patch)
treeb8d1ab571cb3f146670388328d782cc34402602b
parent68e1df6a74e6791bef21b6c295ddc056cfe4d3e5 (diff)
downloadbog-d0f06a37e44a9bd495246f680ce525ed7a8a3084.tar.gz
Highlight in-text citekeysv0.5.0
-rw-r--r--bog.el17
1 files changed, 17 insertions, 0 deletions
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