unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: ヌエルモリノ <vianchielfaura@gmail.com>
To: 28615@debbugs.gnu.org
Subject: bug#28615: 25.3; rgrep, grep-read-files confusingly completes file names
Date: Wed, 27 Sep 2017 00:01:56 -0700	[thread overview]
Message-ID: <CAJr1M6fy+wRfbHn=iXDWAaX7zmqJ72VWRy-pOHuDkca5=Cr6ig@mail.gmail.com> (raw)

rgrep uses grep-read-files to read a filename as the second argument.
However, rgrep cannot actually accept a filename as the second argument.

For example, this is a normal rgrep call

  (rgrep "foo" "*.el" "/some/dir/" nil)

"*.el" is read with grep-read-files, which uses filename completion.
However, actually entering a filename doesn’t really work

  (rgrep "foo" "foo/*.el" "/some/dir/" nil)
  (rgrep "foo" "foo/bar.el" "/some/dir/" nil)

The second argument is passed to the find program as an -iname argument
as a glob, which matches against strictly the filename (e.g., like
file-name-nondirectory) and not the path.

There are a few points that could be improved here.

1. The grep-read-files prompt is confusing.  The prompt is: "Search for
\"foo\" in files: ".  It is not clear that this is asking for a filename
glob.

2. grep-read-files uses filename completion, which suggests that the
user should enter a filename.  This is very misleading as most paths
will fail to work, passing a filename without a slash will likely not
work as the user would expect, and almost certainly a glob would be the
desired input.

In GNU Emacs 25.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.19)
 of 2017-09-16 built on juergen
Windowing system distributor 'The X.Org Foundation', version 11.0.11903000
Configured using:
 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --with-x-toolkit=gtk3 --with-xft --with-modules
 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong
 -fno-plt' CPPFLAGS=-D_FORTIFY_SOURCE=2
 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'





             reply	other threads:[~2017-09-27  7:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-27  7:01 ヌエルモリノ [this message]
2017-10-05  4:15 ` bug#28615: [PATCH] Clarify what grep-read-files wants Allen Li
2017-10-09 13:41   ` Eli Zaretskii
2017-10-10  4:43     ` Allen Li
2017-10-10  5:55       ` Eli Zaretskii
2017-10-10  6:51         ` Allen Li
2017-10-10  7:52           ` Eli Zaretskii

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to='CAJr1M6fy+wRfbHn=iXDWAaX7zmqJ72VWRy-pOHuDkca5=Cr6ig@mail.gmail.com' \
    --to=vianchielfaura@gmail.com \
    --cc=28615@debbugs.gnu.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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).