]> code.delx.au - gnu-emacs/commitdiff
* lisp/progmodes/grep.el (grep-compute-defaults): Compute grep-highlight-matches...
authorJuri Linkov <juri@linkov.net>
Tue, 18 Nov 2014 22:05:09 +0000 (00:05 +0200)
committerJuri Linkov <juri@linkov.net>
Tue, 18 Nov 2014 22:05:09 +0000 (00:05 +0200)
lisp/ChangeLog
lisp/progmodes/grep.el

index ba01694c5dd933dfb3711b9e0d5ce93b4b3b1040..7763d257224806ed574d3439efb1b8b8035ca9ba 100644 (file)
@@ -1,3 +1,8 @@
+2014-11-18  Juri Linkov  <juri@linkov.net>
+
+       * progmodes/grep.el (grep-compute-defaults):
+       Compute grep-highlight-matches before its use.
+
 2014-11-18  Juri Linkov  <juri@linkov.net>
 
        * replace.el (query-replace-from-to-separator): Turn defvar into
index fd48adc70c654477737059997c402fd5d9d7e569..b0d4b5ac3775cd89f4048dd36303f699edc8678b 100644 (file)
@@ -556,6 +556,18 @@ This function is called from `compilation-filter-hook'."
                        (looking-at
                         (concat (regexp-quote hello-file)
                                 ":[0-9]+:English")))))))))
+
+    (when (eq grep-highlight-matches 'auto-detect)
+      (setq grep-highlight-matches
+           (with-temp-buffer
+             (and (grep-probe grep-program '(nil t nil "--help"))
+                  (progn
+                    (goto-char (point-min))
+                    (search-forward "--color" nil t))
+                  ;; Windows and DOS pipes fail `isatty' detection in Grep.
+                  (if (memq system-type '(windows-nt ms-dos))
+                      'always 'auto)))))
+
     (unless (and grep-command grep-find-command
                 grep-template grep-find-template)
       (let ((grep-options
@@ -632,16 +644,6 @@ This function is called from `compilation-filter-hook'."
                        (t
                         (format "%s . <X> -type f <F> -print | \"%s\" %s"
                                 find-program xargs-program gcmd))))))))
-    (when (eq grep-highlight-matches 'auto-detect)
-      (setq grep-highlight-matches
-           (with-temp-buffer
-             (and (grep-probe grep-program '(nil t nil "--help"))
-                  (progn
-                    (goto-char (point-min))
-                    (search-forward "--color" nil t))
-                  ;; Windows and DOS pipes fail `isatty' detection in Grep.
-                  (if (memq system-type '(windows-nt ms-dos))
-                      'always 'auto)))))
 
     ;; Save defaults for this host.
     (setq grep-host-defaults-alist