branch: master commit 269a382630abbf405cebaab4dee790450cb375a7 Author: Jackson Ray Hamilton <jack...@jacksonrayhamilton.com> Commit: Jackson Ray Hamilton <jack...@jacksonrayhamilton.com>
Ensure coloring still works after prettification. --- context-coloring-test.el | 10 ++++++++-- context-coloring.el | 4 ++++ fixtures/test/prettify-symbols.el | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/context-coloring-test.el b/context-coloring-test.el index fef12d5..0d1f539 100644 --- a/context-coloring-test.el +++ b/context-coloring-test.el @@ -346,6 +346,10 @@ signaled." (when (fboundp 'prettify-symbols-mode) + (defun context-coloring-test-assert-prettify-symbols-coloring () + (context-coloring-test-assert-coloring " +(111111 () (222222 ()))")) + (defun context-coloring-test-assert-prettify-symbols-text-properties () (unless (cond ((version< emacs-version "25.0") @@ -362,7 +366,8 @@ signaled." (emacs-lisp-mode) (prettify-symbols-mode) (context-coloring-mode) - (context-coloring-test-assert-prettify-symbols-text-properties)))) + (context-coloring-test-assert-prettify-symbols-text-properties) + (context-coloring-test-assert-prettify-symbols-coloring)))) (context-coloring-test-deftest prettify-symbols-enabled-after (lambda () @@ -371,7 +376,8 @@ signaled." (emacs-lisp-mode) (context-coloring-mode) (prettify-symbols-mode) - (context-coloring-test-assert-prettify-symbols-text-properties))))) + (context-coloring-test-assert-prettify-symbols-text-properties) + (context-coloring-test-assert-prettify-symbols-coloring))))) ;;; Coloring tests diff --git a/context-coloring.el b/context-coloring.el index 784fdbb..a64b6a9 100644 --- a/context-coloring.el +++ b/context-coloring.el @@ -468,6 +468,10 @@ Feature inspired by Douglas Crockford." ;; Lock's automatic fontification to apply it's changes on mode change, ;; so Context Coloring has to make those changes manually. (add-hook 'prettify-symbols-mode-hook #'context-coloring-maybe-fontify-keywords nil t) + ;; Furthermore, on Emacs < 25.0, `prettify-symbols-mode' calls + ;; `font-lock-fontify-buffer-function' which would overwrite context + ;; coloring, so make it a no-op. + (set (make-local-variable 'font-lock-fontify-buffer-function) (lambda ())) (let ((setup (plist-get dispatch :setup))) (when setup (funcall setup)) diff --git a/fixtures/test/prettify-symbols.el b/fixtures/test/prettify-symbols.el index 52295a6..0863230 100644 --- a/fixtures/test/prettify-symbols.el +++ b/fixtures/test/prettify-symbols.el @@ -1 +1 @@ -(lambda ()) +(lambda () (lambda ()))