From 00d7142a0828910dd56c8a778cf656b92a532c0a Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Mon, 23 May 2016 01:39:09 -0400 Subject: Use bog-fontify-non-heading-citekeys in non-Org buffers --- bog.el | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/bog.el b/bog.el index 089dff0..93870c0 100644 --- a/bog.el +++ b/bog.el @@ -1324,16 +1324,17 @@ Topic headings are determined by `bog-topic-heading-level'." (defun bog-fontify-non-heading-citekeys (limit) "Highlight non-heading citekeys." - (with-syntax-table bog-citekey-syntax-table - (let ((case-fold-search nil)) - (while (re-search-forward bog-citekey-format limit t) - (unless (save-match-data (org-at-heading-p)) - (add-text-properties (match-beginning 0) (match-end 0) - '(face bog-citekey-face))))))) + (let ((org-buffer-p (derived-mode-p 'org-mode))) + (with-syntax-table bog-citekey-syntax-table + (let ((case-fold-search nil)) + (while (re-search-forward bog-citekey-format limit t) + (unless (and org-buffer-p + (save-match-data (org-at-heading-p))) + (add-text-properties (match-beginning 0) (match-end 0) + '(face bog-citekey-face)))))))) (defvar bog-citekey-font-lock-keywords - `((,bog-citekey-format . 'bog-citekey-face)) - "Citekey font-lock for non-Org buffers.") + '((bog-fontify-non-heading-citekeys . bog-citekey-face))) (defvar bog-font-lock-function (if (fboundp 'font-lock-flush) -- cgit v1.2.3