unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#50502: grep-command cannot be set as a cons of the command and the point position
@ 2021-09-10 10:29 Yuchen Pei
  2021-09-11 13:38 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Yuchen Pei @ 2021-09-10 10:29 UTC (permalink / raw)
  To: 50502

[-- Attachment #1: Type: text/plain, Size: 1092 bytes --]

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>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 243 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#50502: grep-command cannot be set as a cons of the command and the point position
  2021-09-10 10:29 bug#50502: grep-command cannot be set as a cons of the command and the point position Yuchen Pei
@ 2021-09-11 13:38 ` Lars Ingebrigtsen
  2022-08-25 15:02   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Lars Ingebrigtsen @ 2021-09-11 13:38 UTC (permalink / raw)
  To: Yuchen Pei; +Cc: 50502

Yuchen Pei <hi@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





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#50502: grep-command cannot be set as a cons of the command and the point position
  2021-09-11 13:38 ` Lars Ingebrigtsen
@ 2022-08-25 15:02   ` Lars Ingebrigtsen
  0 siblings, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2022-08-25 15:02 UTC (permalink / raw)
  To: Yuchen Pei; +Cc: 50502

Lars Ingebrigtsen <larsi@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.






^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-08-25 15:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-10 10:29 bug#50502: grep-command cannot be set as a cons of the command and the point position Yuchen Pei
2021-09-11 13:38 ` Lars Ingebrigtsen
2022-08-25 15:02   ` Lars Ingebrigtsen

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