diff options
author | Lars Ingebrigtsen <larsi@gnus.org> | 2021-02-27 06:02:17 +0100 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2021-02-27 06:02:17 +0100 |
commit | f8b4623db3c9ff75907779881e5b52f246389719 (patch) | |
tree | 7a7542e14510120e5754d8b5a82c8da86a1dd2fd /lisp/progmodes/grep.el | |
parent | 7ac99eeefe26b8a6b1faf25371b375b9dcb66d03 (diff) | |
download | emacs-f8b4623db3c9ff75907779881e5b52f246389719.tar.gz |
Compute grep defaults earlier
* lisp/progmodes/grep.el (grep): Always compute the defaults
(bug#46801).
(grep-highlight-matches): Clarify that it's not just used
interactively.
Diffstat (limited to 'lisp/progmodes/grep.el')
-rw-r--r-- | lisp/progmodes/grep.el | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 3e92c699132..8c9a1b53b1b 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -88,9 +88,9 @@ To make grep highlight matches even into a pipe, you need the option `always' that forces grep to use `--color=always' to unconditionally output escape sequences. -In interactive usage, the actual value of this variable is set up -by `grep-compute-defaults' when the default value is `auto-detect'. -To change the default value, use \\[customize] or call the function +If the value is `auto-detect' (the default), `grep' will call +`grep-compute-defaults' to compute the value. To change the +default value, use \\[customize] or call the function `grep-apply-setting'." :type '(choice (const :tag "Do not highlight matches with grep markers" nil) (const :tag "Highlight matches with grep markers" t) @@ -915,7 +915,10 @@ list is empty)." (if current-prefix-arg default grep-command) 'grep-history (if current-prefix-arg nil default)))))) - + ;; If called non-interactively, also compute the defaults if we + ;; haven't already. + (when (eq grep-highlight-matches 'auto-detect) + (grep-compute-defaults)) (grep--save-buffers) ;; Setting process-setup-function makes exit-message-function work ;; even when async processes aren't supported. |