diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index dafba22f77..a5a2142a9e 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -534,6 +534,7 @@ grep-find-use-xargs (const :tag "find -exec {} +" exec-plus) (const :tag "find -print0 | xargs -0" gnu) (const :tag "find -print0 | sort -z | xargs -0'" gnu-sort) + (const :tag "find -print0 | sort -z | xargs -0' ... | cut -c -200" gnu-sort-cut) string (const :tag "Not Set" nil)) :set #'grep-apply-setting @@ -722,7 +723,8 @@ grep-compute-defaults (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)) + (if (or (eq grep-find-use-xargs 'gnu-sort-cut) + (memq system-type '(windows-nt ms-dos))) 'always 'auto))))) (unless (and grep-command grep-find-command @@ -775,6 +777,9 @@ grep-compute-defaults ((eq grep-find-use-xargs 'gnu-sort) (format "%s . -type f -print0 | sort -z | \"%s\" -0 %s" find-program xargs-program grep-command)) + ((eq grep-find-use-xargs 'gnu-sort-cut) + (format "%s . -type f -print0 | sort -z | \"%s\" -0 %s | cut -c -200" + find-program xargs-program grep-command)) ((memq grep-find-use-xargs '(exec exec-plus)) (let ((cmd0 (format "%s . -type f -exec %s" find-program grep-command)) @@ -803,6 +808,9 @@ grep-compute-defaults ((eq grep-find-use-xargs 'gnu-sort) (format "%s -type f -print0 | sort -z | \"%s\" -0 %s" find-program xargs-program gcmd)) + ((eq grep-find-use-xargs 'gnu-sort-cut) + (format "%s -type f -print0 | sort -z | \"%s\" -0 %s | cut -c -200" + find-program xargs-program gcmd)) ((eq grep-find-use-xargs 'exec) (format "%s -type f -exec %s %s %s%s" find-program gcmd quot-braces null quot-scolon))