summaryrefslogtreecommitdiff
path: root/lisp/progmodes/grep.el
diff options
context:
space:
mode:
authorAndrea Corallo <akrl@sdf.org>2021-03-09 10:03:47 +0100
committerAndrea Corallo <akrl@sdf.org>2021-03-09 10:03:47 +0100
commit43b0df62cd5922df5495b3f4aee5b7beca14384f (patch)
tree3c0bfa9526d08c9c85e646cd355467e3dfb439ac /lisp/progmodes/grep.el
parent380ba045c48bfbb160da288b1bd50f82d3f999f0 (diff)
parent9cbdf20316e1cec835a7dfe28877142e437976f4 (diff)
downloademacs-43b0df62cd5922df5495b3f4aee5b7beca14384f.tar.gz
emacs-43b0df62cd5922df5495b3f4aee5b7beca14384f.tar.bz2
emacs-43b0df62cd5922df5495b3f4aee5b7beca14384f.zip
Merge commit '9cbdf20316' into native-comp
Diffstat (limited to 'lisp/progmodes/grep.el')
-rw-r--r--lisp/progmodes/grep.el11
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.