diff options
| author | Juri Linkov | 2014-11-19 00:05:09 +0200 |
|---|---|---|
| committer | Juri Linkov | 2014-11-19 00:05:09 +0200 |
| commit | 239aa11e1eeb1aa7a1247c40cfac2fe43b715e25 (patch) | |
| tree | 3ed2c5924be15e8238ffc159b391abce55e1efb7 | |
| parent | c0b877ba35f5b1d4fc63e8472d6021fba0c8395a (diff) | |
| download | emacs-239aa11e1eeb1aa7a1247c40cfac2fe43b715e25.tar.gz emacs-239aa11e1eeb1aa7a1247c40cfac2fe43b715e25.zip | |
* lisp/progmodes/grep.el (grep-compute-defaults): Compute grep-highlight-matches before its use.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/progmodes/grep.el | 22 |
2 files changed, 17 insertions, 10 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ba01694c5dd..7763d257224 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,10 @@ | |||
| 1 | 2014-11-18 Juri Linkov <juri@linkov.net> | 1 | 2014-11-18 Juri Linkov <juri@linkov.net> |
| 2 | 2 | ||
| 3 | * progmodes/grep.el (grep-compute-defaults): | ||
| 4 | Compute grep-highlight-matches before its use. | ||
| 5 | |||
| 6 | 2014-11-18 Juri Linkov <juri@linkov.net> | ||
| 7 | |||
| 3 | * replace.el (query-replace-from-to-separator): Turn defvar into | 8 | * replace.el (query-replace-from-to-separator): Turn defvar into |
| 4 | defcustom. Wrap char-displayable-p in ignore-errors because an | 9 | defcustom. Wrap char-displayable-p in ignore-errors because an |
| 5 | attempt to autoload char-displayable-p fails during pre-loading. | 10 | attempt to autoload char-displayable-p fails during pre-loading. |
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index fd48adc70c6..b0d4b5ac377 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el | |||
| @@ -556,6 +556,18 @@ This function is called from `compilation-filter-hook'." | |||
| 556 | (looking-at | 556 | (looking-at |
| 557 | (concat (regexp-quote hello-file) | 557 | (concat (regexp-quote hello-file) |
| 558 | ":[0-9]+:English"))))))))) | 558 | ":[0-9]+:English"))))))))) |
| 559 | |||
| 560 | (when (eq grep-highlight-matches 'auto-detect) | ||
| 561 | (setq grep-highlight-matches | ||
| 562 | (with-temp-buffer | ||
| 563 | (and (grep-probe grep-program '(nil t nil "--help")) | ||
| 564 | (progn | ||
| 565 | (goto-char (point-min)) | ||
| 566 | (search-forward "--color" nil t)) | ||
| 567 | ;; Windows and DOS pipes fail `isatty' detection in Grep. | ||
| 568 | (if (memq system-type '(windows-nt ms-dos)) | ||
| 569 | 'always 'auto))))) | ||
| 570 | |||
| 559 | (unless (and grep-command grep-find-command | 571 | (unless (and grep-command grep-find-command |
| 560 | grep-template grep-find-template) | 572 | grep-template grep-find-template) |
| 561 | (let ((grep-options | 573 | (let ((grep-options |
| @@ -632,16 +644,6 @@ This function is called from `compilation-filter-hook'." | |||
| 632 | (t | 644 | (t |
| 633 | (format "%s . <X> -type f <F> -print | \"%s\" %s" | 645 | (format "%s . <X> -type f <F> -print | \"%s\" %s" |
| 634 | find-program xargs-program gcmd)))))))) | 646 | find-program xargs-program gcmd)))))))) |
| 635 | (when (eq grep-highlight-matches 'auto-detect) | ||
| 636 | (setq grep-highlight-matches | ||
| 637 | (with-temp-buffer | ||
| 638 | (and (grep-probe grep-program '(nil t nil "--help")) | ||
| 639 | (progn | ||
| 640 | (goto-char (point-min)) | ||
| 641 | (search-forward "--color" nil t)) | ||
| 642 | ;; Windows and DOS pipes fail `isatty' detection in Grep. | ||
| 643 | (if (memq system-type '(windows-nt ms-dos)) | ||
| 644 | 'always 'auto))))) | ||
| 645 | 647 | ||
| 646 | ;; Save defaults for this host. | 648 | ;; Save defaults for this host. |
| 647 | (setq grep-host-defaults-alist | 649 | (setq grep-host-defaults-alist |