[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 3985437 09/21: Use a mode hook for detecting entering Pret
From: |
Jackson Ray Hamilton |
Subject: |
[elpa] master 3985437 09/21: Use a mode hook for detecting entering Prettify Symbols mode. |
Date: |
Fri, 23 Dec 2016 20:27:51 +0000 (UTC) |
branch: master
commit 398543707c0845353290ee0f1911ba15c1349a59
Author: Jackson Ray Hamilton <address@hidden>
Commit: Jackson Ray Hamilton <address@hidden>
Use a mode hook for detecting entering Prettify Symbols mode.
---
context-coloring.el | 28 +++++-----------------------
1 file changed, 5 insertions(+), 23 deletions(-)
diff --git a/context-coloring.el b/context-coloring.el
index f7104ed..1429f66 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -427,24 +427,6 @@ permissible.")
(defvar context-coloring-interruptable-p t
"When non-nil, coloring may be interrupted by user input.")
-(defvar context-coloring-mode)
-
-(defun context-coloring-around-font-lock-flush (oldfun &rest r)
- "Advice around `font-lock-flush' for this mode only."
- (if context-coloring-mode
- (apply #'context-coloring-font-lock-flush r)
- (apply oldfun r)))
-
-(defun context-coloring-font-lock-flush (&optional start end)
- "Reimplementation of `font-lock-flush' for this mode.
-The original relies on Font Lock variables that would be messy to
-maintain here."
- (let* ((start (or start (point-min)))
- (end (or end (point-max)))
- (length (- end start)))
- (context-coloring-change-function start end length)
- (context-coloring-maybe-colorize-with-buffer (current-buffer))))
-
;;;###autoload
(define-minor-mode context-coloring-mode
"Toggle contextual code coloring.
@@ -482,11 +464,10 @@ Feature inspired by Douglas Crockford."
(font-lock-set-defaults)
;; Safely change the value of this function as necessary.
(make-local-variable 'font-lock-syntactic-face-function)
- ;; Improve integration with modes relying on Font Lock. Here, attempts
- ;; to refontify in Font Lock contexts will instead refontifiy in
Context
- ;; Coloring contexts. This is necessary for `prettify-symbols-mode'
- ;; integration.
- (advice-add #'font-lock-flush :around
#'context-coloring-around-font-lock-flush)
+ ;; Improve integration with `prettify-symbols-mode'. It relies on Font
+ ;; 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)
(let ((setup (plist-get dispatch :setup)))
(when setup
(funcall setup))
@@ -501,6 +482,7 @@ Feature inspired by Douglas Crockford."
(let ((teardown (plist-get dispatch :teardown)))
(when teardown
(funcall teardown)))))
+ (remove-hook 'prettify-symbols-mode-hook
#'context-coloring-maybe-fontify-keywords t)
(turn-on-font-lock-if-desired))))
(provide 'context-coloring)
- [elpa] master abded5f 14/21: Check for compositions on old Emacsen., (continued)
- [elpa] master abded5f 14/21: Check for compositions on old Emacsen., Jackson Ray Hamilton, 2016/12/23
- [elpa] master 269a382 15/21: Ensure coloring still works after prettification., Jackson Ray Hamilton, 2016/12/23
- [elpa] master b3ea138 19/21: Remove no-byte-compile from development files., Jackson Ray Hamilton, 2016/12/23
- [elpa] master ce29abd 17/21: Don't color before or beyond the buffer., Jackson Ray Hamilton, 2016/12/23
- [elpa] master 45b5ad0 16/21: Merge pull request #5 from jacksonrayhamilton/prettify-symbols, Jackson Ray Hamilton, 2016/12/23
- [elpa] master 5fe3695 07/21: Revert "Clean up local variable.", Jackson Ray Hamilton, 2016/12/23
- [elpa] master 550e61b 08/21: Merge branch 'master' into prettify-symbols, Jackson Ray Hamilton, 2016/12/23
- [elpa] master a1a6256 05/21: Set up post-colorize hooks., Jackson Ray Hamilton, 2016/12/23
- [elpa] master 4836dd0 10/21: Add tests for prettifying symbols., Jackson Ray Hamilton, 2016/12/23
- [elpa] master edbb191 13/21: Feature-detect prettify-symbols-mode for Emacs 24.3 compat., Jackson Ray Hamilton, 2016/12/23
- [elpa] master 3985437 09/21: Use a mode hook for detecting entering Prettify Symbols mode.,
Jackson Ray Hamilton <=
- [elpa] master 1b30a28 20/21: Version 8.1.0., Jackson Ray Hamilton, 2016/12/23
- [elpa] master 5402f35 21/21: Merge commit '1b30a28857727202d1f6a027f83ad66151fb1e92' from context-coloring, Jackson Ray Hamilton, 2016/12/23