GNU bug report logs - #28615
25.3; rgrep, grep-read-files confusingly completes file names

Previous Next

Package: emacs;

Reported by: ヌエルモリノ <vianchielfaura <at> gmail.com>

Date: Wed, 27 Sep 2017 07:03:01 UTC

Severity: minor

Found in version 25.3

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: ヌエルモリノ
 <vianchielfaura <at> gmail.com>
Subject: bug#28615: closed (Re: bug#28615: [PATCH] Clarify what
 grep-read-files wants)
Date: Mon, 09 Oct 2017 13:42:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#28615: 25.3; rgrep, grep-read-files confusingly completes file names

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 28615 <at> debbugs.gnu.org.

-- 
28615: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=28615
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Eli Zaretskii <eliz <at> gnu.org>
To: Allen Li <vianchielfaura <at> gmail.com>
Cc: 28615-done <at> debbugs.gnu.org
Subject: Re: bug#28615: [PATCH] Clarify what grep-read-files wants
Date: Mon, 09 Oct 2017 16:41:23 +0300
> From: Allen Li <vianchielfaura <at> gmail.com>
> Date: Wed, 4 Oct 2017 21:15:32 -0700
> 
> grep-read-files wants a filename glob, not a filename/path.
> 
> * lisp/progmodes/grep.el (grep-read-files): Clarify docstring.
>   Use file aliases for completion.
>   Clarify completing-read prompt.

Thanks, I installed a slightly different change for the first 2 parts,
but didn't change the function we pass to completing-read.

With that, I'm closing the bug report.

[Message part 3 (message/rfc822, inline)]
From: ヌエルモリノ <vianchielfaura <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.3; rgrep, grep-read-files confusingly completes file names
Date: Wed, 27 Sep 2017 00:01:56 -0700
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'



This bug report was last modified 7 years and 228 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.