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

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Yuchen Pei <hi@HIDDEN>; dated Fri, 10 Sep 2021 10:31:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 50502 <at> debbugs.gnu.org:


Received: (at 50502) by debbugs.gnu.org; 11 Sep 2021 13:38:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 11 09:38:18 2021
Received: from localhost ([127.0.0.1]:39781 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mP3D0-00060B-My
	for submit <at> debbugs.gnu.org; Sat, 11 Sep 2021 09:38:18 -0400
Received: from quimby.gnus.org ([95.216.78.240]:37220)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1mP3Cx-0005zx-Nm
 for 50502 <at> debbugs.gnu.org; Sat, 11 Sep 2021 09:38:16 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=M6ay7NzC+TTgOrKo7NVBqcPSR7B/X8fldRcbmv16R5Y=; b=De9LLAx+5pL8+8X8UuanLEFo2c
 02CrFbbDQHkbMXO4Jra6nvxfHYOB4tUTB6Tf2t+LhuKNTkBDWpoJkKaG/lH4LZRYAJiWaZd0vRb55
 xkVpsaPxjxeFb3UnULlVxsOdWlUAK0fYBppZA5e7WYWRidmJfklQN+pnujNEa8i28RhU=;
Received: from [84.212.220.105] (helo=elva)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1mP3Co-0000b9-Qh; Sat, 11 Sep 2021 15:38:09 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Yuchen Pei <hi@HIDDEN>
Subject: Re: bug#50502: grep-command cannot be set as a cons of the command
 and the point position
References: <87a6kkyb89.fsf@HIDDEN>
Date: Sat, 11 Sep 2021 15:38:06 +0200
In-Reply-To: <87a6kkyb89.fsf@HIDDEN> (Yuchen Pei's message of "Fri, 10 Sep
 2021 20:29:58 +1000")
Message-ID: <87a6kjkzb5.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  Yuchen Pei <hi@HIDDEN> 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 [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 50502
Cc: 50502 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Yuchen Pei <hi@HIDDEN> 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@HIDDEN:
bug#50502; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 10 Sep 2021 10:30:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 10 06:30:15 2021
Received: from localhost ([127.0.0.1]:36943 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mOdnS-0008LI-R0
	for submit <at> debbugs.gnu.org; Fri, 10 Sep 2021 06:30:15 -0400
Received: from lists.gnu.org ([209.51.188.17]:58284)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <hi@HIDDEN>) id 1mOdnR-0008Jm-KS
 for submit <at> debbugs.gnu.org; Fri, 10 Sep 2021 06:30:13 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:36856)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <hi@HIDDEN>) id 1mOdnQ-00088B-Nh
 for bug-gnu-emacs@HIDDEN; Fri, 10 Sep 2021 06:30:13 -0400
Received: from wout3-smtp.messagingengine.com ([64.147.123.19]:60023)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <hi@HIDDEN>) id 1mOdnO-0003Ca-Dl
 for bug-gnu-emacs@HIDDEN; Fri, 10 Sep 2021 06:30:12 -0400
Received: from compute5.internal (compute5.nyi.internal [10.202.2.45])
 by mailout.west.internal (Postfix) with ESMTP id 208B63200A15
 for <bug-gnu-emacs@HIDDEN>; Fri, 10 Sep 2021 06:30:07 -0400 (EDT)
Received: from mailfrontend1 ([10.202.2.162])
 by compute5.internal (MEProxy); Fri, 10 Sep 2021 06:30:07 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ypei.me; h=from
 :to:subject:date:message-id:mime-version:content-type; s=fm2;
 bh=LEQWNgUdE4NRFnM4zjCiRvqYS/W+C7Vu7gGmQTks0+M=; b=Q8/TLT9B9b3M
 k1TyTXPRSOyEgtZR0wjG+X4QnYsEYo4T3QgmhgWUhSX1v4EdSEUnSWrpohB3/HAN
 foxHNOHNYFY5/aHt8pW/jALmUd9kdTfmKYr5YYRlQ/aK6El5clld6Vrrrfyx/D6q
 0PJPD4s7kBWAdcZ6Pm2IEHgtdl0dqtUButscDoSpd7SksvEjxWEypUpZcE244Lol
 eoxN0gQbzy49Kjh0zCn7M2rofyT5LKsQ6En4vbV9J2jw+kAp+2B7qUbBPD0Bor/m
 YUY6ozrazFYAAof0NM0Y5lONunj2txYx9CHdOrJBPAr7d2pUCANFrXclc3IbnEAk
 K2nrfduC0A==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=content-type:date:from:message-id
 :mime-version:subject:to:x-me-proxy:x-me-proxy:x-me-sender
 :x-me-sender:x-sasl-enc; s=fm3; bh=LEQWNgUdE4NRFnM4zjCiRvqYS/W+C
 7Vu7gGmQTks0+M=; b=iuwWitdoAzAtzECag7INwl2Yug6gs2Z/sFHa0Lgr1OUkM
 jyhoEGm6q8SHYL7xWGBbEHtkSN7YEzaFIBVR1X4QTi5cqeom0FdbEfIIEFjtK6/J
 5oX3qdZ5JUm1tdhSyst2wWCHHjhPf38bBlNDBR4mJOMAdd0cx3l2J3GT7unWnhYi
 kRkE8s0miL3FUbkAIUoGVID9ayCdnszazdLdDzSV4p1w/HHOiHNkTR6LUTw/DexB
 ioQooyphwE0tc2ZtLMQ54UrB8JeXyOmqAJr64T3pSj0orsvPTSDtm1AzSx12VCBy
 ctYwerHoQ58rLRt5yAcLoPSC6AkKjmJxpxjKCFVTA==
