From: Alan Mackenzie <acm@muc.de>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: Irritation in C-u M-x grep, caused by overprotectiveness
Date: Sun, 29 Jul 2007 15:30:27 +0000 [thread overview]
Message-ID: <20070729153027.GB1955@muc.de> (raw)
In-Reply-To: <jwvsl778guy.fsf-monnier+emacs@gnu.org>
Hi, Stefan!
On Sun, Jul 29, 2007 at 09:49:33AM -0400, Stefan Monnier wrote:
> > If I give an environment variable as "filename", the chances are I'll
> > want to use it in subsequent greps.
> I don't see why that'd generally be the case, but I guess it's just as
> good a default as the current one.
Well, there's nothing certain in Emacs users other than taxes and death.
I think it's a reasonable assumption, because setting up such a variable
is a lot of work; much more than just typing a list of filenames into the
minibuffer - anybody who does this will be expecting to use the variable
more than once.
> Maybe a better and more general approach to the problem goes as follows:
> 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.
> 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.
> Stefan
--
Alan.
next prev parent reply other threads:[~2007-07-29 15:30 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 [this message]
2007-07-29 17:33 ` Stefan Monnier
[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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070729153027.GB1955@muc.de \
--to=acm@muc.de \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/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.