]> code.delx.au - gnu-emacs-elpa/commitdiff
Fix eval-expression detection.
authorJackson Ray Hamilton <jackson@jacksonrayhamilton.com>
Sun, 21 Jun 2015 20:19:40 +0000 (13:19 -0700)
committerJackson Ray Hamilton <jackson@jacksonrayhamilton.com>
Sun, 21 Jun 2015 20:19:40 +0000 (13:19 -0700)
context-coloring.el

index 6685ff267148737f30faf87e55007a26142ac8f7..1967cdf4cea590c7820c7d136ba8da2f56359b8f 100644 (file)
@@ -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