GNU bug report logs - #516
[PATCH] Minor Enhancement for grep.el: auto-input the symbol into minibuffer command line.

Previous Next

Package: emacs;

Reported by: Kazuo YAGI <kyagi <at> miraclelinux.com>

Date: Wed, 2 Jul 2008 03:55:04 UTC

Severity: wishlist

Tags: patch, wontfix

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 516 in the body.
You can then email your comments to 516 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#516; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Kazuo YAGI <kyagi <at> miraclelinux.com>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Kazuo YAGI <kyagi <at> miraclelinux.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Minor Enhancement for grep.el: auto-input the symbol into
 minibuffer command line.
Date: Wed, 02 Jul 2008 12:47:10 +0900
[Message part 1 (text/plain, inline)]
Hi guys,

I'd like to suggest a minor enhancement for "lisp/progmodes/grep.el".

This patch is to let you input the cursor position symbol automatically
into minibuffer command line. I think it makes us easier to use "grep-find"
function.

Also attached is the images for showing how to work "grep-find" function
before and after this patch.

I confirmed that it is possible to apply this patch both 22.1 and 22.2 version.

Thanks,
- Kazuo YAGI
[grep.el.patch (text/x-diff, inline)]
--- cur/grep.el	2007-04-08 11:08:48.000000000 +0900
+++ my/grep.el	2008-07-02 11:19:47.000000000 +0900
@@ -566,7 +566,7 @@ easily repeat a find command."
      (grep-compute-defaults)
      (if grep-find-command
 	 (list (read-from-minibuffer "Run find (like this): "
-				     grep-find-command nil nil
+				     (concat grep-find-command (thing-at-point 'symbol)) nil nil
                                      'grep-find-history))
        ;; No default was set
        (read-string
[before.png (image/png, inline)]
[after.png (image/png, inline)]

Tags added: patch Request was from Chong Yidong <cyd <at> stupidchicken.com> to control <at> emacsbugs.donarmstrong.com. (Tue, 12 Aug 2008 22:00:05 GMT) Full text and rfc822 format available.

Severity set to `wishlist' from `normal' Request was from Glenn Morris <rgm <at> gnu.org> to control <at> emacsbugs.donarmstrong.com. (Wed, 10 Sep 2008 01:25:04 GMT) Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#516; Package emacs. (Sat, 05 Dec 2009 02:15:07 GMT) Full text and rfc822 format available.

Acknowledgement sent to Juri Linkov <juri <at> jurta.org>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Sat, 05 Dec 2009 02:15:07 GMT) Full text and rfc822 format available.

Message #14 received at 516 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: 516 <at> debbugs.gnu.org
Subject: Re: [PATCH] Minor Enhancement for grep.el: auto-input the symbol into minibuffer command line.
Date: Sat, 05 Dec 2009 02:38:21 +0200
> This patch is to let you input the cursor position symbol automatically
> into minibuffer command line. I think it makes us easier to use "grep-find"
> function.

There is a function `grep-default-command' in grep.el that does this.
I wonder why it's used in `grep', but not in `grep-find'.  I think
we should do the same in `grep-find'.

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



Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#516; Package emacs. (Sat, 05 Dec 2009 04:40:07 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Drew Adams" <drew.adams <at> oracle.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Sat, 05 Dec 2009 04:40:08 GMT) Full text and rfc822 format available.

Message #19 received at 516 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Juri Linkov'" <juri <at> jurta.org>, <516 <at> debbugs.gnu.org>
Subject: RE: bug#516: [PATCH] Minor Enhancement for grep.el: auto-input thesymbol into minibuffer command line.
Date: Fri, 4 Dec 2009 20:36:17 -0800
> > This patch is to let you input the cursor position symbol 
> > automatically into minibuffer command line. I think it makes
> > us easier to use "grep-find" function.
> 
> There is a function `grep-default-command' in grep.el that does this.
> I wonder why it's used in `grep', but not in `grep-find'.  I think
> we should do the same in `grep-find'.

Yes, and as I've suggested before, if the region is active, then its contents,
surrounded by "s, should be the default search string. Example code:
http://www.emacswiki.org/emacs/grep%2b.el




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#516; Package emacs. (Sat, 05 Dec 2009 19:55:14 GMT) Full text and rfc822 format available.

Acknowledgement sent to Juri Linkov <juri <at> jurta.org>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Sat, 05 Dec 2009 19:55:14 GMT) Full text and rfc822 format available.

Message #24 received at 516 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 516 <at> debbugs.gnu.org
Subject: Re: bug#516: [PATCH] Minor Enhancement for grep.el: auto-input thesymbol into minibuffer command line.
Date: Sat, 05 Dec 2009 21:51:17 +0200
>> > This patch is to let you input the cursor position symbol
>> > automatically into minibuffer command line. I think it makes
>> > us easier to use "grep-find" function.
>>
>> There is a function `grep-default-command' in grep.el that does this.
>> I wonder why it's used in `grep', but not in `grep-find'.  I think
>> we should do the same in `grep-find'.
>
> Yes, and as I've suggested before, if the region is active,
> then its contents, surrounded by "s, should be the default
> search string. Example code:
> http://www.emacswiki.org/emacs/grep%2b.el

`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.

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.

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



Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#516; Package emacs. (Sat, 05 Dec 2009 20:35:11 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Drew Adams" <drew.adams <at> oracle.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Sat, 05 Dec 2009 20:35:11 GMT) Full text and rfc822 format available.

Message #29 received at 516 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Juri Linkov'" <juri <at> jurta.org>
Cc: <516 <at> debbugs.gnu.org>
Subject: RE: bug#516: [PATCH] Minor Enhancement for grep.el: auto-input thesymbol into minibuffer command line.
Date: Sat, 5 Dec 2009 12:28:03 -0800
> >> > This patch is to let you input the cursor position symbol
> >> > automatically into minibuffer command line. I think it makes
> >> > us easier to use "grep-find" function.
> >>
> >> There is a function `grep-default-command' in grep.el that 
> >> does this. I wonder why it's used in `grep', but not in
> >> `grep-find'.  I think we should do the same in `grep-find'.
> >
> > Yes, and as I've suggested before, if the region is active,
> > then its contents, surrounded by "s, should be the default
> > search string. Example code:
> > http://www.emacswiki.org/emacs/grep%2b.el
> 
> `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.

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

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

> 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'.)




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#516; Package emacs. (Sun, 06 Dec 2009 01:30:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Juri Linkov <juri <at> jurta.org>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Sun, 06 Dec 2009 01:30:04 GMT) Full text and rfc822 format available.

Message #34 received at 516 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: <516 <at> debbugs.gnu.org>
Subject: Re: bug#516: [PATCH] Minor Enhancement for grep.el: auto-input thesymbol into minibuffer command line.
Date: Sun, 06 Dec 2009 02:35:31 +0200
>> `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/



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#516; Package emacs. (Thu, 27 Jun 2019 18:06:02 GMT) Full text and rfc822 format available.

Message #37 received at 516 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Kazuo YAGI <kyagi <at> miraclelinux.com>
Cc: 516 <at> debbugs.gnu.org
Subject: Re: bug#516: [PATCH] Minor Enhancement for grep.el: auto-input the
 symbol into minibuffer command line.
Date: Thu, 27 Jun 2019 20:05:36 +0200
Kazuo YAGI <kyagi <at> miraclelinux.com> writes:

> This patch is to let you input the cursor position symbol automatically
> into minibuffer command line. I think it makes us easier to use "grep-find"
> function.

[...]

> +				     (concat grep-find-command (thing-at-point 'symbol)) nil nil

This seems to be counter to how these functions usually work, so I don't
think making such a change would make sense, even if having what's under
point readily accessible.  But I'm closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) wontfix. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 27 Jun 2019 18:06:03 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 516 <at> debbugs.gnu.org and Kazuo YAGI <kyagi <at> miraclelinux.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 27 Jun 2019 18:06:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 26 Jul 2019 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 265 days ago.

Previous Next


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