unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Yuri Khan <yuri.v.khan@gmail.com>
Cc: 27236@debbugs.gnu.org
Subject: bug#27236: 25.1; grep: nonsensical default commands offered
Date: Tue, 17 May 2022 21:00:38 +0200	[thread overview]
Message-ID: <87v8u4htm1.fsf@gnus.org> (raw)
In-Reply-To: <CAP_d_8W+PZwLUwgRzB9+32aFmQLUxZLyeSdJnv1GqLWcs3Md9A@mail.gmail.com> (Yuri Khan's message of "Mon, 5 Jun 2017 00:22:38 +0700")

Yuri Khan <yuri.v.khan@gmail.com> 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 ‘read-from-minibuffer’ with a setup hook
> that binds ‘minibuffer-default-add-function’ to
> ‘minibuffer-default-add-shell-commands’.
> * ‘minibuffer-default-add-shell-commands’ interprets the provided
> default command as a file name and consults
> ‘mailcap-file-default-commands’ for commands applicable to that file
> name.
> * The default command has no file extension, so
> ‘mailcap-file-default-commands’ assumes it is a text/plain 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=auto -nH --null '' "))
=> ("/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.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





      reply	other threads:[~2022-05-17 19:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-04 17:22 bug#27236: 25.1; grep: nonsensical default commands offered Yuri Khan
2022-05-17 19:00 ` Lars Ingebrigtsen [this message]

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=87v8u4htm1.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=27236@debbugs.gnu.org \
    --cc=yuri.v.khan@gmail.com \
    /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).