From unknown Fri Aug 15 02:03:06 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#27236 <27236@debbugs.gnu.org> To: bug#27236 <27236@debbugs.gnu.org> Subject: Status: 25.1; grep: nonsensical default commands offered Reply-To: bug#27236 <27236@debbugs.gnu.org> Date: Fri, 15 Aug 2025 09:03:06 +0000 retitle 27236 25.1; grep: nonsensical default commands offered reassign 27236 emacs submitter 27236 Yuri Khan severity 27236 minor thanks From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 04 13:23:15 2017 Received: (at submit) by debbugs.gnu.org; 4 Jun 2017 17:23:15 +0000 Received: from localhost ([127.0.0.1]:56050 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dHZFB-0002KJ-E5 for submit@debbugs.gnu.org; Sun, 04 Jun 2017 13:23:13 -0400 Received: from eggs.gnu.org ([208.118.235.92]:57720) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dHZFA-0002K5-7L for submit@debbugs.gnu.org; Sun, 04 Jun 2017 13:23:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dHZF3-00030U-H4 for submit@debbugs.gnu.org; Sun, 04 Jun 2017 13:23:07 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:49794) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dHZF3-00030M-DY for submit@debbugs.gnu.org; Sun, 04 Jun 2017 13:23:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48677) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dHZF1-0004cj-PL for bug-gnu-emacs@gnu.org; Sun, 04 Jun 2017 13:23:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dHZF0-0002wq-AM for bug-gnu-emacs@gnu.org; Sun, 04 Jun 2017 13:23:03 -0400 Received: from mail-wm0-x236.google.com ([2a00:1450:400c:c09::236]:34973) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dHZF0-0002tj-0H for bug-gnu-emacs@gnu.org; Sun, 04 Jun 2017 13:23:02 -0400 Received: by mail-wm0-x236.google.com with SMTP id b84so57709376wmh.0 for ; Sun, 04 Jun 2017 10:23:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:from:date:message-id:subject:to :content-transfer-encoding; bh=jfS1l2B+DbLpQFnrO6/RVZ7ofeUXLjP+gPFYYN5bl9U=; b=LLrCN+7C7prJmEECHifR2achMurnD4j/Mdg1wMZcMG0zveGT6qQJVPj7B2A8lzjVWT BjpnfXqjcwOsf30cNv/OjfzFN2EvlQdPyyJJVddSeo/3B4v3E0jw941ZUSqdqrycTXjp E9eh1NSWY7EJGugppaVSLdagBMUojzhI9c/abuGyv4oByPpaPy7Zij83JK20zwQ+6qX5 QYtl1Vd00AB9yASH7UhAk1lJJbjcDhA+RG75d2hPpkZiYMabAnY8oiCd6grrH15cDrG+ BdzY3hAJaT5mO2ylFDV3YTJ4Fjke1WAkyxrx81O5ud3Gp0F5n+JYzrXh3M9mXhG/AZ59 s4Iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:from:date:message-id:subject :to:content-transfer-encoding; bh=jfS1l2B+DbLpQFnrO6/RVZ7ofeUXLjP+gPFYYN5bl9U=; b=AB9Y3qxAXIkN78f9BwqUmMhLXDehmSCWwU8JvR8YWNzD8ZTjsEit2rwPICT4h8qYWk d+oZ0VKksf+5Iow0o+vlLtxm//sOr5+4wSU4r5OrKQoiSzyy58hsaEG7xZxb1pbOjBY8 URc8cCaMSasE2EP4tKH7dHoP/2qwNcH89BcxwwTNNK3HeM9td3Q4G64yxNC5y389FCN/ tll2S8mqcot/3R+Ps/EnWR2/NKlOvWJgefcaVg2ZiGVMnlOZwJuMtauovUBv38T5X+5Q DWYj6cp9eDqGnFqk9j1kXr3x4AtEXwVWsg2bgALos6hz7xXemjUL3y5S83kuWhojqmb5 eulg== X-Gm-Message-State: AODbwcAabgs/oFii1Zndjwe0/qO8r3VCi02X/qOO71wFLLS2Px798HFZ 7basRpqNPNgCowOT7gAJNmV231X3ylv1 X-Received: by 10.28.220.138 with SMTP id t132mr5592199wmg.63.1496596979084; Sun, 04 Jun 2017 10:22:59 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.164.93 with HTTP; Sun, 4 Jun 2017 10:22:38 -0700 (PDT) From: Yuri Khan Date: Mon, 5 Jun 2017 00:22:38 +0700 X-Google-Sender-Auth: z2q0LVH2lY5fiD34lTctJycKNCY Message-ID: Subject: 25.1; grep: nonsensical default commands offered To: bug-gnu-emacs@gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) Running =E2=80=98grep=E2=80=99 and cycling through suggested defaults start= s with the value of =E2=80=98grep-command=E2=80=99, followed by that command with the = current symbol substituted. After that, it offers the same command but with the name of a text editor or viewer added in front. The call sequence is as follows: * =E2=80=98grep=E2=80=99 computes the initial command and the first default= 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-minibuffer= =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 pr= ovided default command as a file name and consults =E2=80=98mailcap-file-default-commands=E2=80=99 for commands applicable to = 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/plain = file and returns a list of text editors and viewers. $ emacs -Q M-x grep RET =E2=87=92 Run grep (like this): grep --color -nH -e =E2=87=92 Run grep (like this): grep --color -nH '' =E2=87=92 Run grep (like this): less grep --color -nH '' =E2=87=92 Run grep (like this): more grep --color -nH '' =E2=87=92 Run grep (like this): /usr/bin/emacs24 -nw grep --color -nH '' =E2=87=92 Run grep (like this): /usr/bin/emacs24 grep --color -nH '' =E2=87=92 Run grep (like this): /usr/bin/emacs25 -nw grep --color -nH '' =E2=87=92 Run grep (like this): /usr/bin/emacs25 grep --color -nH '' =E2=87=92 Run grep (like this): geany grep --color -nH '' =E2=87=92 Run grep (like this): gvim -f grep --color -nH '' =E2=87=92 Run grep (like this): mousepad grep --color -nH '' =E2=87=92 Run grep (like this): gedit --new-document grep --color -nH '' =E2=87=92 Run grep (like this): kate -b grep --color -nH '' =E2=87=92 Run grep (like this): vim grep --color -nH '' =E2=87=92 Run grep (like this): view grep --color -nH '' =E2=87=92 Run grep (like this): gview grep --color -nH '' =E2=87=92 End of defaults; no next item In GNU Emacs 25.1.1 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9) of 2016-12-13, modified by Debian built on lgw01-55 Windowing system distributor 'The X.Org Foundation', version 11.0.11804000 System Description: Ubuntu 16.04.2 LTS Configured using: 'configure --build x86_64-linux-gnu --prefix=3D/usr --sharedstatedir=3D/var/lib --libexecdir=3D/usr/lib --localstatedir=3D/var/lib --infodir=3D/usr/share/info --mandir=3D/usr/share/man --with-pop=3Dyes --enable-locallisppath=3D/etc/emacs25:/etc/emacs:/usr/local/share/emacs/25= .1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/25.1/site-li= sp:/usr/share/emacs/site-lisp --with-sound=3Dalsa --build x86_64-linux-gnu --prefix=3D/usr --sharedstatedir=3D/var/lib --libexecdir=3D/usr/lib --localstatedir=3D/var/lib --infodir=3D/usr/share/info --mandir=3D/usr/share/man --with-pop=3Dyes --enable-locallisppath=3D/etc/emacs25:/etc/emacs:/usr/local/share/emacs/25= .1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/25.1/site-li= sp:/usr/share/emacs/site-lisp --with-sound=3Dalsa --with-x=3Dyes --with-x-toolkit=3Dgtk3 --with-toolkit-scroll-bars 'CFLAGS=3D-g -O2 -fstack-protector-strong -Wformat -Werror=3Dformat-security -Wall' 'CPPFLAGS=3D-Wdate-time -D_FORTIFY_SOURCE=3D2' 'LDFLAGS=3D-Wl,-Bsymbolic-functions -Wl,-z,relro'' Configured features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 Important settings: value of $LC_MONETARY: en_RU.UTF-8 value of $LC_NUMERIC: en_RU.UTF-8 value of $LC_TIME: en_RU.UTF-8 value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: shell-dirtrack-mode: t tooltip-mode: t global-eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. user-error: End of defaults; no next item [4 times] Quit Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message dired format-spec rfc822 mml mml-sec password-cache epg epg-config gnus-util mm-decode mm-bodies mm-encode mailabbrev gmm-utils mailheader sendmail mail-utils mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mm-util help-fns help-mode easymenu cl-loaddefs pcase cl-lib mail-prsvr mailcap shell pcomplete thingatpt grep compile comint ansi-color ring time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese charscript case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote dbusbind inotify dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 105943 8853) (symbols 48 20562 0) (miscs 40 49 146) (strings 32 22520 4388) (string-bytes 1 586592) (vectors 16 12928) (vector-slots 8 441075 3385) (floats 8 167 117) (intervals 56 249 0) (buffers 976 17) (heap 1024 35911 998)) From debbugs-submit-bounces@debbugs.gnu.org Tue May 17 15:00:52 2022 Received: (at 27236) by debbugs.gnu.org; 17 May 2022 19:00:52 +0000 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 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=; 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 From: Lars Ingebrigtsen To: Yuri Khan Subject: Re: bug#27236: 25.1; grep: nonsensical default commands offered References: X-Now-Playing: David Bowie's _Conversation Piece (3): Conversation Pieces_: "Janine (Mono Mix)" Date: Tue, 17 May 2022 21:00:38 +0200 In-Reply-To: (Yuri Khan's message of "Mon, 5 Jun 2017 00:22:38 +0700") Message-ID: <87v8u4htm1.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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: Yuri Khan writes: > The call sequence is as follows: > > * ‘grep’ computes the initial command and the first default command. > * ‘grep’ calls ‘read-shell-command’. > * ‘read-shell-command’ calls ‘rea [...] 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: 27236 Cc: 27236@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) 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 From debbugs-submit-bounces@debbugs.gnu.org Tue May 17 15:00:56 2022 Received: (at control) by debbugs.gnu.org; 17 May 2022 19:00:56 +0000 Received: from localhost ([127.0.0.1]:57941 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nr2RE-0003oV-Hw for submit@debbugs.gnu.org; Tue, 17 May 2022 15:00:56 -0400 Received: from quimby.gnus.org ([95.216.78.240]:56810) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nr2RD-0003o8-D6 for control@debbugs.gnu.org; Tue, 17 May 2022 15:00:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=3x++XhMv742Qz+5pm0KKNaggQCcAapbxeRFBGMrHDtM=; b=q619CyTwm4qtA0lAtIRg/PiilJ ylsIZsNhsl0v+rfv42qwoRXvbWmn5cSRaEdIJ+dx28Ut0UN7bkcgQc4aloLHpkBqDORgF9p4pkE05 EmRBsVkNp0suczq1ElOAQf+bRkedYsqP7EL2yBYs0YFGu5lYqYZUgMrYyjQQfRXrO4cU=; 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 1nr2R5-0005wf-Ha for control@debbugs.gnu.org; Tue, 17 May 2022 21:00:49 +0200 Date: Tue, 17 May 2022 21:00:45 +0200 Message-Id: <87tu9ohtlu.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #27236 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: close 27236 29.1 quit 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: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) close 27236 29.1 quit From unknown Fri Aug 15 02:03:06 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 15 Jun 2022 11:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator