branch: master
commit 2487c3ab64f11c4b3d7ac883f95d5e2830e8f0f8
Author: Jackson Ray Hamilton <jack...@jacksonrayhamilton.com>
Commit: Jackson Ray Hamilton <jack...@jacksonrayhamilton.com>

    Fix eval-expression detection.
---
 context-coloring.el |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index 6685ff2..1967cdf 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -1044,6 +1044,10 @@ It could be a quoted or backquoted expression."
 
 ;;; eval-expression colorization
 
+(defun context-coloring-eval-expression-match ()
+  "Determine where expression starts in `eval-expression'."
+  (string-match "\\`Eval: " (buffer-string)))
+
 (defun context-coloring-eval-expression-colorize ()
   "Color the `eval-expression' minibuffer prompt as elisp."
   (interactive)
@@ -1051,7 +1055,7 @@ It could be a quoted or backquoted expression."
    (lambda ()
      (context-coloring-elisp-colorize-region-initially
       (progn
-        (string-match "\\`Eval: " (buffer-string))
+        (context-coloring-eval-expression-match)
         (1+ (match-end 0)))
       (point-max)))))
 
@@ -1171,7 +1175,8 @@ override `context-coloring-default-delay'.
 ;; rely on this predicate instead.
 (defun context-coloring-eval-expression-predicate ()
   "Non-nil if the minibuffer is for `eval-expression'."
-  (eq this-command 'eval-expression))
+  ;; Kinda better than checking `this-command', because `this-command' changes.
+  (context-coloring-eval-expression-match))
 
 (context-coloring-define-dispatch
  'eval-expression

Reply via email to