branch: master commit edbb1919960d10c74e8ee3d7ad59493ba50538bf Author: Jackson Ray Hamilton <jack...@jacksonrayhamilton.com> Commit: Jackson Ray Hamilton <jack...@jacksonrayhamilton.com>
Feature-detect prettify-symbols-mode for Emacs 24.3 compat. --- context-coloring-test.el | 46 ++++++++++++++++++++++++---------------------- context-coloring.el | 2 +- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/context-coloring-test.el b/context-coloring-test.el index 5ab7d60..79e5f23 100644 --- a/context-coloring-test.el +++ b/context-coloring-test.el @@ -344,28 +344,30 @@ signaled." '(context-coloring-level-0-face nil)) (disable-theme 'context-coloring-test-custom-theme))) -(defun context-coloring-test-assert-prettify-symbols-text-properties () - (unless (and (get-text-property 2 'prettify-symbols-start) - (get-text-property 2 'prettify-symbols-end)) - (ert-fail "Expected buffer to have it's symbols prettified, but it didn't."))) - -(context-coloring-test-deftest prettify-symbols-enabled-before - (lambda () - (context-coloring-test-with-fixture - "./fixtures/test/prettify-symbols.el" - (emacs-lisp-mode) - (prettify-symbols-mode) - (context-coloring-mode) - (context-coloring-test-assert-prettify-symbols-text-properties)))) - -(context-coloring-test-deftest prettify-symbols-enabled-after - (lambda () - (context-coloring-test-with-fixture - "./fixtures/test/prettify-symbols.el" - (emacs-lisp-mode) - (context-coloring-mode) - (prettify-symbols-mode) - (context-coloring-test-assert-prettify-symbols-text-properties)))) +(when (fboundp 'prettify-symbols-mode) + + (defun context-coloring-test-assert-prettify-symbols-text-properties () + (unless (and (get-text-property 2 'prettify-symbols-start) + (get-text-property 2 'prettify-symbols-end)) + (ert-fail "Expected buffer to have it's symbols prettified, but it didn't."))) + + (context-coloring-test-deftest prettify-symbols-enabled-before + (lambda () + (context-coloring-test-with-fixture + "./fixtures/test/prettify-symbols.el" + (emacs-lisp-mode) + (prettify-symbols-mode) + (context-coloring-mode) + (context-coloring-test-assert-prettify-symbols-text-properties)))) + + (context-coloring-test-deftest prettify-symbols-enabled-after + (lambda () + (context-coloring-test-with-fixture + "./fixtures/test/prettify-symbols.el" + (emacs-lisp-mode) + (context-coloring-mode) + (prettify-symbols-mode) + (context-coloring-test-assert-prettify-symbols-text-properties))))) ;;; Coloring tests diff --git a/context-coloring.el b/context-coloring.el index 1429f66..784fdbb 100644 --- a/context-coloring.el +++ b/context-coloring.el @@ -381,7 +381,7 @@ completes.") (defvar context-coloring-fontify-keywords-predicates (list - (lambda () prettify-symbols-mode)) + (lambda () (and (boundp 'prettify-symbols-mode) prettify-symbols-mode))) "Cases where the whole buffer should have keywords fontified. Necessary in cases where a mode relies on fontifications in regions where Context Coloring doesn't happen to touch.")