GNU bug report logs - #50502
grep-command cannot be set as a cons of the command and the point position

Previous Next

Package: emacs;

Reported by: Yuchen Pei <hi <at> ypei.me>

Date: Fri, 10 Sep 2021 10:31:02 UTC

Severity: normal

Fixed in version 29.1

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 50502 in the body.
You can then email your comments to 50502 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-gnu-emacs <at> gnu.org:
bug#50502; Package emacs. (Fri, 10 Sep 2021 10:31:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Yuchen Pei <hi <at> ypei.me>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 10 Sep 2021 10:31:02 GMT) Full text and rfc822 format available.

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

From: Yuchen Pei <hi <at> ypei.me>
To: bug-gnu-emacs <bug-gnu-emacs <at> gnu.org>
Subject: grep-command cannot be set as a cons of the command and the point
 position
Date: Fri, 10 Sep 2021 20:29:58 +1000
[Message part 1 (text/plain, inline)]
Hello,

The following works:

(setq grep-find-command
     '("find . -type f -exec grep -inRH --color -A1 -B1 -E 
     \\{\\} +" . 52))

which places the point nicely after -E in the minibuffer when 
invoking grep-find.

But not the following:

(setq grep-command '("grep -inRH --color -A1 -B1 -E  ." . 31))

as emacs would complain that grep-command is not a string, even 
though both use read-shell-command for the command reading.

Two similarly named functions grep-default-command[1] and 
grep-compute-defaults[2] are used by grep and grep-find 
respectively at the beginning, with the grep-default-command 
requiring a regexp match on the grep-command (hence the error).

[1] 
https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/progmodes/grep.el#n821
[2] 
https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/progmodes/grep.el#n615

The code is a bit involved and I haven't read it through yet, but 
I wonder if anyone has come across this problem?

-- 
Best,
Yuchen

PGP Key: 47F9 D050 1E11 8879 9040  4941 2126 7E93 EF86 DFD0
          <https://ypei.me/assets/ypei-pubkey.txt>
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50502; Package emacs. (Sat, 11 Sep 2021 13:39:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Yuchen Pei <hi <at> ypei.me>
Cc: 50502 <at> debbugs.gnu.org
Subject: Re: bug#50502: grep-command cannot be set as a cons of the command
 and the point position
Date: Sat, 11 Sep 2021 15:38:06 +0200
Yuchen Pei <hi <at> ypei.me> writes:

> But not the following:
>
> (setq grep-command '("grep -inRH --color -A1 -B1 -E  ." . 31))
>
> as emacs would complain that grep-command is not a string, even though
> both use read-shell-command for the command reading.

Extending grep-command to allow it to specify where point should be
sounds like a good idea, but `grep-command' is used extensively both in
Emacs and (I'd guess) in external packages, so I think adding that
functionality that way is probably a lot of work.  (But I could be
wrong.)

Adding a new user option that says where point should be is probably a
lot less work -- `grep-command-point' or something.

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50502; Package emacs. (Thu, 25 Aug 2022 15:04:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Yuchen Pei <hi <at> ypei.me>
Cc: 50502 <at> debbugs.gnu.org
Subject: Re: bug#50502: grep-command cannot be set as a cons of the command
 and the point position
Date: Thu, 25 Aug 2022 17:02:51 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Adding a new user option that says where point should be is probably a
> lot less work -- `grep-command-point' or something.

So I've now done this in Emacs 29.





bug marked as fixed in version 29.1, send any further explanations to 50502 <at> debbugs.gnu.org and Yuchen Pei <hi <at> ypei.me> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 25 Aug 2022 15:04:02 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, 23 Sep 2022 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 187 days ago.

Previous Next


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