all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Robert Pluim <rpluim@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 29303@debbugs.gnu.org, gus@inodes.org
Subject: bug#29303: 25.2; vc-git-grep should shell-escape FILES
Date: Fri, 17 Nov 2017 10:54:59 +0100	[thread overview]
Message-ID: <878tf5fcwc.fsf@gmail.com> (raw)
In-Reply-To: <83375di8am.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 17 Nov 2017 11:06:09 +0200")

[-- Attachment #1: Type: text/plain, Size: 600 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Robert Pluim <rpluim@gmail.com>
>> For vc-git-grep, or for every function that uses grep-read-files?
>
> The latter, I think.  If there are too many of those callers, then we
> could describe this once, say in grep-read-files, and then reference
> that, with something like
>
>   Including whitespace in the pattern requires quoting, see
>   `grep-read-files' for the details.

There are only 4 such (5 if you count zrgrep, which basically says
'see rgrep') and the addition is small, so I documented it in the
callers, and in grep-read-files.

Robert


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Explain-how-to-enter-whitespace-when-using-grep-read.patch --]
[-- Type: text/x-patch, Size: 3857 bytes --]

From 2b0535557316518ea75945e0e7b20576b2bbea47 Mon Sep 17 00:00:00 2001
From: Robert Pluim <rpluim@gmail.com>
Date: Fri, 17 Nov 2017 10:51:26 +0100
Subject: [PATCH] Explain how to enter whitespace when using grep-read-files

* lisp/progmodes/grep.el (lgrep): Explain how to enter
whitespace when using grep-read-files.
(rgrep): Likewise.
(grep-read-files): Likewise.
* lisp/progmodes/project.el (project-find-regexp): Likewise.
* lisp/vc/vc-git.el (vc-git-grep): Likewise.
---
 lisp/progmodes/grep.el    | 12 +++++++++---
 lisp/progmodes/project.el |  6 +++++-
 lisp/vc/vc-git.el         |  4 +++-
 3 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index d0404fdeaf..56aef15a08 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -904,7 +904,9 @@ grep-read-regexp
 
 (defun grep-read-files (regexp)
   "Read a file-name pattern arg for interactive grep.
-The pattern can include shell wildcards."
+The pattern can include shell wildcards.  As whitespace triggers
+completion when entering a pattern, including it requires
+quoting, eg `\C-q<space>'."
   (let* ((bn (or (buffer-file-name)
 		 (replace-regexp-in-string "<[0-9]+>\\'" "" (buffer-name))))
 	 (fn (and bn
@@ -954,7 +956,9 @@ lgrep
   "Run grep, searching for REGEXP in FILES in directory DIR.
 The search is limited to file names matching shell pattern FILES.
 FILES may use abbreviations defined in `grep-files-aliases', e.g.
-entering `ch' is equivalent to `*.[ch]'.
+entering `ch' is equivalent to `*.[ch]'.  As whitespace triggers
+completion when entering a pattern, including it requires
+quoting, eg `\C-q<space>'.
 
 With \\[universal-argument] prefix, you can edit the constructed shell command line
 before it is executed.
@@ -1032,7 +1036,9 @@ rgrep
   "Recursively grep for REGEXP in FILES in directory tree rooted at DIR.
 The search is limited to file names matching shell pattern FILES.
 FILES may use abbreviations defined in `grep-files-aliases', e.g.
-entering `ch' is equivalent to `*.[ch]'.
+entering `ch' is equivalent to `*.[ch]'.  As whitespace triggers
+completion when entering a pattern, including it requires
+quoting, eg `\C-q<space>'.
 
 With \\[universal-argument] prefix, you can edit the constructed shell command line
 before it is executed.
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 9dc0da4ad5..06f5aa5c94 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -307,7 +307,11 @@ project--value-in-dir
 (defun project-find-regexp (regexp)
   "Find all matches for REGEXP in the current project's roots.
 With \\[universal-argument] prefix, you can specify the directory
-to search in, and the file name pattern to search for."
+to search in, and the file name pattern to search for.  The
+pattern may use abbreviations defined in `grep-files-aliases',
+e.g.  entering `ch' is equivalent to `*.[ch]'.  As whitespace
+triggers completion when entering a pattern, including it
+requires quoting, eg `\C-q<space>'."
   (interactive (list (project--read-regexp)))
   (let* ((pr (project-current t))
          (dirs (if current-prefix-arg
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 43164b4fcf..eaa31c5def 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -1407,7 +1407,9 @@ vc-git-grep
   "Run git grep, searching for REGEXP in FILES in directory DIR.
 The search is limited to file names matching shell pattern FILES.
 FILES may use abbreviations defined in `grep-files-aliases', e.g.
-entering `ch' is equivalent to `*.[ch]'.
+entering `ch' is equivalent to `*.[ch]'.  As whitespace triggers
+completion when entering a pattern, including it requires
+quoting, eg `\C-q<space>'.
 
 With \\[universal-argument] prefix, you can edit the constructed shell command line
 before it is executed.
-- 
2.15.0.276.g89ea799ff


  reply	other threads:[~2017-11-17  9:54 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-15  6:25 bug#29303: 25.2; vc-git-grep should shell-escape FILES Angus Lees
2017-11-15  9:58 ` Robert Pluim
2017-11-15 17:42   ` Eli Zaretskii
2017-11-15 18:45     ` Robert Pluim
2017-11-15 19:58       ` Eli Zaretskii
2017-11-15 20:17         ` Robert Pluim
2017-11-15 20:26           ` Eli Zaretskii
2017-11-15 20:36             ` Robert Pluim
2017-11-16 15:38               ` Eli Zaretskii
2017-11-16 15:43                 ` Robert Pluim
2017-11-17  7:13                   ` Angus Lees
2017-11-17  8:38                 ` Robert Pluim
2017-11-17  9:06                   ` Eli Zaretskii
2017-11-17  9:54                     ` Robert Pluim [this message]
2017-11-17 10:13                       ` Eli Zaretskii
2017-11-17 10:33                         ` Robert Pluim
2017-11-17 13:41                           ` Eli Zaretskii
2017-11-17 14:21                             ` Robert Pluim
2017-11-28 13:37                               ` Robert Pluim
2017-11-28 17:49                                 ` Eli Zaretskii
2017-11-16 15:55         ` Andreas Schwab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878tf5fcwc.fsf@gmail.com \
    --to=rpluim@gmail.com \
    --cc=29303@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=gus@inodes.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.