unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: "Drew Adams" <drew.adams@oracle.com>
Cc: 516@emacsbugs.donarmstrong.com
Subject: bug#516: [PATCH] Minor Enhancement for grep.el: auto-input thesymbol into minibuffer command line.
Date: Sun, 06 Dec 2009 02:35:31 +0200	[thread overview]
Message-ID: <87ocmc51x0.fsf@mail.jurta.org> (raw)
In-Reply-To: <B7ACE3CCB87041F1B85EFE27F4D7C571@us.oracle.com> (Drew Adams's message of "Sat, 5 Dec 2009 12:28:03 -0800")

>> `grep-tag-default' already provides the active region. But it uses
>> `shell-quote-argument' instead of surrounding by quotes.  I don't know
>> what is better, since it's harder to edit the command when
>> `shell-quote-argument' puts a backslash before every space
>> and some other characters.
>
> Not only that, but:
>
> a. You must use M-n to put it in the minibuffer. Not a big deal, but you must
> know about this, to think to do that.

You can use `C-u grep' instead of `M-n' to put it in the minibuffer as
initial input.  However, `C-u grep' is worse than `M-n' because such use
of C-u is non-standard (unlike `M-n' that is the standard key to put the
default value in the minibuffer).

> b. A default file-name pattern (e.g. "*.el") is also included, as part of what's
> inserted.

That's what rgrep/lgrep do.  They provide a default file-name pattern
depending on the buffer's file name.

> All of that (especially the backslashing instead of quoting), makes it harder to
> edit the text to match and the file names to match.

I don't like backslashing too.

>> Another drawback of `grep-tag-default' is that it provides only
>> one alternative.  This is unlike `read-regexp' that proposes
>> a list of possible default values.  So `grep-tag-default' could be
>> improved to do the same.
>
> FWIW, the code I use inserts the (quoted) region or the symbol name nearest
> point (if no active region), and leaves out a file pattern. (You can still get
> the vanilla default using `M-n'.)

I agree it would be better to provide the active region, and the vanilla
default using `M-n'.

-- 
Juri Linkov
http://www.jurta.org/emacs/





  reply	other threads:[~2009-12-06  0:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-02  3:47 bug#516: [PATCH] Minor Enhancement for grep.el: auto-input the symbol into minibuffer command line Kazuo YAGI
2009-12-05  0:38 ` Juri Linkov
2009-12-05  4:36   ` bug#516: [PATCH] Minor Enhancement for grep.el: auto-input thesymbol " Drew Adams
2009-12-05 19:51     ` Juri Linkov
2009-12-05 20:28       ` Drew Adams
2009-12-06  0:35         ` Juri Linkov [this message]
2019-06-27 18:05 ` bug#516: [PATCH] Minor Enhancement for grep.el: auto-input the symbol " Lars Ingebrigtsen

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=87ocmc51x0.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=516@emacsbugs.donarmstrong.com \
    --cc=drew.adams@oracle.com \
    /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).