X-ME-Sender: <xms:rjM7YZMzoC406uSxwKaRon-cLTuIr2HYtvDC7yjam9iRNKZcLZwqPQ>
 <xme:rjM7Yb8jBhY-kZ0B1i8QNjqe63jiKNHTxOpY4KFP0Yv797I_m_kMIOex84oAMkeIT
 NlYA-3pKVe4nooxvw>
X-ME-Received: <xmr:rjM7YYQqL3LUA7QpG0Z1bv_12DkbzkMKuAAC1gihSufGetuHl6QN66pEZnR1bxIs55ed0GEziPoALWq5H4eJUgOStmVELAobzys->
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudeguddgvdejucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucenucfjughrpegfhffvufffkfggtgesghdtreertd
 ertdenucfhrhhomhepjghutghhvghnucfrvghiuceohhhiseihphgvihdrmhgvqeenucgg
 tffrrghtthgvrhhnpefhvdduudfhhfdtudelffelieffgefgheffgefhffduvefhheekue
 dvtddvueeifeenucffohhmrghinhepghhnuhdrohhrghdphihpvghirdhmvgenucevlhhu
 shhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehhiheshihpvghird
 hmvg
X-ME-Proxy: <xmx:rjM7YVse2-xORjvCUuPeu2vqo3MHmuLShF_p7uplkL2zzkJWMOXKoA>
 <xmx:rjM7YRdzudjxhQMw_YRqGJPj-qe9n0UjQGyrWStsW7fwWc5NLf7Fvg>
 <xmx:rjM7YR1Hd3BA5ZqFvAXxps0AxTSNcViQpLK6FZ8L-TY0AdLWEiMpMg>
 <xmx:rjM7YXpvXeLoRyJ5U6M6nMh4qhGI8Q2TGvC-S4cp1SXyEHsQpj68-Q>
Received: by mail.messagingengine.com (Postfix) with ESMTPA for
 <bug-gnu-emacs@HIDDEN>; Fri, 10 Sep 2021 06:30:04 -0400 (EDT)
User-agent: mu4e 1.4.13; emacs 27.2
From: Yuchen Pei <hi@HIDDEN>
To: bug-gnu-emacs <bug-gnu-emacs@HIDDEN>
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-ID: <87a6kkyb89.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=====-=-=";
 micalg=pgp-sha256; protocol="application/pgp-signature"
Received-SPF: pass client-ip=64.147.123.19; envelope-from=hi@HIDDEN;
 helo=wout3-smtp.messagingengine.com
X-Spam_score_int: -8
X-Spam_score: -0.9
X-Spam_bar: /
X-Spam_report: (-0.9 / 5.0 requ) DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
 DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7,
 RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.6 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.6 (--)

--=====-=-=
Content-Type: text/plain; format=flowed

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>

--=====-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iIEEARYIACkWIQRH+dBQHhGIeZBASUEhJn6T74bf0AUCYTszpwscaGlAeXBlaS5t
ZQAKCRAhJn6T74bf0EiHAQCgquQgG3YbOc54cVS3vQGuxC5zZtuVe1SPVUTafQQk
GgD+OMo/ymnwnomh9o4ox2siuZ2RYgkE5p4O6EMocue2ygw=
=ZHE9
-----END PGP SIGNATURE-----
--=====-=-=--




Acknowledgement sent to Yuchen Pei <hi@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#50502; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sat, 11 Sep 2021 13:45:01 UTC

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