* lisp/progmodes/grep.el (grep-compute-defaults): Compute grep-highlight-matches before its use.

This commit is contained in:
Juri Linkov 2014-11-19 00:05:09 +02:00
parent c0b877ba35
commit 239aa11e1e
2 changed files with 17 additions and 10 deletions

View 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

View 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