I know I can get case-insensitive filename completion in the minibuffer using read-file-name-completion-ignore-case, but this doesn't seem to apply to all filename completion in the minibuffer. Specifically, it doesn't seem to apply when I'm using shell-command. Example:

$ emacs -Q
M-: (setq read-file-name-completion-ignore-case t)
M-! touch /tmp/HelloThere
C-x C-f /tmp/hello<TAB>  <-- this completes to HelloThere, as expected
M-! shell-command<RET>ls /tmp/Hello<TAB>  <-- this completes to HelloThere, as expected
M-! shell-command<RET>ls /tmp/hello<TAB>   <-- no completion

Is there any way to get whatever is completing /tmp/HelloThere while reading from the minibuffer for a shell-command to respect read-file-name-completion-ignore-case?

1 Answer 1


Bind tags-case-fold-search to t in a function that otherwise just calls tags-completion-at-point-function, and put that function on completion-at-point-functions.

The problem you are running into is that read-file-name-completion-ignore-case is not used, and that is because read-file-name is not used.

(Alternatively, you can bind tags-case-fold-search to non-nil and non-t, and bind case-fold-search to non-nil.)

  • So you mean like this, right? Still doesn't work... :(
    – mgalgs
    Commented Oct 14, 2014 at 3:54
  • completion-at-point-functions should be a list of functions, not a single function. You can discover this using C-h v completion-at-point-functions or by reading the Elisp manual, node Completion in Buffers.
    – Drew
    Commented Oct 14, 2014 at 14:07
  • Even so, tags-completion-at-point-function seems to rely on etags. I'm not certain that etags is guaranteed to have all of your filename completions unless you have configured it to do so. Is that right?
    – nispio
    Commented Oct 14, 2014 at 16:31
  • @nispio: The point is that this is the kind of completion that TAB provides in shell mode. Whether it does what you want in all cases is not the point. You can of course change the behavior of shell-mode completion, as you can change nearly anything in Emacs. But tags-completion-at-point is the completion it provides out of the box. In my own code (Icicles), for example, I provide a different kind of completion for shell (comint) mode.
    – Drew
    Commented Oct 14, 2014 at 16:38
  • Whoever downvoted: Care to say why? Something you didn't like?
    – Drew
    Commented Oct 14, 2014 at 22:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.