comparison lisp/progmodes/grep.el @ 56948:f6f74981c4b0

(grep-highlight-matches): Change default from `t' to `auto-detect', and type from `boolean' to `choice'. (grep-compute-defaults): Set `grep-highlight-matches' to `t' if grep option `--color' is available, or to `nil' otherwise. (grep-use-null-device): Remove redundant type `boolean' (`choice' is already defined).
author Juri Linkov <juri@jurta.org>
date Tue, 07 Sep 2004 03:55:28 +0000
parents 377f75f46699
children 84482ed458f2
comparison
equal deleted inserted replaced
56947:a1a3a7ab3bad 56948:f6f74981c4b0
62 (const :tag "None" nil) 62 (const :tag "None" nil)
63 (integer :tag "First N lines")) 63 (integer :tag "First N lines"))
64 :version "21.4" 64 :version "21.4"
65 :group 'grep) 65 :group 'grep)
66 66
67 (defcustom grep-highlight-matches t 67 (defcustom grep-highlight-matches 'auto-detect
68 "*Non-nil to use special markers to highlight grep matches. 68 "*If t, use special markers to highlight grep matches.
69 69
70 Some grep programs are able to surround matches with special 70 Some grep programs are able to surround matches with special
71 markers in grep output. Such markers can be used to highlight 71 markers in grep output. Such markers can be used to highlight
72 matches in grep mode. 72 matches in grep mode.
73 73
74 This option sets the environment variable GREP_COLOR to specify 74 This option sets the environment variable GREP_COLOR to specify
75 markers for highlighting and GREP_OPTIONS to add the --color 75 markers for highlighting and GREP_OPTIONS to add the --color
76 option in front of any explicit grep options before starting 76 option in front of any explicit grep options before starting
77 the grep." 77 the grep."
78 :type 'boolean 78 :type '(choice (const :tag "Do not highlight matches with grep markers" nil)
79 (const :tag "Highlight matches with grep markers" t)
80 (other :tag "Not Set" auto-detect))
79 :version "21.4" 81 :version "21.4"
80 :group 'grep) 82 :group 'grep)
81 83
82 (defcustom grep-scroll-output nil 84 (defcustom grep-scroll-output nil
83 "*Non-nil to scroll the *grep* buffer window as output appears. 85 "*Non-nil to scroll the *grep* buffer window as output appears.
108 any match in the case where only a single file is searched, and is not 110 any match in the case where only a single file is searched, and is not
109 necessary if the grep program used supports the `-H' option. 111 necessary if the grep program used supports the `-H' option.
110 112
111 The default value of this variable is set up by `grep-compute-defaults'; 113 The default value of this variable is set up by `grep-compute-defaults';
112 call that function before using this variable in your program." 114 call that function before using this variable in your program."
113 :type 'boolean
114 :type '(choice (const :tag "Do Not Append Null Device" nil) 115 :type '(choice (const :tag "Do Not Append Null Device" nil)
115 (const :tag "Append Null Device" t) 116 (const :tag "Append Null Device" t)
116 (other :tag "Not Set" auto-detect)) 117 (other :tag "Not Set" auto-detect))
117 :group 'grep) 118 :group 'grep)
118 119
413 find-program gcmd)) 414 find-program gcmd))
414 (grep-find-use-xargs 415 (grep-find-use-xargs
415 (format "%s <D> <X> -type f <F> -print | xargs %s <R>" 416 (format "%s <D> <X> -type f <F> -print | xargs %s <R>"
416 find-program gcmd)) 417 find-program gcmd))
417 (t (format "%s <D> <X> -type f <F> -exec %s <R> {} %s \\;" 418 (t (format "%s <D> <X> -type f <F> -exec %s <R> {} %s \\;"
418 find-program gcmd null-device))))))) 419 find-program gcmd null-device))))))
420 (unless (or (not grep-highlight-matches) (eq grep-highlight-matches t))
421 (setq grep-highlight-matches
422 (with-temp-buffer
423 (and (equal (condition-case nil
424 (call-process grep-program nil t nil "--help")
425 (error nil))
426 0)
427 (progn
428 (goto-char (point-min))
429 (search-forward "--color" nil t))
430 t)))))
419 431
420 (defun grep-default-command () 432 (defun grep-default-command ()
421 (let ((tag-default 433 (let ((tag-default
422 (funcall (or find-tag-default-function 434 (funcall (or find-tag-default-function
423 (get major-mode 'find-tag-default-function) 435 (get major-mode 'find-tag-default-function)