diff options
| author | Lars Ingebrigtsen | 2019-10-11 22:13:43 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2019-10-11 22:13:43 +0200 |
| commit | 6f66d813ba657a73c4d02c179f080dbeb3650075 (patch) | |
| tree | 73a69cc323df9e7697c26e1e347af6ee7fdc9bdc | |
| parent | 3f8885638a667dadcd9c38c1da07d143c9341b9a (diff) | |
| download | emacs-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.el | 63 |
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 | ||
| 92 | In interactive usage, the actual value of this variable is set up | 92 | In interactive usage, the actual value of this variable is set up |
| 93 | by `grep-compute-defaults' when the default value is `auto-detect'. | 93 | by `grep-compute-defaults' when the default value is `auto-detect'. |
| 94 | To change the default value, use Customize or call the function | 94 | To 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 | ||
| 122 | In interactive usage, the actual value of this variable is set up | 122 | In interactive usage, the actual value of this variable is set up |
| 123 | by `grep-compute-defaults'; to change the default value, use | 123 | by `grep-compute-defaults'; to change the default value, use |
| 124 | Customize 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 | ||
| 139 | In interactive usage, the actual value of this variable is set up | 139 | In interactive usage, the actual value of this variable is set up |
| 140 | by `grep-compute-defaults'; to change the default value, use | 140 | by `grep-compute-defaults'; to change the default value, use |
| 141 | Customize 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 | ||
| 154 | In interactive usage, the actual value of this variable is set up | 154 | In interactive usage, the actual value of this variable is set up |
| 155 | by `grep-compute-defaults'; to change the default value, use | 155 | by `grep-compute-defaults'; to change the default value, use |
| 156 | Customize 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]. |
| 176 | In interactive usage, the actual value of this variable is set up | 176 | In interactive usage, the actual value of this variable is set up |
| 177 | by `grep-compute-defaults'; to change the default value, use | 177 | by `grep-compute-defaults'; to change the default value, use |
| 178 | Customize 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. |
| 192 | In interactive usage, the actual value of this variable is set up | 192 | In interactive usage, the actual value of this variable is set up |
| 193 | by `grep-compute-defaults'; to change the default value, use | 193 | by `grep-compute-defaults'; to change the default value, use |
| 194 | Customize 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. |
| 222 | If an element is a cons cell, the car is called on the search directory | 221 | If an element is a cons cell, the car is called on the search directory |
| 223 | to determine whether cdr should not be recursed into." | 222 | to determine whether cdr should not be recursed into. |
| 223 | |||
| 224 | The 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. | ||
| 622 | The 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. |
| 882 | The output from the command goes to the \"*grep*\" buffer. | ||
| 883 | |||
| 876 | While Grep runs asynchronously, you can use \\[next-error] (M-x next-error), | 884 | While Grep runs asynchronously, you can use \\[next-error] (M-x next-error), |
| 877 | or \\<grep-mode-map>\\[compile-goto-error] in the *grep* \ | 885 | or \\<grep-mode-map>\\[compile-goto-error] in the *grep* \ |
| 878 | buffer, to go to the lines where Grep found | 886 | buffer, 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. |
| 915 | Collect output in a buffer. | 923 | Collect output in the \"*grep*\" buffer. |
| 916 | While find runs asynchronously, you can use the \\[next-error] command | 924 | While find runs asynchronously, you can use the \\[next-error] command |
| 917 | to find the text that grep hits refer to. | 925 | to 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'. |
| 949 | If car of an element matches, the cdr is evalled in to get the | 957 | If car of an element matches, the cdr is evalled in order to get the |
| 950 | substitution string. Note dynamic scoping of variables.") | 958 | substitution string. |
| 959 | |||
| 960 | The substitution is based on variables bound dynamically, and | ||
| 961 | these 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. |
| 986 | The pattern can include shell wildcards. As whitespace triggers | 998 | The pattern can include shell wildcards. As whitespace triggers |
| 987 | completion when entering a pattern, including it requires | 999 | completion when entering a pattern, including it requires |
| 988 | quoting, e.g. `\\[quoted-insert]<space>'." | 1000 | quoting, e.g. `\\[quoted-insert]<space>'. |
| 1001 | |||
| 1002 | REGEXP 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 | |||
| 1051 | before it is executed. | 1065 | before it is executed. |
| 1052 | With two \\[universal-argument] prefixes, directly edit and run `grep-command'. | 1066 | With two \\[universal-argument] prefixes, directly edit and run `grep-command'. |
| 1053 | 1067 | ||
| 1054 | Collect output in a buffer. While grep runs asynchronously, you | 1068 | Collect output in the \"*grep*\" buffer. While grep runs asynchronously, you |
| 1055 | can use \\[next-error] (M-x next-error), or \\<grep-mode-map>\\[compile-goto-error] \ | 1069 | can use \\[next-error] (M-x next-error), or \\<grep-mode-map>\\[compile-goto-error] \ |
| 1056 | in the grep output buffer, | 1070 | in the grep output buffer, |
| 1057 | to go to the lines where grep found matches. | 1071 | to go to the lines where grep found matches. |
| 1058 | 1072 | ||
| 1059 | This command shares argument histories with \\[rgrep] and \\[grep]." | 1073 | This command shares argument histories with \\[rgrep] and \\[grep]. |
| 1074 | |||
| 1075 | If CONFIRM, the user will be given an opportunity to edit the | ||
| 1076 | command 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 | |||
| 1132 | before it is executed. | 1149 | before it is executed. |
| 1133 | With two \\[universal-argument] prefixes, directly edit and run `grep-find-command'. | 1150 | With two \\[universal-argument] prefixes, directly edit and run `grep-find-command'. |
| 1134 | 1151 | ||
| 1135 | Collect output in a buffer. While the recursive grep is running, | 1152 | Collect output in the \"*grep*\" buffer. While the recursive grep is running, |
| 1136 | you can use \\[next-error] (M-x next-error), or \\<grep-mode-map>\\[compile-goto-error] \ | 1153 | you can use \\[next-error] (M-x next-error), or \\<grep-mode-map>\\[compile-goto-error] \ |
| 1137 | in the grep output buffer, | 1154 | in the grep output buffer, |
| 1138 | to visit the lines where matches were found. To kill the job | 1155 | to visit the lines where matches were found. To kill the job |
| @@ -1141,7 +1158,10 @@ before it finishes, type \\[kill-compilation]. | |||
| 1141 | This command shares argument histories with \\[lgrep] and \\[grep-find]. | 1158 | This command shares argument histories with \\[lgrep] and \\[grep-find]. |
| 1142 | 1159 | ||
| 1143 | When called programmatically and FILES is nil, REGEXP is expected | 1160 | When called programmatically and FILES is nil, REGEXP is expected |
| 1144 | to specify a command to run." | 1161 | to specify a command to run. |
| 1162 | |||
| 1163 | If CONFIRM, the user will be given an opportunity to edit the | ||
| 1164 | command 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. |
| 1255 | Like `rgrep' but uses `zgrep' for `grep-program', sets the default | 1275 | Like `rgrep' but uses `zgrep' for `grep-program', sets the default |
| 1256 | file name to `*.gz', and sets `grep-highlight-matches' to `always'." | 1276 | file name to `*.gz', and sets `grep-highlight-matches' to `always'. |
| 1277 | |||
| 1278 | If CONFIRM, the user will be given an opportunity to edit the | ||
| 1279 | command before it's run." | ||
| 1257 | (interactive | 1280 | (interactive |
| 1258 | (progn | 1281 | (progn |
| 1259 | ;; Compute standard default values. | 1282 | ;; Compute standard default values. |