From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Alan Mackenzie <acm@muc.de>
Cc: emacs-devel@gnu.org
Subject: Re: Irritation in C-u M-x grep, caused by overprotectiveness
Date: Sun, 29 Jul 2007 13:33:06 -0400 [thread overview]
Message-ID: <jwvhcnn86cp.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <20070729153027.GB1955@muc.de> (Alan Mackenzie's message of "Sun\, 29 Jul 2007 15\:30\:27 +0000")
>> Currently the code checks whether the previous "list of files"
>> (typically a global pattern) matches the current buffer's file name.
> No, it doesn't quite do this. If several "filenames" have been given on
> the top command line of grep's history, it only uses the first one,
> (match-string 3 grep-default). Maybe it should be using (substring
> grep-default (match-begin 3)) instead. But this is a separate issue.
Yes, the code could be improved.
>> If it does then the previous list of files is reused, otherwise the
>> previous list of files is ignored and replaced by a new glob pattern.
>> Now in your case, the list of files which *you* wrote did not "match"
>> the current buffer's file name, so clearly, the above heuristic
>> shouldn't be applied anyway. I.e. we should only check "does it match
>> the current file?" if it did match the current file in its previous
>> use.
> Maybe $VARIABLEs should be evaluated first. What do you think?
> Something like (getenv (substring grep-default (1+ (match-begin 3)))) fed
> into `regexp-opt', each element having been through `wildcard-to-regexp'.
> That might be heavy overkill, though.
Again, I agree that the implementation of the heuristic can be improved, but
in any case the implementation won't be perfect and the heuristic isn't
always correct, so it seems that if the heuristic doesn't apply to the
original case (either because of imperfect implementation or for some other
reason), then there's no reason to think it'll apply to the next case.
Stefan
next prev parent reply other threads:[~2007-07-29 17:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-29 11:09 Irritation in C-u M-x grep, caused by overprotectiveness Alan Mackenzie
2007-07-29 13:49 ` Stefan Monnier
2007-07-29 15:30 ` Alan Mackenzie
2007-07-29 17:33 ` Stefan Monnier [this message]
[not found] ` <E1IFYM6-000453-N8@fencepost.gnu.org>
2007-07-31 21:07 ` Alan Mackenzie
2007-08-01 14:07 ` Stefan Monnier
2007-08-01 14:30 ` Richard Stallman
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=jwvhcnn86cp.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=acm@muc.de \
--cc=emacs-devel@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).