diff options
author | Kyle Meyer <kyle@kyleam.com> | 2016-05-23 01:39:09 -0400 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2016-05-23 01:39:09 -0400 |
commit | 00d7142a0828910dd56c8a778cf656b92a532c0a (patch) | |
tree | e0b39c4c848ea26924a3c98c4ba1f9d77a1188c0 | |
parent | 0e685a392de3bece7ae9660599b8ce9dfd7f83e0 (diff) | |
download | bog-00d7142a0828910dd56c8a778cf656b92a532c0a.tar.gz |
Use bog-fontify-non-heading-citekeys in non-Org buffers
-rw-r--r-- | bog.el | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -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) |