aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2019-10-11 22:13:43 +0200
committerLars Ingebrigtsen2019-10-11 22:13:43 +0200
commit6f66d813ba657a73c4d02c179f080dbeb3650075 (patch)
tree73a69cc323df9e7697c26e1e347af6ee7fdc9bdc
parent3f8885638a667dadcd9c38c1da07d143c9341b9a (diff)
downloademacs-6f66d813ba657a73c4d02c179f080dbeb3650075.tar.gz
emacs-6f66d813ba657a73c4d02c179f080dbeb3650075.zip
Minor grep.el doc string clarifications
* lisp/progmodes/grep.el (grep-find-ignored-directories) (grep-compute-defaults, grep, grep-expand-template) (grep-highlight-matches, grep-use-null-device) (grep-find-command, grep-find-template, grep-expand-template) (rgrep): Minor doc string clarifications.
-rw-r--r--lisp/progmodes/grep.el63
1 files changed, 43 insertions, 20 deletions
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index fec87bbd1ca..cc1d44ee9e0 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -91,7 +91,7 @@ output escape sequences.
91 91
92In interactive usage, the actual value of this variable is set up 92In interactive usage, the actual value of this variable is set up
93by `grep-compute-defaults' when the default value is `auto-detect'. 93by `grep-compute-defaults' when the default value is `auto-detect'.
94To change the default value, use Customize or call the function 94To change the default value, use \\[customize] or call the function
95`grep-apply-setting'." 95`grep-apply-setting'."
96 :type '(choice (const :tag "Do not highlight matches with grep markers" nil) 96 :type '(choice (const :tag "Do not highlight matches with grep markers" nil)
97 (const :tag "Highlight matches with grep markers" t) 97 (const :tag "Highlight matches with grep markers" t)
@@ -121,7 +121,7 @@ include it when specifying `grep-command'.
121 121
122In interactive usage, the actual value of this variable is set up 122In interactive usage, the actual value of this variable is set up
123by `grep-compute-defaults'; to change the default value, use 123by `grep-compute-defaults'; to change the default value, use
124Customize or call the function `grep-apply-setting'." 124\\[customize] or call the function `grep-apply-setting'."
125 :type '(choice string 125 :type '(choice string
126 (const :tag "Not Set" nil)) 126 (const :tag "Not Set" nil))
127 :set 'grep-apply-setting 127 :set 'grep-apply-setting
@@ -138,7 +138,7 @@ The following place holders should be present in the string:
138 138
139In interactive usage, the actual value of this variable is set up 139In interactive usage, the actual value of this variable is set up
140by `grep-compute-defaults'; to change the default value, use 140by `grep-compute-defaults'; to change the default value, use
141Customize or call the function `grep-apply-setting'." 141\\[customize] or call the function `grep-apply-setting'."
142 :type '(choice string 142 :type '(choice string
143 (const :tag "Not Set" nil)) 143 (const :tag "Not Set" nil))
144 :set 'grep-apply-setting 144 :set 'grep-apply-setting
@@ -153,7 +153,7 @@ necessary if the grep program used supports the `-H' option.
153 153
154In interactive usage, the actual value of this variable is set up 154In interactive usage, the actual value of this variable is set up
155by `grep-compute-defaults'; to change the default value, use 155by `grep-compute-defaults'; to change the default value, use
156Customize or call the function `grep-apply-setting'." 156\\[customize] or call the function `grep-apply-setting'."
157 :type '(choice (const :tag "Do Not Append Null Device" nil) 157 :type '(choice (const :tag "Do Not Append Null Device" nil)
158 (const :tag "Append Null Device" t) 158 (const :tag "Append Null Device" t)
159 (other :tag "Not Set" auto-detect)) 159 (other :tag "Not Set" auto-detect))
@@ -175,7 +175,7 @@ This is done to disambiguate file names in `grep's output."
175 "The default find command for \\[grep-find]. 175 "The default find command for \\[grep-find].
176In interactive usage, the actual value of this variable is set up 176In interactive usage, the actual value of this variable is set up
177by `grep-compute-defaults'; to change the default value, use 177by `grep-compute-defaults'; to change the default value, use
178Customize or call the function `grep-apply-setting'." 178\\[customize] or call the function `grep-apply-setting'."
179 :type '(choice string 179 :type '(choice string
180 (const :tag "Not Set" nil)) 180 (const :tag "Not Set" nil))
181 :set 'grep-apply-setting 181 :set 'grep-apply-setting
@@ -191,7 +191,7 @@ The following place holders should be present in the string:
191 <R> - the regular expression searched for. 191 <R> - the regular expression searched for.
192In interactive usage, the actual value of this variable is set up 192In interactive usage, the actual value of this variable is set up
193by `grep-compute-defaults'; to change the default value, use 193by `grep-compute-defaults'; to change the default value, use
194Customize or call the function `grep-apply-setting'." 194\\[customize] or call the function `grep-apply-setting'."
195 :type '(choice string 195 :type '(choice string
196 (const :tag "Not Set" nil)) 196 (const :tag "Not Set" nil))
197 :set 'grep-apply-setting 197 :set 'grep-apply-setting
@@ -216,11 +216,12 @@ Customize or call the function `grep-apply-setting'."
216 :type 'alist 216 :type 'alist
217 :group 'grep) 217 :group 'grep)
218 218
219(defcustom grep-find-ignored-directories 219(defcustom grep-find-ignored-directories vc-directory-exclusion-list
220 vc-directory-exclusion-list
221 "List of names of sub-directories which `rgrep' shall not recurse into. 220 "List of names of sub-directories which `rgrep' shall not recurse into.
222If an element is a cons cell, the car is called on the search directory 221If an element is a cons cell, the car is called on the search directory
223to determine whether cdr should not be recursed into." 222to determine whether cdr should not be recursed into.
223
224The default value is inherited from `vc-directory-exclusion-list'."
224 :type '(choice (repeat :tag "Ignored directories" string) 225 :type '(choice (repeat :tag "Ignored directories" string)
225 (const :tag "No ignored directories" nil)) 226 (const :tag "No ignored directories" nil))
226 :group 'grep) 227 :group 'grep)
@@ -617,6 +618,11 @@ This function is called from `compilation-filter-hook'."
617 618
618;;;###autoload 619;;;###autoload
619(defun grep-compute-defaults () 620(defun grep-compute-defaults ()
621 "Compute the defaults for the `grep' command.
622The value depends on `grep-command', `grep-template',
623`grep-use-null-device', `grep-find-command', `grep-find-template',
624`grep-use-null-filename-separator', `grep-find-use-xargs' and
625`grep-highlight-matches'."
620 ;; Keep default values. 626 ;; Keep default values.
621 (unless grep-host-defaults-alist 627 (unless grep-host-defaults-alist
622 (add-to-list 628 (add-to-list
@@ -872,7 +878,9 @@ This function is called from `compilation-filter-hook'."
872 878
873;;;###autoload 879;;;###autoload
874(defun grep (command-args) 880(defun grep (command-args)
875 "Run Grep with user-specified COMMAND-ARGS, collect output in a buffer. 881 "Run Grep with user-specified COMMAND-ARGS.
882The output from the command goes to the \"*grep*\" buffer.
883
876While Grep runs asynchronously, you can use \\[next-error] (M-x next-error), 884While Grep runs asynchronously, you can use \\[next-error] (M-x next-error),
877or \\<grep-mode-map>\\[compile-goto-error] in the *grep* \ 885or \\<grep-mode-map>\\[compile-goto-error] in the *grep* \
878buffer, to go to the lines where Grep found 886buffer, to go to the lines where Grep found
@@ -912,7 +920,7 @@ list is empty)."
912;;;###autoload 920;;;###autoload
913(defun grep-find (command-args) 921(defun grep-find (command-args)
914 "Run grep via find, with user-specified args COMMAND-ARGS. 922 "Run grep via find, with user-specified args COMMAND-ARGS.
915Collect output in a buffer. 923Collect output in the \"*grep*\" buffer.
916While find runs asynchronously, you can use the \\[next-error] command 924While find runs asynchronously, you can use the \\[next-error] command
917to find the text that grep hits refer to. 925to find the text that grep hits refer to.
918 926
@@ -946,11 +954,15 @@ easily repeat a find command."
946 ("<X>" . excl) 954 ("<X>" . excl)
947 ("<R>" . (shell-quote-argument (or regexp "")))) 955 ("<R>" . (shell-quote-argument (or regexp ""))))
948 "List of substitutions performed by `grep-expand-template'. 956 "List of substitutions performed by `grep-expand-template'.
949If car of an element matches, the cdr is evalled in to get the 957If car of an element matches, the cdr is evalled in order to get the
950substitution string. Note dynamic scoping of variables.") 958substitution string.
959
960The substitution is based on variables bound dynamically, and
961these include `opts', `dir', `files', `null-device', `excl' and
962`regexp'.")
951 963
952(defun grep-expand-template (template &optional regexp files dir excl) 964(defun grep-expand-template (template &optional regexp files dir excl)
953 "Patch grep COMMAND string replacing <C>, <D>, <F>, <R>, and <X>." 965 "Expand grep COMMAND string replacing <C>, <D>, <F>, <R>, and <X>."
954 (let* ((command template) 966 (let* ((command template)
955 (env `((opts . ,(let (opts) 967 (env `((opts . ,(let (opts)
956 (when (and case-fold-search 968 (when (and case-fold-search
@@ -985,7 +997,9 @@ substitution string. Note dynamic scoping of variables.")
985 "Read a file-name pattern arg for interactive grep. 997 "Read a file-name pattern arg for interactive grep.
986The pattern can include shell wildcards. As whitespace triggers 998The pattern can include shell wildcards. As whitespace triggers
987completion when entering a pattern, including it requires 999completion when entering a pattern, including it requires
988quoting, e.g. `\\[quoted-insert]<space>'." 1000quoting, e.g. `\\[quoted-insert]<space>'.
1001
1002REGEXP is used as a string in the prompt."
989 (let* ((grep-read-files-function (get major-mode 'grep-read-files)) 1003 (let* ((grep-read-files-function (get major-mode 'grep-read-files))
990 (file-name-at-point 1004 (file-name-at-point
991 (run-hook-with-args-until-success 'file-name-at-point-functions)) 1005 (run-hook-with-args-until-success 'file-name-at-point-functions))
@@ -1051,12 +1065,15 @@ With \\[universal-argument] prefix, you can edit the constructed shell command l
1051before it is executed. 1065before it is executed.
1052With two \\[universal-argument] prefixes, directly edit and run `grep-command'. 1066With two \\[universal-argument] prefixes, directly edit and run `grep-command'.
1053 1067
1054Collect output in a buffer. While grep runs asynchronously, you 1068Collect output in the \"*grep*\" buffer. While grep runs asynchronously, you
1055can use \\[next-error] (M-x next-error), or \\<grep-mode-map>\\[compile-goto-error] \ 1069can use \\[next-error] (M-x next-error), or \\<grep-mode-map>\\[compile-goto-error] \
1056in the grep output buffer, 1070in the grep output buffer,
1057to go to the lines where grep found matches. 1071to go to the lines where grep found matches.
1058 1072
1059This command shares argument histories with \\[rgrep] and \\[grep]." 1073This command shares argument histories with \\[rgrep] and \\[grep].
1074
1075If CONFIRM, the user will be given an opportunity to edit the
1076command before it's run."
1060 (interactive 1077 (interactive
1061 (progn 1078 (progn
1062 (grep-compute-defaults) 1079 (grep-compute-defaults)
@@ -1132,7 +1149,7 @@ With \\[universal-argument] prefix, you can edit the constructed shell command l
1132before it is executed. 1149before it is executed.
1133With two \\[universal-argument] prefixes, directly edit and run `grep-find-command'. 1150With two \\[universal-argument] prefixes, directly edit and run `grep-find-command'.
1134 1151
1135Collect output in a buffer. While the recursive grep is running, 1152Collect output in the \"*grep*\" buffer. While the recursive grep is running,
1136you can use \\[next-error] (M-x next-error), or \\<grep-mode-map>\\[compile-goto-error] \ 1153you can use \\[next-error] (M-x next-error), or \\<grep-mode-map>\\[compile-goto-error] \
1137in the grep output buffer, 1154in the grep output buffer,
1138to visit the lines where matches were found. To kill the job 1155to visit the lines where matches were found. To kill the job
@@ -1141,7 +1158,10 @@ before it finishes, type \\[kill-compilation].
1141This command shares argument histories with \\[lgrep] and \\[grep-find]. 1158This command shares argument histories with \\[lgrep] and \\[grep-find].
1142 1159
1143When called programmatically and FILES is nil, REGEXP is expected 1160When called programmatically and FILES is nil, REGEXP is expected
1144to specify a command to run." 1161to specify a command to run.
1162
1163If CONFIRM, the user will be given an opportunity to edit the
1164command before it's run."
1145 (interactive 1165 (interactive
1146 (progn 1166 (progn
1147 (grep-compute-defaults) 1167 (grep-compute-defaults)
@@ -1253,7 +1273,10 @@ to specify a command to run."
1253(defun zrgrep (regexp &optional files dir confirm template) 1273(defun zrgrep (regexp &optional files dir confirm template)
1254 "Recursively grep for REGEXP in gzipped FILES in tree rooted at DIR. 1274 "Recursively grep for REGEXP in gzipped FILES in tree rooted at DIR.
1255Like `rgrep' but uses `zgrep' for `grep-program', sets the default 1275Like `rgrep' but uses `zgrep' for `grep-program', sets the default
1256file name to `*.gz', and sets `grep-highlight-matches' to `always'." 1276file name to `*.gz', and sets `grep-highlight-matches' to `always'.
1277
1278If CONFIRM, the user will be given an opportunity to edit the
1279command before it's run."
1257 (interactive 1280 (interactive
1258 (progn 1281 (progn
1259 ;; Compute standard default values. 1282 ;; Compute standard default values.