From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#27236: 25.1; grep: nonsensical default commands offered Date: Tue, 17 May 2022 21:00:38 +0200 Message-ID: <87v8u4htm1.fsf@gnus.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30009"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 27236@debbugs.gnu.org To: Yuri Khan Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue May 17 21:04:30 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nr2Uf-0007Zu-Qa for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 17 May 2022 21:04:29 +0200 Original-Received: from localhost ([::1]:59370 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nr2Ue-0001FB-OK for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 17 May 2022 15:04:28 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59818) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nr2Rd-0005tN-3B for bug-gnu-emacs@gnu.org; Tue, 17 May 2022 15:01:22 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:35811) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nr2RJ-0001DO-UA for bug-gnu-emacs@gnu.org; Tue, 17 May 2022 15:01:20 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nr2RJ-0003oz-S2 for bug-gnu-emacs@gnu.org; Tue, 17 May 2022 15:01:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 17 May 2022 19:01:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27236 X-GNU-PR-Package: emacs Original-Received: via spool by 27236-submit@debbugs.gnu.org id=B27236.165281405214652 (code B ref 27236); Tue, 17 May 2022 19:01:01 +0000 Original-Received: (at 27236) by debbugs.gnu.org; 17 May 2022 19:00:52 +0000 Original-Received: from localhost ([127.0.0.1]:57938 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nr2RA-0003oF-7t for submit@debbugs.gnu.org; Tue, 17 May 2022 15:00:52 -0400 Original-Received: from quimby.gnus.org ([95.216.78.240]:56796) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nr2R8-0003o0-0u for 27236@debbugs.gnu.org; Tue, 17 May 2022 15:00:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID :In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To: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=V3ChjEgein32MDAGL18YA1TBxZquviD0ZLoQ0meXcmk=; b=jlY2T/Qt7iOcpMyYxo6m4NV/hy DjUbTF0UF8mTh65W7fJ3DLrxZX2S299t/T+zhNtqz/baQMVp17mJvFPeQ6ol1gsnT+G2pyU6uNmDu bTjM150oT8qPiY6McTko7oZIVywbYFcKMbPTTXsghzhLpyGLHHbigzEyYzveBtYgiZLE=; Original-Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nr2Qx-0005wS-LW; Tue, 17 May 2022 21:00:43 +0200 X-Now-Playing: David Bowie's _Conversation Piece (3): Conversation Pieces_: "Janine (Mono Mix)" In-Reply-To: (Yuri Khan's message of "Mon, 5 Jun 2017 00:22:38 +0700") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:232487 Archived-At: Yuri Khan writes: > The call sequence is as follows: > > * =E2=80=98grep=E2=80=99 computes the initial command and the first defau= lt command. > * =E2=80=98grep=E2=80=99 calls =E2=80=98read-shell-command=E2=80=99. > * =E2=80=98read-shell-command=E2=80=99 calls =E2=80=98read-from-minibuffe= r=E2=80=99 with a setup hook > that binds =E2=80=98minibuffer-default-add-function=E2=80=99 to > =E2=80=98minibuffer-default-add-shell-commands=E2=80=99. > * =E2=80=98minibuffer-default-add-shell-commands=E2=80=99 interprets the = provided > default command as a file name and consults > =E2=80=98mailcap-file-default-commands=E2=80=99 for commands applicable t= o that file > name. > * The default command has no file extension, so > =E2=80=98mailcap-file-default-commands=E2=80=99 assumes it is a text/plai= n file and > returns a list of text editors and viewers. (I'm going through old bug reports that unfortunately weren't resolved at the time.) Looking at this call chain, there doesn't seem to be any easy way to defeat this behaviour -- in this case, we really don't want any of the guesses from minibuffer-default-add-shell-commands/mailcap, I think? So perhaps we should add a variable to inhibit this action? On the other hand, the mailcap function is called with something that "clearly" isn't a file, namely: (mailcap-file-default-commands '("grep --color=3Dauto -nH --null '' ")) =3D> ("/usr/bin/emacs -nw") So perhaps we could introduce some logic to this mailcap function to detect that we don't really have a file name here. So I've now done the latter in Emacs 29. --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no