From: Yuchen Pei <hi@ypei.me>
To: 50502@debbugs.gnu.org
Subject: bug#50502: grep-command cannot be set as a cons of the command and the point position
Date: Fri, 10 Sep 2021 20:29:58 +1000 [thread overview]
Message-ID: <87a6kkyb89.fsf@ypei.me> (raw)
[-- 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 --]
next reply other threads:[~2021-09-10 10:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-10 10:29 Yuchen Pei [this message]
2021-09-11 13:38 ` bug#50502: grep-command cannot be set as a cons of the command and the point position Lars Ingebrigtsen
2022-08-25 15:02 ` 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=87a6kkyb89.fsf@ypei.me \
--to=hi@ypei.me \
--cc=50502@debbugs.gnu.org \
/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).